View Single Post
  #3   Spotlight this post!  
Unread 15-01-2006, 14:29
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: While Loop Require in OperatorControl?

Quote:
Originally Posted by chakorules
I think this was answered by BradMiller in this post:

Here

Post #7, thank you Brad.

It still would be nice to see a FLOW CHART on the EasyC excution of the PIC controller, if it is any different than the default FRC code from IFIRobotics.
OK - here you go - the runtime code in EasyC and in WPILib does this:

Code:
Initialize();
while (!IsEnabled());
while (1) {
    if (IsAutonomous())
    {
        Autonomous();
        while (IsAutonomous());
    }
    OperatorControl();
}
Notice that Initialize() is always run first - whenever the controller is turned on or reset.

Then it waits for the robot to be enabled.

Then it continuously runs either Autonomous() or OperatorControl() depending on the field condition. If you exit from Autonomous() it waits until
OperatorControl starts.

If you reset the robot during the match, it runs Initialize(), then either Autonomous() or OperatorControl() depending on the field setting.

One thing you can't see in this code is some magic stuff that happens behind the scenes that will cause the program to exit from Autonomous() or OperatorControl() if the field condition changes once either of those functions starts running.

Hope this helps...
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute