Yaw Drift

A gyroscope measures the amount of angular rotation about a single axis. Since the gyroscope measures changes in angular rotation, rather than an absolute angle, calculation of the actual current angle of that axis is estimated via numerical integration rather than an exact measurement.

Any Inertial Measurement Unit (IMU), including navX2-Micro, that integrates a signal from a gyroscope will also accumulate error over time. Accumulated error is due to several factors, including:

  • Quantization noise (which occurs when an analog-to-digital converter (ADC) converts a continuous analog value to a discrete integral value)
  • Scale factor error (which occurs due to manufacturing errors causing a specified scale factor [e.g., 256 bits per unit G] to be incorrect)
  • Temperature instability (which occurs when a sensor is more or less sensitive to an input as temperature changes)
  • Bias error (which occurs because the value the sensor reports at ‘zero’ is not known well enough to ‘subtract’ that value out during signal processing)

Over time, these errors accumulate leading to greater and greater amounts of error.

With the navX2-Micro, Quantization error is minimized due to the onboard sensor internal signal conditioning, high-resolution 16-bit Analog-to-Digital Converters (ADC), and extremely fast internal sampling (416Hz). Scale factor error is easily corrected for by factory calibration, which the navX2-Micro provides. So these two noise sources are not significant in the navX2-Micro.

The remaining sources of error – temperature instability and bias error – are more challenging to overcome:

  • Gyro bias error is a major contributor to yaw drift error, but is inherent in modern MEMS-based gyroscope.
  • Temperature instability can cause major amounts of error, and should be managed to get the best result. To address this, navX2-Micro automatically re-calibrates the gyro biases whenever it is still for several seconds, which helps manages temperature instability.

navX2-Micro Pitch and Roll values are extremely accurate over time since gyroscope values in the pitch/roll axes can be compared to the corresponding values from the accelerometer. This is because when navX2-Micro is still, the accelerometer data reflects only the linear acceleration due to gravity.

Correcting for integration error in the Yaw axis is more complicated, since the accelerometer values in this axis are the same no matter how much yaw rotation exists.

To deal with this, several different “data fusion” algorithms have been developed, including:

  • Complementary filter
  • Extended Kalman filter (EKF)
  • Direction Cosine Matrix filter (DCM)

Note: See the References page for links to more information on these algorithms.

These algorithms combine the acceleromter and gyroscope data together to reduce errors.

The Complementary and EKF filter algorithms are designed to process 3-axis accelerometer and 3-axis gyroscope values and yield yaw/pitch/roll values. The Complementary filter is a simple approach, and works rather well, however the response time is somewhat slower than the EKF, and the accuracy is somewhat lower.

The DCM filtering approach is similarly accurate and responsive as the EKF, however it requires information from a 3-axis magnetometer as well to work correctly. Since the magnetometer on a FIRST FRC robot typically experiences significant amounts of magnetic disturbance, the DCM algorithm is not well suited for use in a Robotics Navigation Sensor.

For these reasons, the EKF is the preferred filtering algorithm to provide the highest performance IMU on a FIRST FRC robot. However, the EKF algorithm is complex and difficult to understand, making it typically beyond the capabilities of many robotics engineers. The navX2-Micro circuit board uses a sophisticated Extended Kalman Filter-based algorithm to ensure the highest possible accuracy.

With this processing, navX-Micro exhibits yaw drift on the order of ~1 degree per minute; yaw drift is much lower when navX-Micro is still.

Tips

What follows are some tips on how to deal with the yaw drift within the context of a FIRST FTC competition.

In general, the yaw will not drift significantly during a FTC match, based upon the following calculation:

yaw drift(degrees) at end of match = yaw drift (~1 degree/minute) x match length (2.5 minute) = ~2.5 degrees

However, during long practice matches the drift may become noticeable, and can be dealt with using the following approaches:

1) The simplest approach which is supported by the navX2-Micro Libraries is to periodically “re-zero” navX2-Micro by applying an offset to the navX2-Micro yaw angle. To use this approach, when the robot is in the correct orientation, a driver can press a button which causes an offset to be added so that the reported angle at that orientation is 0.

2) Even though the navX2-Micro magnetometer will likely give erroneous readings once the robot motors are energized, a calibrated magnetometer can potentially provide a stable reading during the moments before a FTC competition round. The navX2-Micro provides a 9-axis “fused heading” which is combined with the ~1 degree per minute of drift in the yaw angles.  Using the “fused heading”, it is possible to calculate the robots absolute orientation and maintain it.  With the “fused heading”, that drift will be updated w/the absolute heading from the compass whenever a compass reading which is free from magnetic disturbance is detected.  Note that to be effective this requires the magnetometer to be calibrated.  Once calibrated, an initial magnetometer reading undisturbed by magnetic disturbances can be acquired at the beginning of a match, before the motors are energized.  If the sensor is placed far enough away from motors, it may be possible to also get an undisturbed magnetometer during a match.