Incompatible state?


this is a screenshot of our rio log in vs code
does any body know what causes this error?

our code can be found here: https://github.com/Team1157/robot-code-2025

It looks like it’s crashing in the hardware abstraction layer when you access the angle on the gyro. My first thought was that the gyro is connected wrongly, or you configured the wrong port, but it looks like this is not the first time the gyro angle is being accessed. So I would double-check the hardware connection for the gyro. Does this happen consistently with the same stacktrace?

General advice is to access the gyro only once per loop. If you call it twice, you could be incurring hardware lag, and might get different answers.

1 Like

You’re creating two Drivetrain objects, and thus creating two Gyro objects. See lines 11 and 21 of Robot.java.

We don’t currently have duplicate detection during construction for this, unfortunately.

1 Like

Ok got it, thank you very much

Thanks for the advice. I’ll fix that.

Out of curiousity, could you post what was printed at startup? In particular, I’m looking for “could not find ADXRS450 gyro on SPI port 0”.

I looked and did not see that error

fixed that, we’ll test later thank you so much