navX Gyro Latency

We are using the navX MXP connected directly to the robotRIO’s on-board 30 pin Serial connector, and are having trouble with the device not returning the correct yaw value.

We are reading the yaw in periodic tasks, and have the refresh rate set to 100Hz for the 10ms periodic task loop.

We are reading delayed yaw values from the robot like this:

Actual : navX reading
(approx.)
0 : 0
10 : 0
15 : 0
20 : 9
30 : 17
30 : 20
30 : 30

This artificial delay in the readings causes overshooting for turning in auto. There’s around a 1 second delay between the robot rotating until the navX actually returns the correct yaw.


Hi Adam,

Thank you for using the navX. I want to let you know that the maximum loop rate that you can achieve from the serial port is 50Htz. It is a limitation of the board and not the software. If you need quicker update rates then you will need to use any of the other communication protocols. It is as simple as changing the drop down to SPI or I2C. Those would be the recommended protocols that we would recommend. These protocols will run up to 200Htz.

Is there a reason that you are using the serial port for communications?

I would also expect some delay is in the video processing. That is why we developed the SF2 library. It will compensate for the video lag but it is not for a novice to integrate. It is not hard to integrate but there is a lot you will need to understand. There are examples on the Kauai Labs web site. If you are still having trouble let me know and I will see if I can help figure out the issues.

Tim

Thank you Tim!
We were using the 30 pin serial connection because whenever we connected using I2C or SPI, the navX wasn’t powering on. We double checked that the pins were connected correctly, is there any additional setup to using one of these interfaces other than changing the navXMain vi?

The only change is to change the drop down. The other communication ports are part of the 34 pin connector. If you plug directly into the roborio select I2C or SPI and you are off and running. You do not need to do anything else.

Any update? Did you get this to work?

Sorry for the late reply, but we were able to get it to work!! Thank you for the help, we’re a pre-rookie team still trying to figure everything out.

Sent from my iPhone using Tapatalk

Let me know if I can help with anything even outside of navX.