Gyro won't work right =?

We decided that we were going to program an alternate plan for our Autonomous code, so I wrote some code and wired it up today…but I got some strange numbers.

The number was just a really long decimal that slowly incremented or decremented.

I’m thinking that the cable must just be soldered badly or something, but I ran out of time, and thought I should ask here so I don’t waste too much time on Thursday.

Here is the code (stripped down really far:)


Gyro* gyro;//Declaration
gyro = new Gyro(1,1);//Inilization - In the robot startup
gyro->Reset();//In AutonomopusInit()

//Code in Autonomous Periodic - int countdown is just to keep the terminal from overflowing.
if (--countdown<=1)
{
 echo("Gyro Rotation: "<<gyro->GetAngle()<<" Degrees
");
 countdown=50;
}

~DtD

You have to set the sensitivity using Gyro::SetSensitivity() which you can find the sensitivity in the sensor manual on the us first site, (depending on the sensor you have)

Hmm, I thought it said that it was already set for the kit gyro, ah well. I will try that today! THanks!

~DtD

Ours did this as well and this was using LabView. Not sure exactly what it is, but we notice that when the wires are bunched up, it happens. We also find this happen when the gyro moves during program start up when it is trying to reset to a new zero position. When we hit run, the gyro dashboard rotation dial sits at the last angle measured, and then after like 3 seconds, it jumps to a zero position. If the gyro is bumped or rotated during this time, it continually moves.

The sensitivity for the KOP gyro is 0.007. We had the same problem until we used this number. :rolleyes: Also you may want to use cout.

Hope this is helpful!!