View Single Post
  #4   Spotlight this post!  
Unread 18-02-2010, 15:08
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Autonomous mode help

As I tell my students, if you're confused, ask a question that will get you unconfused. There are plenty of people here that are willing to help and answer questions. You won't learn anything if you're simply just given the answer.

The code that is in the getting started document starting at page 17 has an example autonomous program similar to what you're looking for. Look at the example on page 18 (example 5). The comments in the code spell out exactly what is going on. Try to see how the numbers in the comments map to the numbers in the code. Then go back to your original question and see how you can modify those numbers to do what you want them to do. Keep in mind, their RobotDrive object is called drivetrain while yours looks like it's called myRobot.

If you're still confused about what Drive() and Wait() do, read the comment in the the WPILib source code. I'll include the comments and prototypes here for reference. From RobotDrive.cpp
Code:
/**
 * Drive the motors at "speed" and "curve".
 *
 * The speed and curve are -1.0 to +1.0 values where 0.0 represents stopped and
 * not turning. The algorithm for adding in the direction attempts to provide a constant
 * turn radius for differing speeds.
 *
 * This function sill most likely be used in an autonomous routine.
 *
 * @param speed The forward component of the speed to send to the motors.
 * @param curve The rate of turn, constant for different forward speeds.
 */
void RobotDrive::Drive(float speed, float curve)
From Timer.cpp
Code:
/**
 * Pause the task for a specified time.
 * 
 * Pause the execution of the program for a specified period of time given in seconds.
 * Motors will continue to run at their last assigned values, and sensors will continue to
 * update. Only the task containing the wait will pause until the wait time is expired.
 * 
 * @param seconds Length of time to pause, in seconds.
 */
void Wait(double seconds)