mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Fix dt type in C++ tests (#8179)
The UKF test was calling `.value()` on an implicit `units::millisecond_t` type assuming it was `units::second_t`. I normalized the rest of the dt declarations while I was at it.
This commit is contained in:
@@ -61,7 +61,7 @@ frc::Vectord<5> GlobalMeasurementModel(
|
||||
} // namespace
|
||||
|
||||
TEST(ExtendedKalmanFilterTest, Init) {
|
||||
constexpr auto dt = 0.00505_s;
|
||||
constexpr units::second_t dt = 5_ms;
|
||||
|
||||
frc::ExtendedKalmanFilter<5, 2, 3> observer{Dynamics,
|
||||
LocalMeasurementModel,
|
||||
@@ -80,7 +80,7 @@ TEST(ExtendedKalmanFilterTest, Init) {
|
||||
}
|
||||
|
||||
TEST(ExtendedKalmanFilterTest, Convergence) {
|
||||
constexpr auto dt = 0.00505_s;
|
||||
constexpr units::second_t dt = 5_ms;
|
||||
constexpr auto rb = 0.8382_m / 2.0; // Robot radius
|
||||
|
||||
frc::ExtendedKalmanFilter<5, 2, 3> observer{Dynamics,
|
||||
|
||||
@@ -68,7 +68,7 @@ frc::Vectord<5> DriveGlobalMeasurementModel(
|
||||
}
|
||||
|
||||
TEST(UnscentedKalmanFilterTest, DriveInit) {
|
||||
constexpr auto dt = 5_ms;
|
||||
constexpr units::second_t dt = 5_ms;
|
||||
|
||||
frc::UnscentedKalmanFilter<5, 2, 3> observer{DriveDynamics,
|
||||
DriveLocalMeasurementModel,
|
||||
@@ -94,7 +94,7 @@ TEST(UnscentedKalmanFilterTest, DriveInit) {
|
||||
}
|
||||
|
||||
TEST(UnscentedKalmanFilterTest, DriveConvergence) {
|
||||
constexpr auto dt = 5_ms;
|
||||
constexpr units::second_t dt = 5_ms;
|
||||
constexpr auto rb = 0.8382_m / 2.0; // Robot radius
|
||||
|
||||
frc::UnscentedKalmanFilter<5, 2, 3> observer{DriveDynamics,
|
||||
@@ -206,7 +206,7 @@ TEST(UnscentedKalmanFilterTest, LinearUKF) {
|
||||
}
|
||||
|
||||
TEST(UnscentedKalmanFilterTest, RoundTripP) {
|
||||
constexpr auto dt = 5_ms;
|
||||
constexpr units::second_t dt = 5_ms;
|
||||
|
||||
frc::UnscentedKalmanFilter<2, 2, 2> observer{
|
||||
[](const frc::Vectord<2>& x, const frc::Vectord<2>& u) { return x; },
|
||||
|
||||
Reference in New Issue
Block a user