mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-21 23:30:35 +08:00
Speed up mavsdk sitl tests
This commit is contained in:
@@ -124,10 +124,10 @@ void AutopilotTester::transition_to_multicopter()
|
|||||||
REQUIRE(result == Action::Result::SUCCESS);
|
REQUIRE(result == Action::Result::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutopilotTester::wait_until_disarmed()
|
void AutopilotTester::wait_until_disarmed(std::chrono::seconds timeout_duration)
|
||||||
{
|
{
|
||||||
REQUIRE(poll_condition_with_timeout(
|
REQUIRE(poll_condition_with_timeout(
|
||||||
[this]() { return !_telemetry->armed(); }, std::chrono::seconds(60)));
|
[this]() { return !_telemetry->armed(); }, timeout_duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutopilotTester::wait_until_hovering()
|
void AutopilotTester::wait_until_hovering()
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
void land();
|
void land();
|
||||||
void transition_to_fixedwing();
|
void transition_to_fixedwing();
|
||||||
void transition_to_multicopter();
|
void transition_to_multicopter();
|
||||||
void wait_until_disarmed();
|
void wait_until_disarmed(std::chrono::seconds timeout_duration = std::chrono::seconds(60));
|
||||||
void wait_until_hovering();
|
void wait_until_hovering();
|
||||||
void prepare_square_mission(MissionOptions mission_options);
|
void prepare_square_mission(MissionOptions mission_options);
|
||||||
void execute_mission();
|
void execute_mission();
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ TEST_CASE("Takeoff and Land", "[multicopter][vtol]")
|
|||||||
tester.takeoff();
|
tester.takeoff();
|
||||||
tester.wait_until_hovering();
|
tester.wait_until_hovering();
|
||||||
tester.land();
|
tester.land();
|
||||||
tester.wait_until_disarmed();
|
std::chrono::seconds until_disarmed_timeout = std::chrono::seconds(15);
|
||||||
|
tester.wait_until_disarmed(until_disarmed_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Fly square Multicopter Missions", "[multicopter][vtol]")
|
TEST_CASE("Fly square Multicopter Missions", "[multicopter][vtol]")
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ TEST_CASE("Offboard takeoff and land", "[multicopter][offboard][nogps]")
|
|||||||
tester.wait_until_ready_local_position_only();
|
tester.wait_until_ready_local_position_only();
|
||||||
tester.store_home();
|
tester.store_home();
|
||||||
tester.arm();
|
tester.arm();
|
||||||
tester.offboard_goto(takeoff_position, 0.5f);
|
std::chrono::seconds goto_timeout = std::chrono::seconds(10);
|
||||||
|
tester.offboard_goto(takeoff_position, 0.5f, goto_timeout);
|
||||||
tester.offboard_land();
|
tester.offboard_land();
|
||||||
tester.wait_until_disarmed();
|
tester.wait_until_disarmed(goto_timeout);
|
||||||
tester.check_home_within(0.5f);
|
tester.check_home_within(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,12 +65,13 @@ TEST_CASE("Offboard position control", "[multicopter][offboard][nogps]")
|
|||||||
tester.wait_until_ready_local_position_only();
|
tester.wait_until_ready_local_position_only();
|
||||||
tester.store_home();
|
tester.store_home();
|
||||||
tester.arm();
|
tester.arm();
|
||||||
tester.offboard_goto(takeoff_position, 0.5f);
|
std::chrono::seconds goto_timeout = std::chrono::seconds(10);
|
||||||
tester.offboard_goto(setpoint_1, 1.0f);
|
tester.offboard_goto(takeoff_position, 0.5f, goto_timeout);
|
||||||
tester.offboard_goto(setpoint_2, 1.0f);
|
tester.offboard_goto(setpoint_1, 1.0f, goto_timeout);
|
||||||
tester.offboard_goto(setpoint_3, 1.0f);
|
tester.offboard_goto(setpoint_2, 1.0f, goto_timeout);
|
||||||
tester.offboard_goto(takeoff_position, 0.2f);
|
tester.offboard_goto(setpoint_3, 1.0f, goto_timeout);
|
||||||
|
tester.offboard_goto(takeoff_position, 0.2f, goto_timeout);
|
||||||
tester.offboard_land();
|
tester.offboard_land();
|
||||||
tester.wait_until_disarmed();
|
tester.wait_until_disarmed(goto_timeout);
|
||||||
tester.check_home_within(1.0f);
|
tester.check_home_within(1.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user