autopilot_tester: Add mavlink passthrough to end custom commands

This commit is contained in:
Konrad
2023-10-31 14:16:02 +01:00
committed by Roman Bapst
parent a4d05085a7
commit 24f59dd465
3 changed files with 29 additions and 2 deletions
+17
View File
@@ -76,6 +76,7 @@ void AutopilotTester::connect(const std::string uri)
_offboard.reset(new Offboard(system));
_param.reset(new Param(system));
_telemetry.reset(new Telemetry(system));
_mavlink_passthrough.reset(new MavlinkPassthrough(system));
}
void AutopilotTester::wait_until_ready()
@@ -643,6 +644,22 @@ void AutopilotTester::execute_rtl_when_reaching_mission_sequence(int sequence_nu
execute_rtl();
}
void AutopilotTester::send_custom_mavlink_command(const MavlinkPassthrough::CommandInt &command)
{
_mavlink_passthrough->send_command_int(command);
}
void AutopilotTester::send_custom_mavlink_message(mavlink_message_t &message)
{
_mavlink_passthrough->send_message(message);
}
void AutopilotTester::add_mavlink_message_callback(uint16_t message_id,
std::function< void(const mavlink_message_t &)> callback)
{
_mavlink_passthrough->subscribe_message_async(message_id, std::move(callback));
}
std::array<float, 3> AutopilotTester::get_current_position_ned()
{
mavsdk::Telemetry::PositionVelocityNed position_velocity_ned = _telemetry->position_velocity_ned();