View Single Post
  #5   Spotlight this post!  
Unread 17-04-2006, 10:50
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,717
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: How to end an auto mode after gyro gets out of deadband

I've got a better guess. They want the robot to stop moving if it get whacked by another bot, and start again after the gyro settles down. and the robot stops going nuts. In that case, the check for the gyro condition comes before all other auto code. Like thus:

User_Autonomous()
{

gyro state reading goes here

if(gyro in good state)
{
good gyro code goes here
including all counter incrementing, auto mode switching, etc.
}
else
{
code to run if gyro is crazy goes here
could be an alternate automode or something else
stopping motors, etc.
}

}

That's much more pseudo than it is code, of course. You could get fancy and set a flag such that the gyro has to be sane for X loops for it to enter the good auto code. With the above code, the execution could jump into the good auto loop if you happen to catch the gyro fluctuating through a good value.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter