Before the autonomous mode starts (Hybrid mode) and after the robot is booted, can you initialize the gyro and get readings from it to see how stable it is?
So while the robot is sitting can you initalize the gyro and get readings? If so can you store data from it? Anything special you have to do?
One thing that you could do, is in the initialization function. you could initialize the value to a function return or a hard coded value. so inside the initialization function you would do this
gyroHeading = initGyroHeading();
or something to that effect, this should set the heading to what ever you want it to be. Im not %100 sure that you can get values straight off the pins right away before you exit whatever mode you are in before a match, but i dont see why.
Last year for our drive-by autonomous mode, we used a gyro on our arm to get the angle that we had to turn to. As soon as the robot was turned on, we set the code to initialize the gyro (which takes a few seconds) on our arm before autonomous started. As soon as the gyro is initialized, it would sit right around 0, but over long periods of time the default value can drift as much as 15 degrees over a two or three minute period.
Before Hybrid Mode starts, you really can’t read anything, since the robot is ‘disabled’, but in the first microsecond of the match, the gyro is at rest (as is the robot) and so the reading you get should be zero.
If your concern is some kind of calibration to know what “not turning” looks like, I don’t think you have to worry much, just read the value in that first microsecond. If the value happens to be read before that - such as when you snap the power on when setting the robot onto the field - then it’s a bonus.
The sensor is very well-behaved in our experience - zero means zero, it did not really drift or move enough to worry about. In our 2007 'bot, we never looked for an initial value, we just used whatever the reading came back as and never saw any issues
We’re thinking that we’ll be using the gyro to help with those 180 degree left turns.
Good luck,
Don
[Edit: Maybe this needs to be tried. Our experience may be different from yours]
While the gyro is initializing, you cannot move it. Once it is initialized, then it’s all right to move it as much as you want, so long as you don’t exceed the maximum degrees/second of the gyro. (If this occurs, you won’t break the sensor, you’ll just get saturated readings.)
If the KoP gyro has the same specs as last year, they can only sense a maximum of 90o per second. So we used the KoP gyro on our arm, and purchased a 300o per second gyro from SparkFun Electronics to use for drive-train related things on our 2007 robot.
At the beginning of the match, the robot is disabled, but auto mode is not yet set. It’s worth noting that the bot is reading inputs, it’s just not setting any outputs.
Team 95 has used this for years to set autonomous strategies, reset our gyros, and other initialization stuff in the minutes between the bot being turned on and autonomous mode starting.
I agree with kaszeta, here. We’ve used AnalogDevices yaw rate sensors since 2004. While in competition (disabled) mode, we simply read the gyro and average it with the previous reading. When the mode changes, the final averaged value becomes our neutral point, which we use for the match. In the past many teams have taken several hundred samples during competition mode and created an average neutral point from them. Either way gives you a good 0 yaw rate point to use for the next 2:15