mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 18:27:05 +08:00
ekf2 unit-tests: adapt to strict GNSS checks on ground
This commit is contained in:
committed by
Matthias Grob
parent
f9cdd095b8
commit
c4535683a7
@@ -281,7 +281,8 @@ TEST_F(EkfGpsHeadingTest, yawJmpOnGround)
|
|||||||
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 1);
|
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 1);
|
||||||
|
|
||||||
// AND THEN: restart GNSS yaw fusion
|
// AND THEN: restart GNSS yaw fusion
|
||||||
_sensor_simulator.runSeconds(5);
|
// The strict checks on ground require min_health_time_us (10s) to pass again.
|
||||||
|
_sensor_simulator.runSeconds(11);
|
||||||
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsHeadingFusion());
|
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsHeadingFusion());
|
||||||
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 2);
|
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 2);
|
||||||
EXPECT_LT(fabsf(matrix::wrap_pi(_ekf_wrapper.getYawAngle() - gps_heading)), math::radians(1.f));
|
EXPECT_LT(fabsf(matrix::wrap_pi(_ekf_wrapper.getYawAngle() - gps_heading)), math::radians(1.f));
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ TEST_F(EkfGpsTest, gpsTimeout)
|
|||||||
// GIVEN:EKF that fuses GPS
|
// GIVEN:EKF that fuses GPS
|
||||||
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsFusion());
|
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsFusion());
|
||||||
|
|
||||||
|
// In air the simplified checks are used which do not include satellite count
|
||||||
|
_ekf->set_in_air_status(true);
|
||||||
|
_ekf->set_vehicle_at_rest(false);
|
||||||
|
|
||||||
// WHEN: the number of satellites drops below the minimum
|
// WHEN: the number of satellites drops below the minimum
|
||||||
_sensor_simulator._gps.setNumberOfSatellites(3);
|
_sensor_simulator._gps.setNumberOfSatellites(3);
|
||||||
|
|
||||||
@@ -174,7 +178,7 @@ TEST_F(EkfGpsTest, resetToGpsPosition)
|
|||||||
const Vector3f simulated_position_change(20.0f, -1.0f, 0.f);
|
const Vector3f simulated_position_change(20.0f, -1.0f, 0.f);
|
||||||
_sensor_simulator._gps.stepHorizontalPositionByMeters(
|
_sensor_simulator._gps.stepHorizontalPositionByMeters(
|
||||||
Vector2f(simulated_position_change));
|
Vector2f(simulated_position_change));
|
||||||
_sensor_simulator.runSeconds(6);
|
_sensor_simulator.runSeconds(11);
|
||||||
|
|
||||||
// THEN: a reset to the new GPS position should be done
|
// THEN: a reset to the new GPS position should be done
|
||||||
const Vector3f estimated_position = _ekf->getPosition();
|
const Vector3f estimated_position = _ekf->getPosition();
|
||||||
|
|||||||
Reference in New Issue
Block a user