[wpilib] Use RKDP in DifferentialDrivetrainSim (#5931)

This commit is contained in:
Tyler Veness
2023-11-17 08:41:18 -08:00
committed by GitHub
parent ead9ae5a69
commit b1fad062f7
4 changed files with 6 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ TEST(DifferentialDrivetrainSimTest, Convergence) {
sim.Update(20_ms);
// Update ground truth.
groundTruthX = frc::RK4(
groundTruthX = frc::RKDP(
[&sim](const auto& x, const auto& u) -> frc::Vectord<7> {
return sim.Dynamics(x, u);
},
@@ -63,7 +63,7 @@ TEST(DifferentialDrivetrainSimTest, Convergence) {
}
// 2 inch tolerance is OK since our ground truth is an approximation of the
// ODE solution using RK4 anyway
// ODE solution using RKDP anyway
EXPECT_NEAR(groundTruthX(0, 0), sim.GetPose().X().value(), 0.05);
EXPECT_NEAR(groundTruthX(1, 0), sim.GetPose().Y().value(), 0.05);
EXPECT_NEAR(groundTruthX(2, 0), sim.GetHeading().Radians().value(), 0.01);