Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   SmartDashboard's sendableChooser (http://www.chiefdelphi.com/forums/showthread.php?t=103775)

evilcrouton 24-02-2012 18:14

SmartDashboard's sendableChooser
 
I see that you can use Smartdashboard's sendableChooser to create radio buttons to choose autonomous programs with command-based programming. However, is it possible to do this with iterative robot? This is what i have in robotInit():

Code:

        NetworkTable.initialize();
        autoChooser = new SendableChooser();
        autoChooser.addDefault("Default program", new Autonomous1());
        autoChooser.addObject("Experimental auto", new Autonomous2());
        SmartDashboard.putData("Autonomous mode chooser", autoChooser);

Where Autonomous1() and Autonomous2() are new classes with autonomous code. With this code, SmartDashboard displays two radio buttons. Now here comes the tricky part. What do I do in autonomousPeriodic() to choose what is selected?

Ginto8 24-02-2012 23:46

Re: SmartDashboard's sendableChooser
 
If you call autoChooser.getSelected(), it will return to you the current choice as an Object which you can cast however you'd like. I don't know how you have Autonomous1() and Autonomous2() set up, so I don't know how you'd specifically do it.


All times are GMT -5. The time now is 09:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi