Skip to content

Commit 505a77e

Browse files
authored
changed from SendableChooser to AutoChooser (#195)
1 parent 14ab3ad commit 505a77e

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/main/deploy/elastic-layout.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
"height": 136.0,
213213
"type": "ComboBox Chooser",
214214
"properties": {
215-
"topic": "/SmartDashboard/SendableChooser[1]",
215+
"topic": "/SmartDashboard/AutoChooser",
216216
"period": 0.06,
217217
"sort_options": false
218218
}
@@ -225,7 +225,7 @@
225225
"height": 136.0,
226226
"type": "Large Text Display",
227227
"properties": {
228-
"topic": "/SmartDashboard/SendableChooser[1]/active",
228+
"topic": "/SmartDashboard/AutoChooser/active",
229229
"period": 0.06,
230230
"data_type": "string"
231231
}

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
import com.frcteam3255.joystick.SN_XboxController;
1111

12+
import choreo.auto.AutoChooser;
1213
import choreo.auto.AutoFactory;
1314
import edu.wpi.first.epilogue.Logged;
1415
import edu.wpi.first.epilogue.NotLogged;
1516
import edu.wpi.first.math.geometry.Pose2d;
1617
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
1718
import edu.wpi.first.wpilibj.RobotController;
18-
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
1919
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
2020
import edu.wpi.first.wpilibj2.command.Command;
2121
import edu.wpi.first.wpilibj2.command.Commands;
@@ -45,7 +45,7 @@
4545
public class RobotContainer {
4646

4747
@NotLogged
48-
SendableChooser<Command> autoChooser = new SendableChooser<>();
48+
AutoChooser autoChooser = new AutoChooser();
4949

5050
private AutoFactory autoFactory;
5151

@@ -288,12 +288,12 @@ public void configAutos() {
288288
CleanAndScore("net_ef", "ef_net", TRY_CLEAN_HIGH),
289289
runPath("net_off_startingline").asProxy()); // FORGOT TO DO AS PROXY ON RUNPATH
290290

291-
autoChooser.setDefaultOption("4 Coral - Processor Side", procSide4Coral);
292-
autoChooser.addOption("4 Coral - Non-Processor Side", nonProcSide4Coral);
293-
autoChooser.addOption("1 Coral - Mid", mid1Coral);
294-
autoChooser.addOption("1 Algae - Mid", midAlgae);
291+
autoChooser.addCmd("4 Coral - Processor Side", () -> procSide4Coral);
292+
autoChooser.addCmd("4 Coral - Non-Processor Side", () -> nonProcSide4Coral);
293+
autoChooser.addCmd("1 Coral - Mid", () -> mid1Coral);
294+
autoChooser.addCmd("1 Algae - Mid", () -> midAlgae);
295295

296-
SmartDashboard.putData(autoChooser);
296+
SmartDashboard.putData("AutoChooser", autoChooser);
297297
}
298298

299299
Command ScoreAndCollect(String startPath, String endPath, Command reef_auto_drive_branch, Command try_prep_coral_l) {
@@ -417,7 +417,7 @@ private void configDriverBindings() {
417417
}
418418

419419
public Command getAutonomousCommand() {
420-
return autoChooser.getSelected();
420+
return autoChooser.selectedCommand();
421421

422422
}
423423

@@ -524,12 +524,14 @@ private void configOperatorBindings() {
524524
public void configFeedback() {
525525
isReadyToScoreReefFeedback
526526
.onTrue(Commands.runOnce(() -> subLED.setLED(constLED.READY_TO_SHOOT_ANIMATION, 0)))
527-
.whileTrue(Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble,constControllers.OPERATOR_RUMBLE)))
527+
.whileTrue(
528+
Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble, constControllers.OPERATOR_RUMBLE)))
528529
.onFalse(Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble, 0)))
529530
.onFalse(Commands.runOnce(() -> subLED.clearAnimation()));
530531
isReadyToScoreNetFeedback
531532
.onTrue(Commands.runOnce(() -> subLED.setLED(constLED.READY_TO_SHOOT_ANIMATION, 0)))
532-
.whileTrue(Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble,constControllers.OPERATOR_RUMBLE)))
533+
.whileTrue(
534+
Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble, constControllers.OPERATOR_RUMBLE)))
533535
.onFalse(Commands.runOnce(() -> conOperator.setRumble(RumbleType.kBothRumble, 0)))
534536
.onFalse(Commands.runOnce(() -> subLED.clearAnimation()));
535537
}

0 commit comments

Comments
 (0)