mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 14:44:07 +08:00
fix unit tests
This commit is contained in:
parent
5d441d65e1
commit
93dd4e5754
@ -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};
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user