Gyro Values are increasing

I have been writing a lot of gyro code for my autons and I saw that none of my code was working. I tested the gyro by just having it print the value of the Gyro in a loop so I could see if it was a problem with the Gyro. I found that the gyro is just always decreasing its value towards -360, then rolling over to -1 and doing it again.

I don’t know why the Gyro is just randomly incrementing, and we have US Open very soon. Any help would be greatly appreciated.

Please show us your test code and verify you are giving it time to calibrate before moving.

And:
Gyroscope Filtering Discussion - #18 by Electrobotz
Another question, How do I properly use the Gyro sensor
https://renegaderobotics.org/getting-started-with-the-vex-gyro-sensor/
http://www.robotc.net/blog/2011/10/13/programming-the-vex-gyro-in-robotc/
PROS Gyro Integrator
Gyro Acting Weird (V5)

2 Likes

Are you using V5 or Cortex?

If V5 see this post:

When we used Cortex, we did this “special” initialization:

pre_auton()
{
 // flash LED indicating Gyro calibration about to begin
 SensorType[in8] = sensorNone;
  wait1Msec(500); // Let user notice LED
  //Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
  SensorType[in8] = sensorGyro;
  wait1Msec(1350); // 1300 is just enough
  // Turn LED off
}

While Gyro is initializing your robot needs to remain stationary, so that gyro could calculate “null” drift.

References:
http://www.robotc.net/wikiarchive/VEX2_Sensors_Overview
http://help.robotc.net/Sandbox/Zendesk-Output/Content/Resources/topics/Getting_Started/Cortex/Competition_Templates.htm

3 Likes