GSoC 2019: AirSim Simulator Support for ArduPilot SITL Part II

Same issue here…
Tried WSL 1 & 2. Even tried using a VM with no success.
If i use 0.0.0.0 or windows ip as LocalHostIp in the settings.json, airsim just freezes once it opens.
switching to 127.0.0.1 loads the graphics with no response.
same message from sitl:
“no sensor message received in last 1s, error - bad file descriptor, resending servos”

I get a similar error message with slight variation. “No sensor message received in last 1s, error - Resource temporarily unavailable, resending servos”

Using Colosseum. Latest Windows 11. UE5.2.1.

image

In the settings file, I set the LocalHostIp to 0.0.0.0 and UdpIp to the ip found with ip addr show eth0 (one starting after “brd”).

Added “export WSL_HOST_IP=$(cat /etc/resolv.conf | grep nameserver | awk ‘{print $2}’)” to .profile.

Hi @iampete . I am trying to make this work but unable to do it. Do u have any suggestions? Im unable to connect sitl to Airsim (I followed the steps as suggested by rajat2004). But still says connection refused.

1 Like

were you able to resolve this issue ? facing same issue

1 year ago, I found rajat2004 comment and follow with great success.
but recently, when i revisit airsim and try connect airsim with ardu pilot (because i’m unemployed :smile: ), i ran into the problem again, not sure why??
→ But, rajat2004 comment still supper helpful to me, I follow the step in follow the steps in https://github.com/mahmoudajawad/wsl-hacks/blob/master/wsl2-networking.md specifically these step

, and then restart wsl and i sucessful connect ardu pilot and airsim

  • In 1 year, i haven’t pulled new code from ardu pilot, i still use airsim on unreal 4.27.2, but i updated window 11 alot, so i think one of those updates cause problem
  • Hope this comment can help
  • fly on :flags:

What worked for me is to tell Airsim and SITL explicitly which IP addresses to use. I didn’t use rajat2004 fix.
So your C:\Users\YourUsername\Documents\AirSim\settings.json looks like this:
{
“SeeDocsAt”: “AirSim/docs/settings.md at main · microsoft/AirSim · GitHub”,
“SettingsVersion”: 1.2,
“LogMessagesVisible”: true,
“SimMode”: “Multirotor”,
“OriginGeopoint”: {
“Latitude”: 37.334947,
“Longitude”: -122.012715,
“Altitude”: 583
},
“Vehicles”: {
“Copter”: {
“VehicleType”: “ArduCopter”,
“UseSerial”: false,
“LocalHostIp”: “192.168.0.85”, ← this is IP of your main Windows
“UdpIp”: “172.26.240.75”, ← this is IP of your Linux(Ubuntu) under WSL2.
“UdpPort”: 9003,
“ControlPort”: 9002
}
}
}

And you run your SITL under WSL2 by this command:
sim_vehicle.py -v ArduCopter -f airsim-copter --console --map --sim-address=192.168.0.85

It worked on Colosseum fork of Airsim on UnrealEngine 5.4 (after fixing build errors). But I guess it should work on older UE versions (5.2 is last officially supported) as well.

3 Likes

I ran into the same problem. Here is what worked for me:

Follow the original instructions GSoC 2019: AirSim Simulator Support for ArduPilot SITL Part II - #14 by rajat2004

But launch SITL with sim_vehicle.py -v ArduCopter -f airsim-copter --sim-address=$WSL_HOST_IP

Not sure what -A is supposed to do but for me it prevented the SITL from connecting.

Hi,
May I ask which Windows version and WSL version you are using? I tried to follow the instructions but I still cannot make them connect to each other.

Here is the output from wsl --version

WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.2033

I am also using the latest ardupilot master. The commands are different on older versions. That’s also where the -A parameter came from as it was necessary to specify the sim address.

Everything was working like this but I have since switched over to using the WSL feature networkingMode=mirrored in .wslconfig because this makes it much easier and allows you to access the SITL from another PC.
When doing this you can use the following airsim config

"LocalHostIp": "127.0.0.1",
"UdpIp": "127.0.0.1",

and launch the SITL from a windows batch file with

wsl bash -l -c 'sim_vehicle.py --out=udp:127.0.0.1:14550 --sim-address=127.0.0.1 -v ArduCopter -f airsim-copter'

1 Like

You really made my day, thank you so much @tommaier123, working well and much easier :+1:

1 Like