|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Autonomous Switching With the Iterative Robot Template
Hello everyone, I am a programmer from team 5137 and I was wondering if there was a simple way to choose an autonomous program from the smart dash board like the tutorial, but with the iterative robot template instead of command based.
Here is the tutorial: http://wpilib.screenstepslive.com/s/...smartdashboard |
|
#2
|
||||
|
||||
|
Re: Autonomous Switching With the Iterative Robot Template
The approach my team uses for multiple autonomous modes is to choose a mode based on one of the analog input sliders on the driver station (see attachment). Each autonomous mode is encapsulated within a class that inherits from the AutonomousMode base class. In autonomousInit(), we read the value of the first analog slider and then use that number in a switch statement to choose which autonomous class to create an instance of. Here's last year's code if you're interested (autonomous modes are in the "org.lunatecs316.frc2013.auto" package). The downside to this approach is that you have to remember the numbering of your autonomous modes.
|
|
#3
|
||||
|
||||
|
Re: Autonomous Switching With the Iterative Robot Template
You could do a similar thing as shown in the post above, but with Smartdashboard.
If you write: Code:
SmartDashboard.putNumber("exampleVal", value);
Code:
SmartDashboard.getNumber("exampleVal");
|
|
#4
|
||||
|
||||
|
Re: Autonomous Switching With the Iterative Robot Template
You can use the same code as given in the tutorial. I believe the second argument to the chooser addObject() is just an object, so it can be anything -- not just a command. You can use the result of chooser.getSelected() to decide which autonomous behavior to perform.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|