allwpilib
allwpilib copied to clipboard
Add Reset(Rotation) overloads to gyros and IMUs to set an offset
Fixes #4130
Adds Reset(Rotation2d offset) overload for all 1d gyros, Reset(Rotation3d offset) overload for 3d gyros
- [x] ADIS16488 Java
- [ ] ADIS16470 Java
- [x] ADXRS450 Java
- [ ] ADIS16488 C++
- [ ] ADIS16470 C++
- [ ] ADXRS450 C++
/format
AnalogGyro already has mentions of offset and a lot of stuff is fetched directly from the HAL so not entirely sure how to tackle that
/format
/format
C++ rework still needed but wanna make sue the logic in the java version looks good first
Having issues getting the C++ version to be nonzero, I think its interaction between the sim and real versions?
We should add a test for resetting the gyro angle when the sim angles are nonzero- I'm pretty sure that's broken now since we don't reset the sim angles (like we do with the integ_gyro_angle values).
Assuming it is broken, I'm not sure how we should fix it, since I don't know enough about how our device sims work to know how the simulation would behave if we use kBoth in CreateDouble(). Maybe we shouldn't reset the Euler angles and instead set m_angleOffset to -GetGyroOrientation() + angle? (I'm pretty sure it has to be in that order and not angle - GetGyroOrientation() because rotations aren't commutative.) Also note that this would have different behavior in sim since there wouldn't effectively be an offset in the sim angles.
/format