Hi,
Sorry for the slightly incomplete steps. I seem to be unable to edit that post now, so will describe the steps here, will add to the Wiki directly as well after testing on a fresh WSL install
-
The first step mostly isn’t directly required, for e.g. when launching a binary, the Windows Firewall will mostly popup saying the .exe file has been blocked, in that enable it to access Private networks as well. You can still follow the steps in https://github.com/mahmoudajawad/wsl-hacks/blob/master/wsl2-networking.md and it should work, if someone could confirm if it’s required or not, that would be great!
-
The
.profile
file is located in the home directory in the Ubuntu system in WSL2. Add the below lines (you can edit using vim, nano or some other editor) -
export WSL_HOST_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
export DISPLAY=$WSL_HOST_IP:0
- The
settings.json
is in the Documents/AirSim folder in Windows. It’ll be created by AirSim on startup if not found. The entire settings is mentioned in the Wiki. Modify the specific lines below -
"LocalHostIp": "0.0.0.0",
"UdpIp": "172.25.239.255",
UdpIp
can be found by running ip addr show eth0
inside Ubuntu in WSL
-
Set the XWindows application settings, in particular Disable Access Control. This is described in Wiki’s WSL SITL Setup page also. The Step 2 export is also similar, just that an extra
WSL_HOST_IP
variable is added since it’s used next. -
Launch SITL finally -
sim_vehicle.py -v ArduCopter -f airsim-copter -A --sim-address=$WSL_HOST_IP
Do comment if something doesn’t work!