fix unit tests

This commit is contained in:
bresch
2021-03-04 19:43:01 +11:00
committed by Paul Riseborough
parent 5d441d65e1
commit 93dd4e5754
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ class EkfBasicsTest : public ::testing::Test {
SensorSimulator _sensor_simulator; SensorSimulator _sensor_simulator;
// Duration of initalization with only providing baro,mag and IMU // 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: protected:
double _latitude {0.0}; double _latitude {0.0};
+4 -1
View File
@@ -61,6 +61,7 @@ class EkfGpsHeadingTest : public ::testing::Test {
void SetUp() override void SetUp() override
{ {
_ekf->init(0); _ekf->init(0);
_sensor_simulator.runSeconds(_init_duration_s);
_sensor_simulator._gps.setYaw(NAN); _sensor_simulator._gps.setYaw(NAN);
_sensor_simulator.runSeconds(2); _sensor_simulator.runSeconds(2);
_ekf_wrapper.enableGpsFusion(); _ekf_wrapper.enableGpsFusion();
@@ -68,6 +69,8 @@ class EkfGpsHeadingTest : public ::testing::Test {
_sensor_simulator.startGps(); _sensor_simulator.startGps();
_sensor_simulator.runSeconds(11); _sensor_simulator.runSeconds(11);
} }
const uint32_t _init_duration_s{4};
}; };
void EkfGpsHeadingTest::runConvergenceScenario(float yaw_offset_rad, float antenna_offset_rad) 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 // AND WHEN: the the measurement changes
gps_heading += math::radians(2.f); gps_heading += math::radians(2.f);
_sensor_simulator._gps.setYaw(gps_heading); _sensor_simulator._gps.setYaw(gps_heading);
_sensor_simulator.runSeconds(6); _sensor_simulator.runSeconds(10);
// THEN: the estimate slowly converges to the new measurement // THEN: the estimate slowly converges to the new measurement
// Note that the process is slow, because the gyro did not detect any motion // Note that the process is slow, because the gyro did not detect any motion