mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 18:47:35 +08:00
Rng finder unit test: cover "un-stuck" logic
This commit is contained in:
@@ -233,6 +233,19 @@ TEST_F(SensorRangeFinderTest, rangeStuck)
|
|||||||
// because the sensor is "stuck"
|
// because the sensor is "stuck"
|
||||||
EXPECT_FALSE(_range_finder.isDataHealthy());
|
EXPECT_FALSE(_range_finder.isDataHealthy());
|
||||||
EXPECT_FALSE(_range_finder.isHealthy());
|
EXPECT_FALSE(_range_finder.isHealthy());
|
||||||
|
|
||||||
|
// BUT WHEN: we continue to send samples but with changing distance
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
new_sample.rng += 1.f;
|
||||||
|
_range_finder.setSample(new_sample);
|
||||||
|
_range_finder.runChecks(new_sample.time_us, attitude);
|
||||||
|
new_sample.time_us += dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// THEN: the data should be marked as healthy
|
||||||
|
// because the sensor is not "stuck" anymore
|
||||||
|
EXPECT_TRUE(_range_finder.isDataHealthy());
|
||||||
|
EXPECT_TRUE(_range_finder.isHealthy());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SensorRangeFinderTest, qualityHysteresis)
|
TEST_F(SensorRangeFinderTest, qualityHysteresis)
|
||||||
|
|||||||
Reference in New Issue
Block a user