microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.32k stars 4.55k forks source link

Wsl2 connection over tcp with airsim #4708

Closed Amin-Yazdanshenas closed 1 year ago

Amin-Yazdanshenas commented 2 years ago

Question

What's your question?

issue with connecting Airsim to px4 using wsl2

Include context on what you are trying to achieve

well, I am trying to connect px4 to Airsim, and for that purpose, I followed all the steps on the Airsim GitHub page (https://microsoft.github.io/AirSim/px4_sitl/). PX4 running fine on wsl2 and also Airsim works fine on its own, but I cannot make the TCP connection to work. I was hoping that anyone could help me to resolve the issue.

Context details

Airsim Version: v1.8.1 Unreal Version: 5.0.3 Visual Studio Version: 2022

{ "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/main/docs/settings.md", "SettingsVersion": 1.2, "SimMode": "Multirotor", "ClockType": "SteppableClock", "Vehicles": { "PX4": { "VehicleType": "PX4Multirotor", "UseSerial": false, "LockStep": true, "UseTcp": true, "TcpPort": 4560, "ControlIp": "remote", "ControlPortLocal": 14540, "ControlPortRemote": 14580, "LocalHostIp": "172.31.112.1", "Sensors":{ "Barometer":{ "SensorType": 1, "Enabled": true, "PressureFactorSigma": 0.0001825 } }, "Parameters": { "NAV_RCL_ACT": 0, "NAV_DLL_ACT": 0, "COM_OBL_ACT": 1, "LPE_LAT": 47.641468, "LPE_LON": -122.140165 } } } }

Include details of what you already did to find answers

For building the Airsim project I used VS 2022

I also copied the Airsim plugin file to an empty unreal project, and after running the project, the drone spawned in the environment fine.

I created TCP port 4560 and UDP 14540, 14550, 14560, 14556, and 14580 on the inbound rules of the windows Defender firewall with the "all programs that meet the specific conditions" setting. and disable all the unreal engine inbound rules to prevent unreal overrule its own rules over the created ports.

Also, I run the following command on the wsl2 terminal "export PX4_SIM_HOST_ADDR=172.31.112.1"

at some point, I thought the problem would be from my unreal project. Therefore, I tried to run the Blocks environment of Airsim, which, when tried to build the project, gave me the following errors: (Build settings: DebugGame editor and Win64) Severity Code Description Project File Line Suppression State

Error C2672 'common_utils::Utils::isDefinitelyLessThan': no matching overloaded function found Blocks C:\Users\myuser\source\repos\AirSim\Unreal\Environments\Blocks\Plugins\AirSim\Source\PawnSimApi.cpp 232

Severity Code Description Project File Line Suppression State Error C2027 use of undefined type 'physx::PxVehicleWheels' Blocks C:\Users\myuser\source\repos\AirSim\Unreal\Environments\Blocks\Plugins\AirSim\Source\Vehicles\Car\CarPawnApi.cpp 62

Severity Code Description Project File Line Suppression State Error C2027 use of undefined type 'physx::PxVehicleDrive' Blocks C:\Users\myuser\source\repos\AirSim\Unreal\Environments\Blocks\Plugins\AirSim\Source\Vehicles\Car\CarPawnApi.cpp 66

Severity Code Description Project File Line Suppression State Error MSB3073 The command ""C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat" BlocksEditor Win64 DebugGame -Project="C:\Users\myuser\source\repos\AirSim\Unreal\Environments\Blocks\Blocks.uproject" -WaitMutex -FromMsBuild" exited with code 6. Blocks C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets 44

Amin-Yazdanshenas commented 1 year ago

That is all the info that I can provide for now

buvnswrn commented 1 year ago

Did you manage to mak the connection?

droneOTTO commented 1 year ago

I had the same problem, I solved it by updating the latest release from: https://github.com/PX4/PX4-Autopilot/releases

e.g(January 2023):

cd PX4-Autopilot git checkout v1.13.2 make px4_sitl_default none_iris

  1. I also initially bashed PX4 with all the tools and nuttx, not like what is mentioned on the airsim github

git clone https://github.com/PX4/PX4-Autopilot.git --recursive bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

  1. I also opened up all the TCP and UDP ports just in case
Amin-Yazdanshenas commented 1 year ago

The issue was with my WSL after reinstalling it; it got fixed.