mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 20:13:34 +08:00
fix unit tests
This commit is contained in:
@@ -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};
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user