View Single Post
  #56   Spotlight this post!  
Unread 24-03-2010, 18:54
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Take an exit with dignity

Quote:
Originally Posted by 1075guy View Post
Not entirely sure I agree here.

Yes, C++ (what 1075 uses) DOES wait to start Teleop() until after Autonomous() is completed.

However, Autonomous() at least, as defined in the SimpleRobot template, has a While(IsAutonomous()){} loop in it. If your code is designed to pay attention to this fact, you should have no problems forcing your Autonomous code to stop operation the instant FMS changes your robots status from Autonomous to Teleop.
The thing is Autonomous coding is MUCH different from teleop coding. In teleop, the entire code is usually a loop that reads in data at the beginning and writes at the end. IsTeleop() is a fine solution to ending the teleop properly.

Autonomous on the other hand, it usually seen more as a pre-programmed set of instructions, executed sequentially. Very few teams do something as complex as a state machine that uses the IsAutonomous check in a continuous loop. The average C++/Java team will probably do waits between pre-defined commands, which does fail the termination part. The most common problems are when teams don't enforce the end of autonomous period in their code and just let it sit, waiting for an input (such as a ball hitting a sensor). Even in your IsAutonomous loop, if the code doesn't make it through the loop then end of autonomous is never checked, and the loop cannot end.
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote