mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Add encoder distance overload to DifferentialDriveOdometry (#2096)
Also force encoders to be reset to zero on pose reset.
This commit is contained in:
committed by
Peter Johnson
parent
845aba33fe
commit
45201d15fc
@@ -67,4 +67,15 @@ class DifferentialDriveOdometryTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOdometryWithEncoderDistances() {
|
||||
m_odometry.resetPosition(new Pose2d(), Rotation2d.fromDegrees(45));
|
||||
var pose = m_odometry.update(Rotation2d.fromDegrees(135.0), 0.0, 5 * Math.PI);
|
||||
|
||||
assertAll(
|
||||
() -> assertEquals(pose.getTranslation().getX(), 5.0, kEpsilon),
|
||||
() -> assertEquals(pose.getTranslation().getY(), 5.0, kEpsilon),
|
||||
() -> assertEquals(pose.getRotation().getDegrees(), 90.0, kEpsilon)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user