Skip to content

Instantly share code, notes, and snippets.

@ArchdukeTim
Created February 8, 2016 18:27
Show Gist options
  • Save ArchdukeTim/09a53e728896716512e3 to your computer and use it in GitHub Desktop.
Save ArchdukeTim/09a53e728896716512e3 to your computer and use it in GitHub Desktop.
def initialize(self):
from autonomous import SimpleAutonomous
self.obstacles = {
'LowGoal': SimpleAutonomous.LowGoal(),
'A0': SimpleAutonomous.DirectPortcullis(),
'A1': SimpleAutonomous.ChevalDeFrise()
}
@state(first = True)
def main_autonomous(self, initial_call):
if initial_call:
self.obstacles['A1'].on_enable()
self.obstacles['A1'].on_iteration()
if self.obstacles['A1'].isFinished:
self.next_state('finished')
@state
def finished(self):
raise
##THIS LINE BREAKS @timed_state(duration = 2, next_state='lower_arms', first = False if isinstance(self, ModularAutonomous.ModularAutonomous) else True)
def drive_to(self, initial_call):
if initial_call:
self.drive.reset_drive_encoders()
if self.drive.drive_distance(self.Drive_to_distance*12):
self.next_state('lower_arms')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment