Skip to content

Commit

Permalink
SITL: FlightAxis: add position reset option
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 committed Oct 2, 2024
1 parent d5f4ca9 commit 029eeac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libraries/SITL/SIM_FlightAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down Expand Up @@ -303,6 +304,15 @@ void FlightAxis::exchange_data(const struct sitl_input &input)
</soap:Body>
</soap:Envelope>)");
soap_request_end(1000);
if(option_is_set(Option::ResetPosition)) {
soap_request_start("ResetAircraft", R"(<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<soap:Body>
<ResetAircraft><a>1</a><b>2</b></ResetAircraft>
</soap:Body>
</soap:Envelope>)");
soap_request_end(1000);
}
soap_request_start("InjectUAVControllerInterface", R"(<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<soap:Body>
Expand Down
1 change: 1 addition & 0 deletions libraries/SITL/SIM_FlightAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class FlightAxis : public Aircraft {
AP_Int8 _options;

enum class Option {
ResetPosition = (1U<<0),
Rev4Servos = (1U<<1),
HeliDemix = (1U<<2),
};
Expand Down

0 comments on commit 029eeac

Please sign in to comment.