How to Zero NavX?

We have tried both the ZeroYaw() and Reset() methods and neither accomplish the goal of setting the yaw value to 0.

Anyone have this figured out? We are just recording the current yaw value as “zero” and calculating offsets from it but I would love to use +/- 180 without adjustment.

Thanks!

That is very weird. You should be able to zero the yaw by using the zeroYaw() method. You can checkout how we used the NavX in our 2015 robot’s code. (https://github.com/FRC125/NU15/blob/master/src/com/nutrons/recyclerush/subsystems/drivetrain/DriveTrain.java#L225)

Going to confirm and reload the firmware and try again. Very strange.

At least if you are using a USB connection and a pre-3.0.316 navX version see the release notes here.

Even with this update, we may have had a similar issue. We are using LabVIEW. We did not have much time to investigate it but we wrote a wapper for the navX Get Yaw VI that allows the yaw to be set to any angle using an offset to get around the problem.

Edit: Our navX is connected via SPI to the roboRIO MXP port.

There are two things to be aware of:

a) Yaw cannot zero the yaw until startup calibration completes.

b) Due to some limitations found during testing of the 2017 WPI Libraries/RoboRIO firmware, in C++/Java, if connecting via USB, yaw cannot be zeroed more than once/second. Only the first attempt to zero the yaw will pass through, the second attempt will be ignored. However, another attempt that occurs at least 1 second after the first will succeed.

It’s likely a) is the condition you’re hitting. You can check whether startup calibration is still occuring by invoking the isCalibrating() method.

Thanks everyone.

I reloaded the latest firmware to be sure. We are connected via MXP to the Rio.

Still not able to get the ZeroYaw() to reset the forward direction to zero. We have it set to a button. When pressed, instead of zero, it seems to take the initial value, say -16, and doubles it (to -36 in the latest test, then -72, etc) when viewed on the SmartDashboard.

The relative changes are accurate.

Is the NavX mounted upside down?

YES. What do you think is happening?

Ryan figured out the important clue.

Details on omnimout calibration are here.

Excellent.

I mistakenly thought that only alternate axis mounts required Omnimount. Will give it a shot.

Gravity makes a difference because the accelerometer data is fused together w/the gyro data, so if the Z axis is pointing down it will definitely impact the result until Omnimount is used.