Skip to content

Commit 3c991fc

Browse files
committed
Add auton chooser
1 parent 1ccc047 commit 3c991fc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/frc/robot/RobotContainer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package frc.robot;
66

7+
import com.pathplanner.lib.auto.AutoBuilder;
78
import com.pathplanner.lib.auto.NamedCommands;
89
import edu.wpi.first.math.controller.ProfiledPIDController;
910
import edu.wpi.first.math.geometry.Pose2d;
@@ -14,6 +15,8 @@
1415
import edu.wpi.first.wpilibj.DriverStation;
1516
import edu.wpi.first.wpilibj.Filesystem;
1617
import edu.wpi.first.wpilibj.RobotBase;
18+
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
19+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1720
import edu.wpi.first.wpilibj2.command.Command;
1821
import edu.wpi.first.wpilibj2.command.Commands;
1922
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
@@ -32,6 +35,8 @@ public class RobotContainer
3235
private final SwerveSubsystem drivebase = new SwerveSubsystem(new File(Filesystem.getDeployDirectory(),
3336
"swerve"));
3437

38+
private final SendableChooser<Command> autoChooser;
39+
3540
/**
3641
* Converts driver input into a field-relative ChassisSpeeds that is controlled by angular velocity.
3742
*/
@@ -94,6 +99,9 @@ public RobotContainer()
9499
configureBindings();
95100
DriverStation.silenceJoystickConnectionWarning(true);
96101
NamedCommands.registerCommand("test", Commands.print("I EXIST"));
102+
103+
autoChooser = AutoBuilder.buildAutoChooser("TestAuto");
104+
SmartDashboard.putData("Auto Chooser", autoChooser);
97105
}
98106

99107
/**
@@ -180,7 +188,8 @@ private void configureBindings()
180188
public Command getAutonomousCommand()
181189
{
182190
// An example command will be run in autonomous
183-
return drivebase.getAutonomousCommand("TestAuto");
191+
//return drivebase.getAutonomousCommand("TestAuto");
192+
return autoChooser.getSelected();
184193
}
185194

186195
public void setMotorBrake(boolean brake)

0 commit comments

Comments
 (0)