import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.RobotController;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.constants.Constants;
PortForwarder.add(5800,"10.9.72.12",5800);
PortForwarder.add(1182,"10.9.72.12",1182);
+ // Adding auto options on to SendableChooser on SmartDashboard
+
+
// Set up data receivers & replay source
switch (Constants.CURRENT_MODE) {
case REAL:
// changes networktables.json, networktables.json.bck (both Untracked)
// Uncomment the next line, set the desired RobotId, deploy, and then comment the line out
// RobotId.setRobotId(RobotId.SwerveCompetition);
- DriveConstants.update(RobotId.getRobotId());
+
RobotController.setBrownoutVoltage(6.0);
// obtain this robot's identity
RobotId robotId = RobotId.getRobotId();
+ DriveConstants.update(robotId);
+
// Record metadata
Logger.recordMetadata("ProjectName", BuildData.MAVEN_NAME);
Logger.recordMetadata("BuildDate", BuildData.BUILD_DATE);
import org.littletonrobotics.junction.Logger;
import com.pathplanner.lib.auto.AutoBuilder;
+import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
+import edu.wpi.first.wpilibj2.command.InstantCommand;
import frc.robot.commands.DoNothing;
import frc.robot.commands.drive_comm.DefaultDriveCommand;
import frc.robot.commands.vision.ShutdownAllPis;
private BaseDriverConfig driver = null;
private Operator operator = null;
+ // Auto
+ private final SendableChooser<Command> autoChooser = new SendableChooser<>();
+ private Command autoSelected;
+
/**
* The container for the robot. Contains subsystems, OI devices, and commands.
* <p>
* Different robots may have different subsystems.
*/
public RobotContainer(RobotId robotId) {
+ // display the current robot id on smartdashboard
+ SmartDashboard.putString("RobotID", robotId.toString());
+
+ // Filling the SendableChooser on SmartDashboard
+ chooserInit();
+
// dispatch on the robot
switch (robotId) {
case TestBed1:
SmartDashboard.putData("Shutdown Orange Pis", new ShutdownAllPis());
}
+ public void chooserInit(){
+ autoChooser.setDefaultOption("Do nothing", new DoNothing());
+ autoChooser.addOption("Do nada", new DoNothing());
+ autoChooser.addOption("Spin my wheels", new DoNothing());
+ autoChooser.addOption("Hello world", new InstantCommand(() -> System.out.println("Hello world")));
+ SmartDashboard.putData("Auto chooser", autoChooser);
+ }
+
/**
* Sets whether the drivetrain uses vision toupdate odometry
*/
}
public void registerCommands() {
-
}
public static BooleanSupplier getAllianceColorBooleanSupplier() {
}
}
+// Autos
+
+
+
+ /**
+ * Gets the auto command from SmartDashboard
+ * @return
+ */
public Command getAutoCommand(){
- return auto;
+ autoSelected = autoChooser.getSelected();
+ return autoSelected;
}
public void logComponents(){