Closed laurensvalk closed 1 month ago
I think this could have subtlety affected other gyro issues reported by @afarago and others, but I can't find the exact one right now.
Basically, you could end up in a situation where you applied turn(360)
but hub.imu.heading()
would report 358
or 359
.
Note that this is strictly separate from calibration, because calibrated or not, turn
and heading
should ultimately in exactly the same thing, but they were not for some drivebase configurations. (This is different from where the robot actually ends up in reality, which is affected by calibration.)
After this fix, heading
and turn
use the same values as intended.
Describe the bug / To reproduce
round(hub.imu.heading())
is supposed to be equal torobot.angle()
when the gyro is used, but was not the case.For example,
720.3
should round to720
, not722
.This was linearly increasing for bigger rotations, adding to the apparent drift when there wasn't any.
Expected behavior Round properly. And then later switch to floats in #1844.
We need to fix the rounding either way because this value is still used by the internal controllers, causing things like
turn(360)
be off to up to a degree.Additional context This issue has already been debugged, but opening this issue serves as a documentation of the issue and its fix. Fix incoming shortly.