mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-01 13:38:38 -04:00
SITL: allow for changing FlightAxis controller IP
This commit is contained in:
parent
6f4d66f346
commit
68e17af070
@ -31,9 +31,6 @@
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
#define FLIGHTAXIS_SERVER_IP "192.168.2.48"
|
||||
#define FLIGHTAXIS_SERVER_PORT 18083
|
||||
|
||||
namespace SITL {
|
||||
|
||||
// the asprintf() calls are not worth checking for SITL
|
||||
@ -46,6 +43,10 @@ FlightAxis::FlightAxis(const char *home_str, const char *frame_str) :
|
||||
rate_hz = 250 / target_speedup;
|
||||
heli_demix = strstr(frame_str, "helidemix") != NULL;
|
||||
rev4_servos = strstr(frame_str, "rev4") != NULL;
|
||||
const char *colon = strchr(frame_str, ':');
|
||||
if (colon) {
|
||||
controller_ip = colon+1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -87,7 +88,7 @@ char *FlightAxis::soap_request(const char *action, const char *fmt, ...)
|
||||
|
||||
// open SOAP socket to FlightAxis
|
||||
SocketAPM sock(false);
|
||||
if (!sock.connect(FLIGHTAXIS_SERVER_IP, FLIGHTAXIS_SERVER_PORT)) {
|
||||
if (!sock.connect(controller_ip, controller_port)) {
|
||||
free(req1);
|
||||
return nullptr;
|
||||
}
|
||||
@ -151,7 +152,7 @@ Connection: Keep-Alive
|
||||
void FlightAxis::exchange_data(const struct sitl_input &input)
|
||||
{
|
||||
if (!controller_started) {
|
||||
printf("Starting controller\n");
|
||||
printf("Starting controller at %s\n", controller_ip);
|
||||
// call a restore first. This allows us to connect after the aircraft is changed in RealFlight
|
||||
char *reply = soap_request("RestoreOriginalControllerDevice", 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'>
|
||||
|
@ -155,6 +155,9 @@ private:
|
||||
uint64_t activation_frame_counter = 0;
|
||||
double last_frame_count_s = 0;
|
||||
Vector3f position_offset;
|
||||
|
||||
const char *controller_ip = "127.0.0.1";
|
||||
uint16_t controller_port = 18083;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user