Gyros and IMUs: Pigeon 2.0, NavX2, and ADIS
The inertial sensors that measure heading, the difference between gyros and full IMUs, and the products teams use.
Sign in to track progress, earn XP, and save lessons.
A gyroscope measures angular rate (degrees per second). Integrate that rate over time and you get an angle. An IMU (Inertial Measurement Unit) combines gyros with accelerometers (and sometimes a magnetometer) to give a fuller picture of orientation: yaw, pitch, and roll.
Yaw, pitch, roll
Using aviation conventions: yaw is rotation about the vertical axis (which way the robot faces — the value you care about most), pitch is tilt forward/back, and roll is tilt side to side. For most FRC driving you use yaw; pitch/roll matter for balancing or detecting tipping.
Drift — the core challenge
Because angle comes from integrating rate, tiny rate errors accumulate into drift: the reported heading slowly wanders even when the robot is still. Common sources of drift include sensor bias and temperature change as the device warms up. You manage drift by:
- Choosing a modern, low-drift IMU.
- Following the manufacturer's recommended setup (some IMUs sample a zero-rate bias at boot and need stillness; others, like the Pigeon 2.0, do not).
- Correcting heading periodically with absolute references (like AprilTags).
The popular FRC IMUs
- CTRE Pigeon 2.0 (CTR Electronics): a 9-degrees-of-freedom IMU on the CAN bus. Unlike the original Pigeon, it requires no on-boot calibration and no temperature calibration, and it does not need to be held still at boot — you get useful heading as soon as it powers on, with dramatically reduced drift. The only optional step is a one-time mount calibration in Phoenix Tuner X once placement is final. Read heading in Phoenix 6 with
getYaw()orgetRotation2d(). Its yaw is continuous (passes 360 to 361, not back to 0) and increases counter-clockwise viewed from the top (NWU convention forRotation2d). - Kauai Labs NavX2 (navX2-MXP / navX2-Micro): a popular IMU that mounts to the roboRIO MXP port (SPI) or connects via USB/I2C, providing a fused yaw via its onboard AHRS.
- Analog Devices ADIS16470 / ADIS16448: three-axis IMUs that connect over SPI (typically via the MXP); WPILib ships first-party classes for them.
Reading a gyro in WPILib
All of these expose a heading you can wrap in a Rotation2d. Convention check: WPILib expects counter-clockwise-positive yaw, so make sure your gyro's sign matches (invert if needed). A continuous, CCW-positive heading is what odometry and pose estimation expect.
Key takeaways
- Gyros measure angular rate; integrating it gives heading, which slowly drifts (from bias and temperature).
- The Pigeon 2.0 (CAN) needs no boot or temperature calibration and need not be still at boot; the NavX2 (SPI/USB) and ADIS16470 (SPI) are other common FRC IMUs.
- WPILib expects continuous, counter-clockwise-positive yaw — verify the sign before using it in odometry.
Lesson quiz
RequiredAnswer all 3 questions correctly to complete this lesson.
1.How does the CTRE Pigeon 2.0 IMU communicate with the roboRIO?
2.Which set of sensors does the 9-degrees-of-freedom Pigeon 2.0 fuse to produce a heading?
3.What is a key advantage the Pigeon 2.0 has at boot-up compared to many older IMUs?
Answer every question to submit.