SITL: FlightAxis: add position reset option

This commit is contained in:
Bob Long 2024-10-02 18:45:52 +10:00 committed by Peter Barker
parent 9fdd0a4e84
commit 49bbb2c923
2 changed files with 12 additions and 1 deletions

View File

@ -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, uint32_t(Option::ResetPosition)),
AP_GROUPEND
};
@ -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>

View File

@ -177,6 +177,7 @@ private:
AP_Int32 _options;
enum class Option : uint32_t{
ResetPosition = (1U<<0),
Rev4Servos = (1U<<1),
HeliDemix = (1U<<2),
};