fixy fixy

This commit is contained in:
Aarav
2023-02-25 16:16:54 -07:00
parent 7712134aeb
commit d09c7e464b
2 changed files with 11 additions and 8 deletions
@@ -79,6 +79,7 @@ public class RobotContainer {
private Command taxi = new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt"); private Command taxi = new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt");
PlaybackChooser playbackChooser;
/** /**
* The container for the robot. Contains subsystems, OI devices, and commands. * The container for the robot. Contains subsystems, OI devices, and commands.
*/ */
@@ -104,8 +105,9 @@ public class RobotContainer {
chooser.addOption("Taxi", taxi); chooser.addOption("Taxi", taxi);
PlaybackChooser playbackChooser = new PlaybackChooser(m_robotSwerveDrive, playbackChooser = new PlaybackChooser(m_robotSwerveDrive,
"Balance", new AutoBalance(m_robotMap.gyro, m_robotSwerveDrive)); "Balance", new AutoBalance(m_robotMap.gyro, m_robotSwerveDrive),
"Balance2", new AutoBalance(m_robotMap.gyro, m_robotSwerveDrive));
new JoystickButton(getDeadbandedDriverController(), XboxController.X_BUTTON) new JoystickButton(getDeadbandedDriverController(), XboxController.X_BUTTON)
.onTrue(new InstantCommand(() -> playbackChooser.appendCommand())); .onTrue(new InstantCommand(() -> playbackChooser.appendCommand()));
@@ -154,8 +156,8 @@ public class RobotContainer {
* @return the command to run in autonomous * @return the command to run in autonomous
*/ */
public Command getAutonomousCommand() { public Command getAutonomousCommand() {
// return chooser.getSelected();
return chooser.getSelected(); return playbackChooser.getCommand();
} }
public DeadbandedXboxController getDeadbandedDriverController() { public DeadbandedXboxController getDeadbandedDriverController() {
@@ -66,12 +66,13 @@ public class PlaybackChooser {
} }
public Command getCommand() { public Command getCommand() {
Command command = m_playback.getSelected(); Command command = m_playback.getSelected().asProxy();
for (int i = 1; i < m_choosers.size(); i++) { Command[] commands = new Command[m_choosers.size() - 1];
command.andThen(m_choosers.get(i).getSelected()); for (int i = 0; i < m_choosers.size()-1; i++) {
commands[i] = m_choosers.get(i + 1).getSelected().asProxy();
} }
return command; return command.andThen(commands);
} }
} }