View Single Post
  #1   Spotlight this post!  
Unread 30-11-2009, 20:25
Straberrie's Avatar
Straberrie Straberrie is offline
The Plague
AKA: Rebecca
FRC #0375 (Robotic Plague)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2007
Location: New York
Posts: 59
Straberrie will become famous soon enough
Gyro Programming

Hi, how are you?

I am trying to get gyros to work and I never programmed the sensor before, so I made use of the FIRST programming guide to implement gyros in the autonomous period.

Quote:
Gyro *gyro;
gyro = new Gyro (1);

gyro->Reset();
gyro->SetSensitivity(.005);

float angle = gyro->GetAngle();

myRobot->Drive(-1.0, -angle / 30);
Wait(4.0);
According to the guide, the above should have corrected the robot's path and set it to match the heading of the original angle. Since the original angle was 0, it should have went straight.

However, when we tested it on the robot, it immediately made a sharp turn.

In order to see what is happening with the angle values, I created an if statement

Quote:
float angle = gyro->GetAngle();

if (angle<0.5)
{
myRobot->Drive(1.0, 0.0);
Wait(0.0);
}
else
{
myRobot->Drive(0.0, 0.0);
Wait(0.0);
}
And it stood, I switched the statements around, and the robot didnt move either. So, I am wondering what I did wrong and how I can make the robot follow a straight path.

Any help would be appreciated,

Thank you!

__________________
Team 375: The Robotic Plague
Current Robot: I-Chihuahua
Last Event: Big Apple Breakaway