For a while now, I have been using the gyro. I have seen that its turns are always off. Whenever I turn my robot an actual 90 degrees, the gyro reads around 65 degrees. So in my program, I always have it turn 65 degrees when I want it to turn 90 degrees in reality. I have manually turned the robot and seen these results. Has anyone else discovered this, or could it be a bad gyro. I am doubtful that it is a bad gyro because now the results are consistent.
Any advice is appreciated.
Thank you.
All gyros have a slightly different scale. Yours is just quite off due to poor manufacturing tolerances. Use the sensorscale value to adjust your readings to compensate.
We had one that scaled to 92, one to 97, and one to 72. It’s pretty common. I think 1826 released a video on it earlier this year for an online challenge.
Thanks for the advice. How does the SensorScale command work?
When coding for our gyros we found that they had some inaccuracy (around 20 degrees of offset for five rotations) so we multiplied the difference in the current and previous gyro values, and added this new value to the previous total direction. If your gyro is reading double the actual angle, then multiply by 0.5:
Task fixGyro()
{
#define GYROOFFSET 0.5
Float truedirection = 0;
Float lastgyro = 0;
Float difference = 0;
While (true)
{
Difference = SensorValue(gyro) - lastgyro;
Difference = difference * GYROOFFSET;
//if you want true direction to read the angle in degrees then uncommercial next line
//difference = difference / 10;
truedirection = truedirection + difference ;
Lastgyro = sensorValue(gyro);
wait1Msec(25);
}
}
I just wrote this quickly so it may not work exactly, but it should be ok to fix your problem, then you just use truedirection wherever you would read the gyro value.
To find our offset value we spun the robot round 5 times (1800 degreses) and divided the gyro value by 18000.;
For you it would be 3600/1800 (3600 tenths of a degree for every 180 degrees of rotation) meaning OFFSET would be 0.5.
For us this gave us about 1.012, but it’s different for each gyro (we use two) also it may be different based on which direction you turn it… we use two offset values, and just check if difference is + or - to see which offset value to use.
Hope this is helpful!
Thank you,
I will try this and see if it works