mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 05:23:34 +08:00
mavsdk tests: use tester sleep_for function
the previously used std::this_thread::sleep_for is with respect to host system time which is different from autopilot time if: - speed factor != 1 - something runs slower than realtime regardless of speed factor - debugging or otherwise interrupting PX4 control code tester.sleep_for (which already existed) correctly sleeps w.r.t. px4/simulation time.
This commit is contained in:
@@ -56,12 +56,12 @@ TEST_CASE("Fly VTOL Loiter with airspeed failure", "[vtol_airspeed_fail]")
|
||||
|
||||
|
||||
// tester.wait_until_altitude(50.f, std::chrono::seconds(30));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
tester.sleep_for(std::chrono::seconds(10));
|
||||
tester.inject_failure(mavsdk::Failure::FailureUnit::SensorAirspeed, mavsdk::Failure::FailureType::Wrong, 0,
|
||||
mavsdk::Failure::Result::Success);
|
||||
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
tester.sleep_for(std::chrono::seconds(10));
|
||||
|
||||
tester.check_airspeed_is_invalid(); // it's enough to check once after landing, as invalidation is permanent
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user