|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Question on Autonomous Mode
We've put physical switches on our chassis that we have set before auto mode began to let the robot select the proper autonomous mode
|
|
#2
|
||||
|
||||
|
Re: Question on Autonomous Mode
If you don't mind, was there any particular reason you chose to use physical switches over using SmartDashboard or the FRC dashboard? Just a matter of comfort, or something else? Seems like a lot less flexible option to me, but I'm wondering if there's something else.
|
|
#3
|
||||
|
||||
|
Re: Question on Autonomous Mode
OP, I think you're using RobotPy [you had posted on the python forum earlier]?
RobotPy's wpilib utilities has some really useful autonomous tooling to allow you to select multiple modes via SmartDashboard (each .py file in the autonomous directory is automatically detected and added to the options), and also a really easy to use state machine helper for quick and easy autonomous mode creation. Code:
from robotpy_ext.autonomous import StatefulAutonomous
class DriveForward(StatefulAutonomous):
MODE_NAME = 'Drive Forward'
def initialize(self):
pass
@timed_state(duration=0.5, next_state='drive_forward', first=True)
def drive_wait(self):
pass
@timed_state(duration=5)
def drive_forward(self):
self.drive.move(0, 1, 0)
We also have a sample program that uses both the stateful autonomous helper and the automatic autonomous chooser. |
|
#4
|
||||
|
||||
|
Re: Question on Autonomous Mode
Quote:
Doing switches on the robot is reliable, but you can occasionally forget to set the switches before leaving the field (when you would still have a chance to fix it on the DS). Doing it on the DS is fine, but you either have to make the settings stick across power downs, or else have enough time to set the autonomous in the interval between when your DS makes contact with the robot and when the match starts. If you are having trouble getting the DS talking to the bot (happens...), you might not have enough time. DS with persistence seems to be best middle ground; you can set it while in queue, and fix it at the last second if needed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|