SITL stops working after one succesful try

I’m trying to get SITL working with ArduPlane and X-plane.

X-plane running in windows 10, SITL in wsl2 (Ubuntu 24.04)

I’ve followed the ardupilot instructions in setting the build environment and using SITL.
Build: ./waf configure --board sitl and ./waf plane
Start the SITL with: sim_vehicle.py -v ArduPlane -f xplane --console --map

Mavproxy opens and my model in x-plane starts moving, everything seems to be working:

When i close applications and try to run it second time it does not work:

Only thing that solves the problem is re-installing ubuntu.

Plan is to also connect Mission Planner to everything, but i can’t wrap my head around this problem.

Hi

Sometimes I had this problem when Mission Planner was running in the background. I had to close mission planner, start again the SITL and then start mission planner (that should connect automatically).

hello

reinstalling ubuntu is overkill, sitl is a simple software so we can just kill it without messup with the rest.

Don’t forget that what you get in the terminal with the prompt is mavproxy and not sitl. Normally SITL will be launch on the xterm window. Most the time the connection refused comes from the xterm windows that insn’t close and thus you still have sitl running and holding tcp ports.

you can use a command like pidof arduplane in another wsl terminal to check the sitl install is down correctly (if it doesn’t return a number that means that it is not launched) or using top/htop to search for it !

I understand that it’s overkill. Still nothing else has worked, for example re-installing the build chain, pip uninstall mavproxy etc.

pidof arduplane doesn’t return anything.

If i launch the sim_vehicle.py with --no-mavproxy argument, i can see sim_vehicle.py processes using htop. If i launch with the parameters in the original message there are no processes related to anything.

Also when i launch with the --no-mavproxy argument i get xterm error after few minutes (i’m using VcXsrv).

Problem is solved, i needed to allow public connections from firewall settings for VcXsrv.

First i got it working by calling “export DISPLAY=:0.0” but i realized it worked without VcXsrv being on, so it used some other GUI application, which i could’t find what.

The reason why it worked on the first try after building it is still mystery.