diff --git a/test/mavsdk_tests/CMakeLists.txt b/test/mavsdk_tests/CMakeLists.txt index 0476682b58..0439e25512 100644 --- a/test/mavsdk_tests/CMakeLists.txt +++ b/test/mavsdk_tests/CMakeLists.txt @@ -14,6 +14,7 @@ if(MAVSDK_FOUND) autopilot_tester.cpp test_mission_multicopter.cpp test_mission_plane.cpp + test_mission_vtol.cpp ) target_link_libraries(mavsdk_tests diff --git a/test/mavsdk_tests/autopilot_tester.cpp b/test/mavsdk_tests/autopilot_tester.cpp index 3306e6055f..7d6993de1a 100644 --- a/test/mavsdk_tests/autopilot_tester.cpp +++ b/test/mavsdk_tests/autopilot_tester.cpp @@ -14,7 +14,7 @@ void AutopilotTester::connect(const std::string uri) std::cout << "Waiting for system connect" << std::endl; REQUIRE(poll_condition_with_timeout( - [this]() { return _mavsdk.is_connected(); }, std::chrono::seconds(10))); + [this]() { return _mavsdk.is_connected(); }, std::chrono::seconds(25))); auto& system = _mavsdk.system(); @@ -56,6 +56,18 @@ void AutopilotTester::land() REQUIRE(result == Action::Result::SUCCESS); } +void AutopilotTester::transition_to_fixedwing() +{ + const auto result = _action->transition_to_fixedwing(); + REQUIRE(result == Action::Result::SUCCESS); +} + +void AutopilotTester::transition_to_multicopter() +{ + const auto result = _action->transition_to_multicopter(); + REQUIRE(result == Action::Result::SUCCESS); +} + void AutopilotTester::wait_until_disarmed() { REQUIRE(poll_condition_with_timeout( diff --git a/test/mavsdk_tests/autopilot_tester.h b/test/mavsdk_tests/autopilot_tester.h index 6418b95072..89be442a1a 100644 --- a/test/mavsdk_tests/autopilot_tester.h +++ b/test/mavsdk_tests/autopilot_tester.h @@ -26,6 +26,8 @@ public: void arm(); void takeoff(); void land(); + void transition_to_fixedwing(); + void transition_to_multicopter(); void wait_until_disarmed(); void wait_until_hovering(); void prepare_square_mission(MissionOptions mission_options); diff --git a/test/mavsdk_tests/test_mission_vtol.cpp b/test/mavsdk_tests/test_mission_vtol.cpp new file mode 100644 index 0000000000..eecaf3ca27 --- /dev/null +++ b/test/mavsdk_tests/test_mission_vtol.cpp @@ -0,0 +1,25 @@ +// +// VTOL mission test. +// +// Author: Lorenz Meier + +#include +#include +#include +#include +#include +#include "autopilot_tester.h" + + +TEST_CASE("Takeoff, transition and RTL", "[vtol]") +{ + AutopilotTester tester; + tester.connect(connection_url); + tester.wait_until_ready(); + tester.arm(); + tester.takeoff(); + tester.wait_until_hovering(); + tester.transition_to_fixedwing(); + tester.execute_rtl(); + tester.wait_until_disarmed(); +}