Tests: Add VTOL test

This is a first initial VTOL test.
This commit is contained in:
Lorenz Meier 2020-01-25 16:04:02 +01:00
parent 480e67fcd4
commit 7b44f5d069
4 changed files with 41 additions and 1 deletions

View File

@ -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

View File

@ -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(

View File

@ -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);

View File

@ -0,0 +1,25 @@
//
// VTOL mission test.
//
// Author: Lorenz Meier <lorenz@px4.io>
#include <mavsdk/mavsdk.h>
#include <mavsdk/plugins/action/action.h>
#include <mavsdk/plugins/telemetry/telemetry.h>
#include <iostream>
#include <string>
#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();
}