mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2025-12-07 18:59:29 +08:00
mavsdk_tests: workaround race condition
PX4 needs a bit of time to process an uploaded mission before it is ready to accept the mission mode. Therefore, we need to wait a bit. Alternatively, we could wait on the mission progress arriving properly, but this sleep is simple enough for now.
This commit is contained in:
@@ -245,6 +245,8 @@ void AutopilotTester::prepare_square_mission(MissionOptions mission_options)
|
||||
_mission->set_return_to_launch_after_mission(mission_options.rtl_at_end);
|
||||
|
||||
REQUIRE(_mission->upload_mission(mission_plan) == Mission::Result::Success);
|
||||
// PX4 needs time to realize that it now has a mission available, so we need to wait a bit here.
|
||||
sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
void AutopilotTester::prepare_straight_mission(MissionOptions mission_options)
|
||||
@@ -261,6 +263,8 @@ void AutopilotTester::prepare_straight_mission(MissionOptions mission_options)
|
||||
_mission->set_return_to_launch_after_mission(mission_options.rtl_at_end);
|
||||
|
||||
REQUIRE(_mission->upload_mission(mission_plan) == Mission::Result::Success);
|
||||
// PX4 needs time to realize that it now has a mission available, so we need to wait a bit here.
|
||||
sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
void AutopilotTester::execute_mission()
|
||||
@@ -390,6 +394,8 @@ void AutopilotTester::load_qgc_mission_raw_and_move_here(const std::string &plan
|
||||
move_mission_raw_here(import_result.second.mission_items);
|
||||
|
||||
REQUIRE(_mission_raw->upload_mission(import_result.second.mission_items) == MissionRaw::Result::Success);
|
||||
// PX4 needs time to realize that it now has a mission available, so we need to wait a bit here.
|
||||
sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
void AutopilotTester::execute_mission_raw()
|
||||
|
||||
Reference in New Issue
Block a user