在Windows系统查看WSL网卡地址,为:172.26.16.1

设置 AirSim 参数

"C:\Users\<name>\Documents\AirSim\settings.json"

{
  "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.26.16.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
      }
    }
  }
}

启动AirSim

start CityEnviron -ResX=640 -ResY=480 -windowed

安装 PX4 仿真器

mkdir -p PX4
cd PX4
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh --no-nuttx --no-sim-tools
cd PX4-Autopilot

检出最新发布版本

git checkout v1.13.1

启动 PX4 仿真器

export PX4_SIM_HOST_ADDR=172.26.16.1
make px4_sitl_default none_iris

连接 QGC

mavlink start -t 172.26.16.1 -u 14556

发表评论