What’s your question?
the 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 (PX4 in SITL - AirSim). 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”: “AirSim/docs/settings.md at main · microsoft/AirSim · GitHub”,
“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