Our team has been using the Navx Micro with the MXP I2C port with python. Most of the time it works completely flawlessly, however, once in a while, it will return 0 for the Yaw. When this happens, a robot power cycle has fixed the problem.
Any ideas on what could be causing this to happen, and any potential solutions? Thanks.
If you look around CD, there are many reports of issues with I2C on the RoboRIO. Recommend switching to SPI.
NavX-Micro doesn’t have a SPI interface. Choices are I2C and USB.
Heh. Well… usb then?
In any case, RobotPy doesn’t touch any of the internals of interacting with the hardware, so it’s likely that this is either a vendor or RoboRIO issue. Given the recent fuss about I2C issues… definitely make sure that you’re on the latest RoboRIO image!
If using I2C to communicate with the sensor, does the issue happen once in awhile right after you use the “restart Robot Code” option in the Driver Station?
I have seen this every once in a while, and it appears the cause is that if the restart of the Robot Code occurs at the same instant the RoboRIO is in the middle of an I2C transaction with an I2C device, the RoboRIO (the master in the transaction) does not cleanly terminate the transaction, thus leaving the I2C device in a state where it’s waiting for the Master to finish the transaction. Statistically, there’s about a 1 in 50 chance this might occur during “restart Robot Code”.
If that is indeed the case, simply use the “Reboot RoboRIO” option instead of “restart Robot Code” - or press the reset button on the sensor if it gets stuck after “restart Robot Code”. This scenario should only occur during development and practicing, it shouldn’t ever occur during a match. But as others have noted, you could also instead use the USB interface which should not ever exhibit this behavior.
Other things to look out for:
- some kind of short which would cause noise to be injected onto the I2C ground, SDA or SCL pins.
- A RoboRIO stage 2 brownout, which would remove power from the sensor, causing it to restart once power was reapplied
- something accidentally pressing the reset button on the sensor (this has been seen on a few robots before)
And as reference, if you haven’t already seen it, here are the Best Practices for accessing the navX-Sensor.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.