From 93dd4e57546b5c1e614ce893e348ab9b218b8aba Mon Sep 17 00:00:00 2001 From: bresch Date: Wed, 3 Mar 2021 11:48:48 +0100 Subject: [PATCH] fix unit tests --- test/test_EKF_basics.cpp | 2 +- test/test_EKF_gps_yaw.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_EKF_basics.cpp b/test/test_EKF_basics.cpp index 0a53e89453..fce4bf1c4f 100644 --- a/test/test_EKF_basics.cpp +++ b/test/test_EKF_basics.cpp @@ -66,7 +66,7 @@ class EkfBasicsTest : public ::testing::Test { SensorSimulator _sensor_simulator; // Duration of initalization with only providing baro,mag and IMU - const uint32_t _init_duration_s{7}; + const uint32_t _init_duration_s{4}; protected: double _latitude {0.0}; diff --git a/test/test_EKF_gps_yaw.cpp b/test/test_EKF_gps_yaw.cpp index 56627817f1..f694654b11 100644 --- a/test/test_EKF_gps_yaw.cpp +++ b/test/test_EKF_gps_yaw.cpp @@ -61,6 +61,7 @@ class EkfGpsHeadingTest : public ::testing::Test { void SetUp() override { _ekf->init(0); + _sensor_simulator.runSeconds(_init_duration_s); _sensor_simulator._gps.setYaw(NAN); _sensor_simulator.runSeconds(2); _ekf_wrapper.enableGpsFusion(); @@ -68,6 +69,8 @@ class EkfGpsHeadingTest : public ::testing::Test { _sensor_simulator.startGps(); _sensor_simulator.runSeconds(11); } + + const uint32_t _init_duration_s{4}; }; void EkfGpsHeadingTest::runConvergenceScenario(float yaw_offset_rad, float antenna_offset_rad) @@ -137,7 +140,7 @@ TEST_F(EkfGpsHeadingTest, yawConvergence) // AND WHEN: the the measurement changes gps_heading += math::radians(2.f); _sensor_simulator._gps.setYaw(gps_heading); - _sensor_simulator.runSeconds(6); + _sensor_simulator.runSeconds(10); // THEN: the estimate slowly converges to the new measurement // Note that the process is slow, because the gyro did not detect any motion