Gyro/Accelerometer Calibration

Gyro/Accelerometer Calibration

navX-MXP onboard sensors require calibration in order to yield optimal results. We highly recommend taking the time to understand this calibration process – successful calibration is vital to ensure optimal performance.

Accurate Gyroscope Calibration is crucial in order to yield valid yaw angles. Although this process occurs automatically, understanding how it works is required to obtain the best results.

If you are tempted to ignore this information, please read the section entitled “The Importance of Stillness” at the end of this page.

Calibration Process

The navX-MXP Calibration Process is comprised of three calibration phases:

  • Factory Calibration
  • Startup Calibration
  • On-the-fly Calibration

 

CalibrationProcess

Factory Calibration

Before navX-MXP units are shipped, the accelerometers and gyroscopes are initially calibrated at the factory; this calibration data is stored in flash memory and applied automatically to the accelerometer and gyroscope data each time the navX-MXP circuit board is powered on.

Note that the onboard gyroscopes are sensitive to temperature changes. Therefore, since the average ambient temperature at the factory (on the island of Kauai in Hawaii) may be different than in your environment, you can optionally choose to re-calibrate the gyroscope by pressing and holding the “CAL” button for at least 10 seconds. When you release the “CAL” button, ensure that the “CAL” Led flashes briefly, and then press the “RESET” button to restart navX-MXP. When navX-MXP is re-started, it will perform the Initial Gyro Calibration – the same process that occurs at our factory. NOTE: It is very important to hold navX-MXP still, and parallel to the earth’s surface, during this Initial Gyro Calibration period. You might consider performing this process before using your robot the first time it is used within a new environment (e.g., when you arrive at a FTC competition event).

The value of re-running Factory Calibration at the same temperature navX-MXP will be operated at is potentially increased yaw accuracy as well as faster Startup Calibration. If a significant temperature shift has occurred since the last Factory Calibration, the Startup Calibration time may take longer than normal, and it’s possible that yaw accuracy will be diminished until the next On-the-fly Gyro Calibration completes.

Startup Calibration

Startup Calibration occurs each time the navX-Micro is powered on, and requires that the sensor be held still in order to complete successfully.  Using the Factory Calibration as a starting point, the sensor calibrates the accelerometers and adjusts the gyroscope calibration data as well based upon current temperature conditions.

If the sensor continues to move during startup calibration, Startup Calibration will eventually timeout – and as a result, the navX-Micro yaw angle may not be as accurate as expected.

Initial Yaw Offset Calibration

Immediately after Startup Calibration, an Initial Yaw Offset is automatically calculated. The purpose of the Initial Yaw Offset is to ensure that whatever direction the “front” of the navX-MXP circuit board is pointed to at startup (after initial calibration is applied) will be considered “0 degrees”.

Yaw Offset Calibration requires that navX-MXP be still for approximately 2 seconds after Startup Calibration completes. After approximately 2 seconds of no motion, navX-MXP will acquire the current yaw angle, and will subtract it from future yaw measurements automatically. The navX-MXP protocol and libraries provide a way to determine the yaw offset value it is currently using.

NOTE: If navX-MXP is moving during startup, this Yaw Offset Calibration may take much longer than 2 seconds, and  may not be calculated at all if the sensor continues moving long enough. Therefore it is important to keep navX-Micro still until initial calibration and Initial Yaw Offset calibration completes.

On-the-fly Gyro Calibration

In addition to Startup Calibration, during normal operation navX-MXP will automatically re-calibrate the gyroscope (e.g., to account for ongoing temperature changes) during operation, whenever it detects 8 seconds of no motion. This process completes after about 7-8 more seconds, and is completely transparent to the user. Therefore each time navX-MXP is still for approximately 15 seconds, the gyroscopes are re-calibrated “on-the-fly”. The purpose of On-the-fly Gyro re-calibration is to help maintain yaw accuracy when shifts in ambient temperature occur during operation.

This On-the-fly Gyro Calibration can help deal with cases where the sensor was moving during Startup Calibration, but note that the yaw is not zeroed at the completion of On-the-fly Calibration.  So once again, it’s important to keep the sensor still during Startup Calibration.

Runtime Yaw Zeroing

Your robot software can optionally provide the robot operator a way to reset the yaw angle to Zero at any time. Please see the documentation for the navX-MXP libraries for more details.

The importance of stillness

This is the most important takeaway from this discussion: It is very important that navX-MXP be held still during the above Initial Gyro and Initial Yaw Offset calibration periods. In support of this, navX-MXP indicates when it is calibrating; we recommend you incorporate this information into your software. Please see the discussion of the navXUI, and the navX-MXP libraries for more details on this indication.