Thanks, I'll try it out when I get a chance.
Here's my "switch" code, though I'm not sure whether it's going to work.
Code:
Command autonomousCommand, teleopCommand;
DriverStation driverstation = DriverStation.getInstance();
Messager msg = new Messager();
OI kinectSwitch = new OI();
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
// instantiate the command used for the autonomous period
msg.printLn("Initializing Robot");
if(kinectSwitch.getKinectStatus()) {
autonomousCommand = new KinectCommand();
} else {
autonomousCommand = new AutonomousCommand();
}
teleopCommand = new TeleopCommand();
AxisCamera camera = AxisCamera.getInstance();
camera.writeMaxFPS(18);
SmartDashboard.putData(Scheduler.getInstance());
msg.printLn("Robot Initialized");
// Initialize all subsystems
CommandBase.init();
}
From OI.java:
Code:
InternalButton kinectButton = new InternalButton();
.............
public boolean getKinectStatus() {
return kinectButton.get();
}
.............
public OI(){
SmartDashboard.putData("Enable Kinect", kinectButton);
}
(EDIT)
I've been looking at an alternate way of doing it via the "sendableChooser" method of SmartDashboard.
Code:
NetworkTable.initialize();
SendableChooser autonomousSwitch = new SendableChooser();
autonomousSwitch.addDefault("Default autonomous", new AutonomousCommand());
autonomousSwitch.addObject("Kinect hybrid", new KinectCommand());
SmartDashboard.putData("Kinect Switch", autonomousSwitch);
autonomousCommand = (Command) autonomousSwitch.getSelected();