Navx gyro drifting

For some reason, our gyro yaw readings are drifting by a constant amount per rotation. When moving the robot by hand 360 degrees, it drifts by 27 degrees very consistently. However, when we rotate the opposite way, the drift is gone. This has not happened before, but the one thing that changed from this years robot and last years is that the navx is right next to our REV PDH which we have not used before. When the navx is placed further away from the pdh, there is no drift. This leads us to believe that our drift is due to electromagnetic interference from the pdh. Is anyone else having this issue or know what it could be? Thanks!

I’m just plugging my navX2 into my roboRIO. Our roboRIO is mounted horizontally and we haven’t been facing any problems. That long port right in the middle of the roboRIO is where you plug in that navX. The RIO is next to some other electrical components like a VRM and the radio, but there haven’t been any issues with it. If you haven’t tried just smacking it on the roboRIO, I’d recommend trying that. I think the navX sensors are affected by electromagnetism but this situation is a little odd. We also had an issue with our old navX sensor but upgrading to the new navX2 helped.

Let me know how it goes or if you need any more help!

Have you tried running AHRS.calibrate()? I’ve found that if you don’t run that and add a second delay on boot, your gyro readings can be funky.