View Single Post
  #26   Spotlight this post!  
Unread 03-05-2014, 13:13
AGPapa's Avatar
AGPapa AGPapa is offline
Registered User
AKA: Antonio Papa
FRC #5895
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Robbinsville, NJ
Posts: 323
AGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond repute
Re: Share you Autonomous

Quote:
Originally Posted by SoftwareBug2.0 View Post
What I was trying to ask is if you could do something like:
Code:
if goal is hot:
  fire
  drive forward
else:
  turn
  fire
I've implemented something like that. I have an "if" command that continues autonomous from two different script files based on the result of some function. The first parameter of "if" is the name of the function to check. The next parameters are the name of the script file to run if true and then the name of the script file to run if false. For example, here is the two ball hot script.

in twoBallHot.script
Code:
SHIFT on
WAIT 1000
SET_SHOULDER 49
IF right_hot rightHot leftHot
in rightHot.script
Code:
DRIVE_STRAIGHT 75 0
TURN 12
WAIT 100
SHOOT
WAIT 400
SET_SHOULDER -5
TURN -152
INTAKE in
DRIVE_STRAIGHT 75 -152
SET_SHOULDER 49
TURN -7
INTAKE off
DRIVE_STRAIGHT 70 -7
WAIT 200
SHOOT
SHIFT off
in leftHot.script
Code:
DRIVE_STRAIGHT 75 0
TURN -12
WAIT 100
SHOOT
WAIT 400
SET_SHOULDER -5
TURN -150
INTAKE in
DRIVE_STRAIGHT 75 -150
SET_SHOULDER 49
TURN 17
INTAKE off
DRIVE_STRAIGHT 80 17
WAIT 200
SHOOT
SHIFT off
__________________
Team 2590 Student [2011-2014]
Team 5684 Mentor [2015]
Team 5895 Mentor [2016-]