Best Practices

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

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

Excessive vibration will reduce the quality of navX-sensor measurements. The navX-sensor 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 train draws large amounts of current, even for a short time, brownouts could potentially occur even with a FRC match.

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

To avoid a navX-sensor restart when stage 2 brownouts occur, a secondary power supply for the navX-sensor 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-sensor circuit board to the RoboRIO; if a brownout does occur, the navX-sensor 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-sensor 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-sensor 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-sensor data.

4) If using the MXP connector, secure the navX-sensor 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-sensor circuit board to become dislodged from the MXP connector.

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

5) Protect the Sensor

navX-sensors contain sensitive circuitry. The navX-sensor circuit board should be handled carefully.

An enclosure is recommended to protect the navX-sensor circuit board from excessive handling, “swarf”, electro-static discharge (ESD) and other elements that could potentially damage navX-sensor 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 or become disconnected accidentally. 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-sensor is disrupted.

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

Additionally, displaying whether the robot software is connected to the navX-sensor 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-sensor gyro “yaw” angle will drift over time; the amount of drift depends upon the generation of navX-sensor (“Generation 2” navX2-sensors drift less than “Classic” navX-Sensors) and also how firmly the navX-Sensor is mounted to the chassis. 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-sensor 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 navX2-MXP / navX-MXP.

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

Since navX-sensor measures rotation, errors in the measured angles can occur if the navX-sensor circuit board is mounted at a point not near the robot center of rotation. For optimal results, the navX-sensor circuit board should be mounted at the robot’s center of rotation. If the navX-sensor circuit board cannot be mounted near the robot’s center of rotation, small amounts of error that may be noticeable can occur.

10) Use OmniMount if the navX-sensor is not mounted horizontally

By default, the navX-sensor’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-sensor features, and can help debug issues you may encounter when integrating navX-sensor onto your robot. Running this user interface is highly recommended for anyone using a navX-sensor. You can even run the navXUI while your robot is simultaneously communicating with the navX-sensor circuit board via the sensor’s external interfaces (e.g., TTL UART, I2C or SPI).