ArduPilot SITL Monitor & Tune: "XCP TCP/IP error: Connect failed" to 127.0.0.1:17725 on WSL2 (R2026b); arducopter never listens on 17725
Show older comments
Setup: R2026b, Windows 11 (build 26200), WSL 3.0.1.0, ArduPilot support package, example "ArduCopterControllerWithUAVDynamicsInSimulinkExample2" (Quadcopter_Controller + ArduPilotSITLSimulinkPlant). Distro: ArduPilotSimulink (WSL2).
Problem 1 (solved): Deploy built fine but ended with "Windows Subsystem for Linux(WSL2) not installed". Cause: WSL was in mirrored networking mode, so ipconfig had no adapter containing "WSL". The package searches for "WSL" in the ipconfig output (SimulationInTheLoopWindowsModule.m, getWindowsIPAsSeenByWSL). Setting networkingMode=NAT in .wslconfig fixed it.
Problem 2 (open): Build and deploy now succeed ("Build process completed successfully"), arducopter starts and MAVProxy/Mission Planner connect on 5760. But Monitor & Tune fails:
action: EXT_CONNECT
Target name: 127.0.0.1
Target port: 17725
Could not connect to target application: XCP TCP/IP error: Connect failed
Unable to connect to the 'ArduPilot Host Target' target for 'Quadcopter_Controller'.
The package launches: arducopter -S --model json:172.25.96.1 --speedup 1 --slave 0 --sim-address=127.0.0.1 -I0
While it runs, "ss -ltnp" inside WSL shows arducopter listening only on 5760, 5762 and 5763, never on 17725. The port is hardcoded in MW_AP_rtiostream_tcpip.cpp (SERVER_PORT_NUM 17725).
If I launch arducopter manually with "--model +" and open a connection to 5760, then 17725 does appear as LISTEN. So the external-mode server can start, but not in the deploy case.
Questions:
1. What starts the external-mode server in the JSON/--slave launch, and what must happen first?
2. Does the plant model have to be running before Connect To Target?
3. Is this a known issue with NAT/WSL 3.x?
Answers (1)
Sayan
on 5 Oct 2026
0 votes
You need to start the plant model first in a separate instance of MATLAB first before running the Monitor and Tune mode of Simulation. Without the plant model running the SITL clock will not start. Also, ensure that you have configured the ip address correctly in PWM read and Sensor write UDP blocks in the plant model.
2 Comments
zharicth
on 5 Oct 2026
Sayan
on 6 Oct 2026
The blocks internally uses the 9002 UDP port for communication. Please ensure that your firewall is not blocking incoming or outgoing traffic through that port. If that happeens the SITL host executable and the Plant communication will not work. The ip to be set in the block is the Windows host ip as seen by WSL when WSL is in NAT mode. To find the ip you can run the following command in wsl to get the default gateway ip address and use it in the block parameter in plant model:
ip route show | grep -i default | awk '{ print $3}'
If the issue still persists please try running Build,deploy and start and verify if you still see the "No JSON sensor message received, resending servos" message in the SITL window. Also, reduce the "Timeout in seconds" parameter value in the block(something like 25) before running.
Categories
Find more on PX4 Autopilots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!