NavX Gyro Issues

Hi all,

My team is using a NavX Gyro, and both boards that we have aren’t working. Im trying to see if we can fix it before we buy another. The first one is double-sided taped to a piece of our bellypan, but does not turn on when plugged into the RIO when the RIO is powered on.

The second one does power on when connected to the RIO, but sends back “0.0” S1, S2 are green and 3.3V LED is red. Cal light is dark except when RST is pressed.

Can toy explain how you are connecting your NavX(s)? Can you share the code you are using to initialize and read from them?

I’ll get back to you on the code, I didn’t make the code. Its micro-USB to USB on RIO

Here is the code:

Init: public AHRS gyro = new AHRS(SerialPort.Port.kUSB1);

Print: System.out.println(drive.leftEncoder.getAngle());

Programmer tried getYaw() but nothing was output to the screen. Same code / system successfully displayed output from two Digikey Encoders. We tried rotating it and flipping it and … no data

What is the relationship between the object assigned to the variable “gyro” and the leftEncoder property of the drive object?

Here’s the (effective) code we use to initialize the navX in our robotInit:

        public static AHRS imu;

        try {
            // Try to connect to the navX imu.
            imu = new AHRS(SPI.Port.kMXP);
            // Report firmware version to SmartDashboard
            SmartDashboard.putString("FirmwareVersion", imu.getFirmwareVersion());
        } catch (Exception ex) {
            // If there are any errors, null out the imu reference and report the error both to the logs and the dashboard.
            SmartDashboard.putString("FirmwareVersion", "navX not connected");
            DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
            imu = null;

Give that a try and see if you get the firmware version in your SmartDashboard. If you do, add this to your disabledPeriodic:

            SmartDashboard.putNumber("Yaw", imu.getYaw());

Remember that yaw will always start at 0, so you’ll need to move the imu to get any result!

Thanks, we’ll try that as soon as possible

How is the first navX-Micro connected to power on the RoboRIO? If it’s getting valid power/ground, then the navX-Micro sounds like it might need to be replaced, and we can help you with that. But want to make sure it’s getting appropriate power, first before we take that step.

As to the second navX-Micro, if you are communicating over USB, are you also attempting to communicate with USB cameras simultaneously? There are some known issues with USB serial connections on the RoboRIO when multiple USB devices are in use. Kauai Labs been struggling with these issues, but there are workarounds. It’d be helpful to send (a) a description of your configuration and (b) a copy of your initialization code - so we can review it and determine if you might be affected by the RoboRIO USB serial issues.

Please note: regarding the recommendation on this thread to use kSPI (SPI Communication) to communicate the navX-Micro - kSPI is supported on navX-MXP. But the navX-Micro only supports USB and I2C communication with the RoboRIO, so SPI is not an option with navX-Micro.

We’re here to help: you can encouraged to email [email protected] directly if your questions aren’t getting resolved on ChiefDelphi.

  • scott