I am running Java, just for the record.
So I have this in OI:
Code:
public void switcher() {
driveSwitch = new SendableChooser();
driveSwitch.addDefault("Joystick Arcade (1)", new JoystickArcade());
driveSwitch.addDefault("Joystick Arcade (2)", new DualJoystickArcade());
driveSwitch.addDefault("Joystick Tank", new DualJoystickTank());
driveSwitch.addObject("Kinect", new KinectCommand());
SmartDashboard.putData("Drive Switch", driveSwitch);
}
And this in RobotMain:
Code:
public void testInit() {
autonomousCommand.cancel();
teleopCommand.cancel();
msg.printLn("[mode] Dev");
CommandBase.oi.initLiveWindow();
msg.printLn("[status] LiveWindow initialized");
CommandBase.oi.switcher();
driveCommand = (Command) CommandBase.oi.driveSwitch.getSelected();
driveCommand.start();
}
public void testPeriodic() {
LiveWindow.run();
}
This code would allow it to switch, but it would require switching modes beforehand. My question is, how should I set it up to be able to switch modes on the fly? I feel like calling driveCommand.start() over and over in testPeriodic wouldn't work so well, but I have no idea. How should I check the current state of the SendableChooser against the current command running?