mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 12:37:36 +08:00
rng height: reset to baro using common logic
The failsafe from rng height to baro height should occur after a reset to baro triggered by the controlHeightSensorTimeouts function and not in the fusion selector. Until now, the EKF was fusing baro measurements between rng updates if the range finder ODR was slower than the EKF update rate. This is not the case anymore as the height reset occurs after 5 seconds. The unit test has been extended to show this behavior.
This commit is contained in:
committed by
Mathieu Bresciani
parent
03fed323ab
commit
c212975abe
@@ -337,17 +337,26 @@ TEST_F(EkfFusionLogicTest, doRangeHeightFusion)
|
||||
// WHEN: commanding range height and sending range data
|
||||
_ekf_wrapper.setRangeHeight();
|
||||
_sensor_simulator.startRangeFinder();
|
||||
_sensor_simulator.runSeconds(2.5);
|
||||
|
||||
_sensor_simulator.runSeconds(2.5f);
|
||||
// THEN: EKF should intend to fuse range height
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingRangeHeightFusion());
|
||||
|
||||
const float dt = 8e-3f;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
_sensor_simulator.runSeconds(dt);
|
||||
// THEN: EKF should intend to fuse range height, even if
|
||||
// there is no new data at each EKF iteration (EKF rate > sensor rate)
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingRangeHeightFusion());
|
||||
}
|
||||
|
||||
// WHEN: stop sending range data
|
||||
_sensor_simulator.stopRangeFinder();
|
||||
_sensor_simulator.runSeconds(2.5);
|
||||
_sensor_simulator.runSeconds(5.1);
|
||||
|
||||
// THEN: EKF should stop to intend to use range height
|
||||
// and fall back to baro height
|
||||
EXPECT_FALSE(_ekf_wrapper.isIntendingRangeHeightFusion());
|
||||
EXPECT_TRUE(_ekf_wrapper.isIntendingBaroHeightFusion());
|
||||
}
|
||||
|
||||
TEST_F(EkfFusionLogicTest, doVisionHeightFusion)
|
||||
|
||||
Reference in New Issue
Block a user