allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

Add Reset(Rotation) overloads to gyros and IMUs to set an offset

Open DeltaDizzy opened this issue 1 year ago • 8 comments

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++

DeltaDizzy avatar Jan 22 '24 05:01 DeltaDizzy

/format

DeltaDizzy avatar Jan 22 '24 06:01 DeltaDizzy

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

DeltaDizzy avatar Jan 22 '24 06:01 DeltaDizzy

/format

DeltaDizzy avatar Jan 22 '24 06:01 DeltaDizzy

/format

DeltaDizzy avatar Jan 27 '24 22:01 DeltaDizzy

C++ rework still needed but wanna make sue the logic in the java version looks good first

DeltaDizzy avatar Jan 27 '24 22:01 DeltaDizzy

Having issues getting the C++ version to be nonzero, I think its interaction between the sim and real versions?

DeltaDizzy avatar Apr 30 '24 07:04 DeltaDizzy

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.

KangarooKoala avatar May 01 '24 15:05 KangarooKoala

/format

DeltaDizzy avatar May 02 '24 06:05 DeltaDizzy