|
Re: Problems with the Gyro, non-stop (but yet not a constant) change in the angle.
There are usually two things: bias and noise.
Bias is the steady state voltage the gyro returns when it sits perfectly still (the DC offset). If you put the gyro signal on an oscilloscope and zoom in on the time scale, you will see high frequency variations. That's noise. In the perfect world, noise will cancel out over the long run (equal amount of positive and negative noise levels). But in reality, it may still have a small residue amount over a period of time. The gyro is a sensor measuring angular velocity (turn rate: degrees/sec). This means that in order to get the heading, you need to integrate the turn rate over time. So if the turn rate is not quite zero, the time integrator will eventually integrate to some value (i.e. indicating the robot slowly turning). To minimize these effects, when initializing the gyro, you will need to calibrate it. This involves taking a large number of samples and take an average on them. This will give you the bias. So when you read the gyro value, the bias is subtracted from the reading. So this will eliminate the bias but not the noise. To take care of the noise, during the calibration period, you will also need to determine the amplitude of the noise (the max and min level of the signal while the robot is sitting still). I usually double that range to form a deadband. So when you read the gyro, not only you need to subtract the bias from the reading, you also determine if the resulting reading is within the deadband. If so, you consider it zero. This will cause you to lose accuracy when moving very very slowly. But in reality, this is not an issue. So when integrating the adjusted reading, it is much less likely to have the robot slowly turning while it is actually sitting still. Unfortunately, the world is not perfect, gyro output can be affected by temperature. In other words, as temperature changes, the bias may shift. This means that the bias you have determined sometime ago during intialization may not be correct any more.
So there are good news and bad news. The bad news is, the world is not perfect, you can only minimize the drifting problem but never eliminiate it. The good news is, the match is short. It lasts only 2+ minutes. With all the adjustments done to correct the problem, it should be neglible within the match period. Another good news is, the WPI library is taking care of the calibration and eliminating the bias for you. So the above explanation is really for your information. You don't need to do anything. Having said that, if you carefully examine the WPI library code, you will see it is using the accumulator to do the averaging to determine the m_offset (bias) but I don't see it taking care of the noise deadband. Like Bongle said, it is probably good enough for most scenarios. If you reset the gyro before each operation that you need it, the drift should be insignificant. The only scenario that may be affected by this is if you want to maintain an absolute heading during the entire match. If this is really important to you, you may want to use an absolute heading sensor instead (e.g. compass).
__________________
|