I am starting with the RomiReference project example shipped with WPILIb 2023. It has a file called RomiGyro.java that implements the RomiGyro class. I’m doing a code review of this class and cannot determine how the class gets the values from the gyro on the Romi.
I was able to refactor the TurnDegrees command to use the RomiGyro class, so this class is very clearly getting live data from the gyro on the Romi. But I cannot see how it is actually doing so. I would have expected that somewhere it would reference an IO channel or something.
It works, I think, but I would still like to understand how.
This gyro object wraps around the LSM6 I2C interface and is used to provide gyro data from the hardware IMU, over websockets, to the RomiGyro SimDevice on the WPILib side
The Gyro and Accelerometer are exposed as SimDevices to provide a richer set of data without using up too many I/O channels. This also fits in a little closer with how the newer IMUs that teams are using (e.g NavX, Pigeon) behave, where they communicate over a CAN bus, and can provide more information than might be possible using purely analog/digital I/O.
Unfortunately, the Romi Web Service isn’t as well documented as I’d like it to be, since it was meant to be a “install-and-forget-about-it” kind of system. If you dig around in that repo, you’ll see how most of the logic is implemented. The actual hardware bits are in the firmware folder, and this is the actual firmware running on the 32u4 Romi control board. The web service communicates with this over an I2C link.