I’ve been making some changes to our dashboard in preparation for championships. I’ve added a few SendableChoosers to the dashboard which drive some case statements in our commands.
I only have a few days of testing on this code, but it has been working reliably until today. On numerous occasions I would start the driver station, dashboard, and robot (order didn’t seem to make a difference) and some times one of the lists of radio buttons (sendable chooser) would not show up. The default option would be observed by the code (there is an associated getNumber call in a later method).
I’m not sure what it takes to get the chooser back. Either cRIO, robot, or dashboard reboot - or some combination thereof. I haven’t had enough time to troubleshoot this completely.
I’m concerned this will happen on the field and it would likely have undesirable results.
The code in question is below.
I’ve changed some of the names of variables, but other than that it’s functionally equivalent. Sorry if it doesn’t make much sense after the variable name changes.
private static double disc1Delay = 3.5,
disc2Delay = 0.7,
disc3Delay = 0.7;
private static final String TIME_1_DELAY_KEY = "Delay before shot 1",
TIME_2_DELAY_KEY = "Delay before shot 2",
TIME_3_DELAY_KEY = "Delay before shot 3";
public static final int A_1 = 1,
A_2 = 2,
A_3 = 3,
A_4 = 4,
B_1 = 1,
B_2 = 2,
B_3 = 3;
public void robotInit() {
// Initialize all subsystems
CommandBase.init();
//Start the compressor
compressor = new Compressor(RobotMap.compressorPressureSwitch, RobotMap.compressorPower);
compressor.start();
SmartDashboard.putBoolean("SomeBoolean", someBoolean);
//This set of radio buttons always seems to show up fine on the dashboard
aChooser = new SendableChooser();
aChooser.addDefault("a1", new Integer(A_1));
aChooser.addDefault("a2", new Integer(A_2));
aChooser.addDefault("a3", new Integer(A_3));
afterShotChooser.addDefault("a4", new Integer(A_4));
SmartDashboard.putData("A Chooser", aChooser);
SmartDashboard.putNumber(TIME_1_DELAY_KEY, disc1Delay);
SmartDashboard.putNumber(TIME_2_DELAY_KEY, disc2Delay);
SmartDashboard.putNumber(TIME_3_DELAY_KEY, disc3Delay);
//Methods to display some parameters of one of the Drivetrain Commands
SmartDashboard.putNumber("fast speed", DriveDrivetrainTurn_Simple.getFastSpeed());
SmartDashboard.putNumber("slow speed", DriveDrivetrainTurn_Simple.getSlowSpeed());
//this chooser doesn't show sometimes.
//I've tried running it later (here) and earlier in the robotInit() method.
//I've also tried calling the putData method multiple times. Same results
bChooser = new SendableChooser();
bChooser.addDefault("b1", new Integer(B_1));
bChooser.addObject("b2", new Integer(B_2));
bChooser.addObject("b3", new Integer(B_3));
SmartDashboard.putData("B Chooser", bChooser);
}
Has anyone seen sendableChoosers not show up on the dashboard?
It’s strange since it only happens with this one chooser.
I’ve tried saving the layout when the chooser was there, then reloading the saved layout (to get the chooser to show back up), but that didn’t fix the problem.
I can open the dashboard now on my computer (no robot online). And none of the choosers show up. All other elements appear to be there though.
What’s so special about the SendableChooser?
What is the mechanism that actually causes the chooser to get displayed?