We’ve started to use a Yaw-Rate gyro sensor recently, but whenever we hook it up to the cortex, the gyro sensor displays random numbers in an increasing fashion, even when it is totally still. How do I overcome this problem? Thanks.
I wrote a long article last year that’s basically a compendium of all gyro information that I could find anywhere online and on the VEX Forum, plus my team’s experience using it. I’d suggest starting by reading this article and see if gives you an idea of what’s happening on your end.
VEX Sensors: Getting Started with the Gyro
Thats a nice, easy to interpret resource. Ill share that with my team.
Specifically, the issue you are likely encountering @Tegicupala is gyro drift - as in, drifting away from the actual value. Gyro drift has multiple influences, causes and fixes. But one of the best ways to try and lower it is reducing vibrations - see above for a solution to that.
@biglesliep I actually have a few issues with this article you’ve written. The LY3100ALH chip on the VEX Gyroscope actually measures Yaw rate, and the all the programming environments have implemented the equivalent of drivers for this sensor to abstract this away and provide a direct angular readout for the sensor (see https://content.vexrobotics.com/docs/276-2333-Datasheet-1011.pdf). I’m not sure if omitting this information was a conscious choice such that it would be simpler to explain what the sensor does, but I believe that using the gyro in ROBOTC in this way makes it basically unusable due to the drift, which can be fixed with some filtering.
In all cases, from what I can tell the gyro reading implementations from [easyC, ROBOTC, PROS] do either very little or no filtering of the signal coming from this sensor, which is where I think most of the drift comes from. If you set the sensor up as a raw analog sensor (analog sensor instead of gyro in ROBOTC’s motors and sensors setup), then you can get the rate measurement scaled by the ADC (0-4095), and then do some maths to transform that into degrees per second, which can then be filtered and summed to get more accurate angle measurements.
When you use the sensor this way you get a significant improvement in accuracy (see The VEXU World Finals from 2015. Our turns on both robots in this video were exclusively gyro controlled, no encoders at all. Here’s my gyro filtering and reading implementation that we used on those robots).
Thanks everyone for your replies, especially @biglesliep for the article. However, this will only be helpful if my gyro started reading values. When I plug it in, the gyro reads 0 regardless of its position. When I take out the wire, the gyro reads random numbers. Any ideas? Thanks.
Gryos are awesome, they’re much easier than encoder turns and more precise to boot.
@Tegicupala - If you have the 3-wire plug in backward on the component, that might cause you to get
no data. Is the extension wire plugged in so that the black wire is next to the teeny tiny “B”? I apologize that I have no suggestion as to why you get data when your extension wire is not even plugged into the component (or cortex? not sure which end you disconnect).
UPDATE I realized that when you flick the gyro sensor, it moves negatively by a little bit. But when you move it at normal speed, nothing happens. Any suggestions?
@Tegicupala - when you plug in the sensor, does the teeny-tiny green “PWR” light come on? If not, then the component is not getting power. Next, try a different 3-wire extension cable (use one that you know for sure works). The extension could cause problems if the red & black wires are OK (PWR light on) but the white wire is damaged (no signal). Next, try a different port on the cortex (one that you know works).
After these hardware checks, next I would try @jmmckinney 's recommendation of setting it up as a generic analog sensor instead of setting it up specifically as a gyro, and see if the output (in the debugger window) does anything rational as you turn the item from side to side. Hope any of this helps!