Best Practices

This page summarizes the recommended best practices when integrating navX-MXP with the National Instruments RoboRIO™. Following these best practices will help ensure high reliability and consistent operation.

1) Secure the navX-MXP circuit board to the Robot Chassis

Excessive vibration will reduce the quality of navX-MXP sensor measurements. The navX-MXP circuit board should be mounted in such a way that it as firmly attached to the robot chassis.

2) Plan for RoboRIO Brownouts

The RoboRIO contains circuitry to remove power from the MXP connector when it detects an input voltage drop below a certain voltage level; this is known as a Stage 2 brownout. While brownouts do not typically occur during a FRC match (since fresh batteries are typically used at these times), during practice matches brownouts are common. If the robot drive chain draws large amounts of current, even for a short time, brownouts could potentially occur even with a FRC match.

navX-MXP maintains state information that will be reset when the navX-MXP circuit board is restarted. Avoiding navX-MXP restarts is very important if your robot software uses the “yaw” angle.

To avoid a navX-MXP restart when stage 2 brownouts occur, a secondary power supply for the navX-MXP circuit board should be provided. Fortunately, the RoboRIO provides just such a power supply, since its onboard USB interface is powered by a boost regulator which will provide 5V of power even when the RoboRIO input voltage (VIN) drops as low as 4.4 volts (once the RoboRIO VIN drops lower than this, the RoboRIO itself will restart).

To address this situation, simply connect a USB cable from the navX-MXP circuit board to the RoboRIO; if a brownout does occur, the navX-MXP circuit board will automatically switch to use power from the RoboRIO’s USB port.

3) Understand and Plan for Calibration

Gyro/Accelerometer Calibration is vital to achieving high-quality navX-MXP readings. Be sure to understand this process, and ensure that it completes successfully each time you use the robot.

If your robot moves during calibration, or if noticeable temperature changes occur during calibration, the calibration process may take longer than normal.

Using the navX-MXP yaw angle before calibration completes may result in errors in robot control. To avoid this situation, your robot software should verify that calibration has completed (e.g., by calling the isCalibrating() function) before using navX-MXP data.

4) If using the MXP connector, secure the navX-MXP circuit board to the RoboRio

During operation of the robot, certain actions (for instance, driving over a bump at high speed) may cause the navX-MXP circuit board to become dislodged from the MXP connector.

To avoid this case, when mounting the navx-MXP circuit board be sure to secure the navX-MXP circuit board to the RoboRio via two correctly-sized screws.

5) Protect the Sensor

navX-MXP contains sensitive circuitry. The navX-MXP circuit board should be handled carefully.

An enclosure is recommended to protect the navX-MXP circuit board from excessive handling, “swarf”, electro-static discharge (ESD) and other elements that could potentially damage navX-MXP circuitry. The enclosure can also help prevent accidental shorts to ground which may occur on the MXP Expansion I/O pins.

6) Plan for Catastrophic Sensor Failure

Any electronic component can fail. To ensure that your robot can still function during a FRC match even if such a failure does occur, your robot software should handle cases when communication with sensors such as the navX-MXP is disrupted.

An easy way to accomplish this is to use the “isConnected()” indication, and only use navX-MXP sensor data to control your robot when this is true.

Additionally, displaying whether the robot software is connected to the navX-MXP circuit board on the driver “dashboard” can help the drivers quickly detect a connection problem.

7) Provide a “Zero Yaw” feature (for Field-Oriented Drive)

The navX-MXP gyro “yaw” angle will drift over time (approximately 1 degree/minute). While this does not normally impact the robot during a FRC match, if using field-oriented drive during extended practice sessions it may be necessary to periodically “zero” the yaw. Drivers should be provided a simple way (e.g., a joystick button) with which to zero the yaw.

8) Avoid shorts on Expansion I/O pins

If a short occurs between any of the MXP Expansion I/O pins, the POWER led on the RoboRIO will turn red, and the navX-MXP circuit board will not receive power.

To protect against accidental shorts, Kauai Labs recommends a protective enclosure that at least partially encases the MXP I/O pins, such as the “lid”-style enclosure created for the navx-MXP.

9) If possible, mount the navX-MXP circuit board near the center of rotation

Since navX-MXP measures rotation, errors in the measured angles can occur if the navX-MXP circuit board is mounted at a point not near the robot center of rotation. For optimal results, the navX-MXP circuit board should be mounted at the robot’s center of rotation. If the navX-MXP circuit board cannot be mounted near the robot’s center of rotation, the offset from the center of rotation can be used to correct the yaw angle.

10) Use OmniMount if navX-MXP is not mounted horizontally

By default, the navX-MXP’s motion processing requires the unit be mounted horizontally, parallel to the earth’s surface; the yaw (Z) axis should be perpendicular to the earths surface.

If your RoboRIO is mounted vertically, you will need to enable the “OmniMount” feature in order to get reliable, accurate yaw (Z) axis readings.

11) Learn how the sensor behaves by using the navXUI

The navXUI provides insight into the key navX-MXP features, and can help debug issues you may encounter when integrating navX-MXP onto your robot. Running this user interface is highly recommended for anyone using navX-MXP. You can even run the navXUI while your robot is simultaneously communicating with the navX-MXP circuit board via the TTL UART, I2C or SPI interfaces.