wpilibsuite / 2025Beta

Repository for Beta Testing of 2025 Software
13 stars 5 forks source link

ADIS16470 IMU does not work in Java #45

Open jfabellera opened 2 hours ago

jfabellera commented 2 hours ago

I was updating REV's MAXSwerve Java and C++ templates which use an ADIS16470 as the gyro, and I was getting a driver station error in Java on initialization about being unable to find the ADIS16470 on the SPI port (I don't have the exact error at the moment). I wasn't getting any gyro readings, and of course the field centric driving did not work.

However, in C++ there were no issues on the same exact robot. I did not change any of the gyro setup since the 2024 version of the program, which I know was working then.

Here are where they are instantiated in the two languages:

I am running WPILib 2025 beta 1 and NI game tools beta 1.

rzblue commented 1 hour ago

There are a few commits that changed the ADIS16470 driver- since it's all at the java layer, would you be able to copy and paste the class into the project and bisect the history to find where it broke?

https://github.com/wpilibsuite/allwpilib/commits/main/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java

rzblue commented 1 hour ago

One possibility (though I haven't walked through all the logic to see why it didn't hit this last year) is that the product ID it's checking for is incorrect:

https://github.com/wpilibsuite/allwpilib/blob/bade0a8716f63266be251bd167747cf16adf401b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java#L482

According to the ADIS16470 datasheet the PROD_ID should be 0x4056 (16470), not 16982