NOTE: Some of the function/class/template names have changed since I began working with this, so I may accidentally use a old name.
Quote:
Originally Posted by mikelowry
Thanks for the help, but now we have a more specific question.
We are experimenting with autonomous and we have this code
Code:
void Autonomous(void)
{
GetWatchdog().SetEnabled(false);
myRobot.Drive(0.5,0.5);
}
we dont really know what GetWatchdog is, we know that the sample code has it.
What we have so far makes it drive straight at half speed indefinitely as far as we can tell. We looked at RobotDrive.cpp and .h in the WPILib but we cant figure out how to end the .drive command and move on to the next line.
|
The watchdog is a safety feature. When enabled, you call Feed(
Timeout) where
Timeout is the amount of time before the robot will be disabled. If you call Feed again within the timeout period the robot continues normally. If you don't all outputs are disabled.
When you are debugging you will often disable the watchdog.
The myRobot.Drive() function sets a speed, and continues at that speed until told otherwise.
If you are using the Simple robot template you just insert a delay (I believe there is a Wait() function in there somewhere), then call Drive again.
If you are using the Itterative robot template you have a little more work todo. Essentially you would create a state machine using the number of itterations and/or sensor inputs to move between states (forward until hit wall, left turn 90 degree, ect.).