View Single Post
  #4   Spotlight this post!  
Unread 03-09-2009, 13:38
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: very basic code help

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 View Post
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.).
__________________
Eric Haskins KC9JVH
Reply With Quote