From 029eeacbd996f5e0ba478dc13fba0da8f73d79c7 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Wed, 2 Oct 2024 18:45:52 +1000 Subject: [PATCH] SITL: FlightAxis: add position reset option --- libraries/SITL/SIM_FlightAxis.cpp | 12 +++++++++++- libraries/SITL/SIM_FlightAxis.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/SITL/SIM_FlightAxis.cpp b/libraries/SITL/SIM_FlightAxis.cpp index 8d532da807d46..a92af7704cce5 100644 --- a/libraries/SITL/SIM_FlightAxis.cpp +++ b/libraries/SITL/SIM_FlightAxis.cpp @@ -40,10 +40,11 @@ const AP_Param::GroupInfo FlightAxis::var_info[] = { // @Param: OPTS // @DisplayName: FlightAxis options // @Description: Bitmask of FlightAxis options + // @Bitmask: 0: Reset position on startup // @Bitmask: 1: Swap first 4 and last 4 servos (for quadplane testing) // @Bitmask: 2: Demix heli servos and send roll/pitch/collective/yaw // @User: Advanced - AP_GROUPINFO("OPTS", 1, FlightAxis, _options, 0), + AP_GROUPINFO("OPTS", 1, FlightAxis, _options, uint8_t(Option::ResetPosition)), AP_GROUPEND }; @@ -303,6 +304,15 @@ void FlightAxis::exchange_data(const struct sitl_input &input) )"); soap_request_end(1000); + if(option_is_set(Option::ResetPosition)) { + soap_request_start("ResetAircraft", R"( + + +12 + +)"); + soap_request_end(1000); + } soap_request_start("InjectUAVControllerInterface", R"( diff --git a/libraries/SITL/SIM_FlightAxis.h b/libraries/SITL/SIM_FlightAxis.h index 67f1c184799ab..f6351f26ffc66 100644 --- a/libraries/SITL/SIM_FlightAxis.h +++ b/libraries/SITL/SIM_FlightAxis.h @@ -177,6 +177,7 @@ class FlightAxis : public Aircraft { AP_Int8 _options; enum class Option { + ResetPosition = (1U<<0), Rev4Servos = (1U<<1), HeliDemix = (1U<<2), };