mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 06:13:33 +08:00
ekf2_test: add GPS height to baro fallback
This commit is contained in:
committed by
Mathieu Bresciani
parent
f4c21cedd9
commit
0a140ec59a
@@ -139,3 +139,25 @@ TEST_F(EkfGpsTest, resetToGpsPosition)
|
||||
EXPECT_TRUE(isEqual(estimated_position,
|
||||
previous_position + simulated_position_change, 1e-2f));
|
||||
}
|
||||
|
||||
TEST_F(EkfGpsTest, gpsHgtToBaroFallback)
|
||||
{
|
||||
// GIVEN: EKF that fuses GPS and flow, and in GPS height mode
|
||||
_sensor_simulator._flow.setData(_sensor_simulator._flow.dataAtRest());
|
||||
_ekf_wrapper.enableFlowFusion();
|
||||
_sensor_simulator.startFlow();
|
||||
|
||||
_ekf_wrapper.setGpsHeight();
|
||||
|
||||
_sensor_simulator.runSeconds(1);
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsHeightFusion());
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingFlowFusion());
|
||||
|
||||
// WHEN: stopping GPS fusion
|
||||
_sensor_simulator.stopGps();
|
||||
_sensor_simulator.runSeconds(11);
|
||||
|
||||
// THEN: the height source should automatically change to baro
|
||||
EXPECT_FALSE(_ekf_wrapper.isIntendingGpsHeightFusion());
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingBaroHeightFusion());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user