View Single Post
  #5   Spotlight this post!  
Unread 31-01-2011, 19:07
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: gyro c++ Programing

A simple way, not necessarily the best way, is to do the following:
Code:
float targetAngle = gyro.GetAngle() + 45.0;
 
while (gyro.GetAngle() < targetAngle)
{
    //
    // Turn the robot to the right at half speed.
    //
    myRobot.ArcadeDrive(0.0, 0.5);
}
//
// Go straight at half speed.
//
myRobot.ArcadeDrive(0.5, 0.0);
Wait(3.0);
//
// Stop.
//
myRobot.ArcadeDrive(0.0, 0.0);
__________________
Reply With Quote