View Single Post
  #4   Spotlight this post!  
Unread 17-12-2007, 10:43
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,721
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: user_routines_fast

Erm. To the point in the original question: autonomous mode is in User_Routines_Fast mostly just because that's how IFI has structured it. You could put it elsewhere and it would work just fine. But since any fast loop functions you might be calling would probably be defined in User_Routines_Fast, and since you'd probably need those in the fast part of your autonomous loop, it's easiest to put it there.

The basic flow of execution means that whenever the autonomous mode bit is set, you get kicked out of the tele-op loop and shunted into a very very similar autonomous mode loop. Really, you should think of the autonomous code as being exactly the same as your normal code, except you're not getting any valid input from the OI. But note that this does NOT mean that you don't need to wait for new rxdata. rxdata and txdata come from the master processor. Yes, the rxdata has the joystick data from the OI bundled up in it, but it has some other stuff from the master processor besides. Like the disable/enable bit and the autonomous/tele-op bit. More importantly, you HAVE to send the txdata back to the master processor shortly after it sends you an rxdata, or else the watchdog timer will time out and you'll get the dreaded red code light of death. Plus, txdata contains the PWM output values for the 12 PWMs that the user processor doesn't control, so not sending it would mean those 12 PWMs wouldn't do anything.

So, in summary, the autonomous loop is where it is for convenience, and waiting for rxdata is vital in ANY loop you might be in on an IFI controller.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter