1.打开ubuntu终端

2.进入到 PX4-Autopilot 文件夹

cd PX4
cd PX4-Autopilot

3.修改AirSim里settings文件

将无人机的飞行模式改为PX4模式,代码如下:

{
  "SettingsVersion": 1.2,
  "SimMode": "Multirotor",
  "ClockType": "SteppableClock",
  "SubWindows": [
    {
      "WindowID": 0,
      "CameraName": "front_center_custom",
      "ImageType": 0,
      "Visible": true,
      "ImageSize": [ 480, 270 ],
      "CameraPosition": [ 0.0, 0.0, -2.5 ],
      "CameraRotation": [ 0.0, 0.0, 0.0 ]
    },
    {
      "WindowID": 1,
      "CameraName": "front_center_custom",
      "ImageType": 3,
      "Visible": true,
      "ImageSize": [ 480, 270 ],
      "CameraPosition": [ 0.0, 0.0, -2.5 ],
      "CameraRotation": [ 0.0, 0.0, 0.0 ]
    },
    {
      "WindowID": 2,
      "CameraName": "front_center_custom",
      "ImageType": 5,
      "Visible": true,
      "ImageSize": [ 480, 270 ],
      "CameraPosition": [ 0.0, 0.0, -2.5 ],
      "CameraRotation": [ 0.0, 0.0, 0.0 ]
    }
  ],
  "Vehicles": {
    "Drone": {
      "VehicleType": "PX4Multirotor",
      "UseSerial": false,
      "LockStep": true,
      "UseTcp": true,
      "TcpPort": 4560,
      "ControlIp": "172.18.105.223",
      "ControlPortLocal": 14540,
      "ControlPortRemote": 14580,
      "LocalHostIp": "172.18.96.1",
      "Sensors": {
        "Barometer": {
          "SensorType": 1,
          "Enabled": true,
          "PressureFactorSigma": 0.001825,
          "PressureFactorTau": 3600,
          "UncorrelatedNoiseSigma": 2.7,
          "UpdateLatency": 0,
          "UpdateFrequency": 50,
          "StartupDelay": 0

        },
        "Imu": {
          "SensorType": 2,
          "Enabled": true,
          "AngularRandomWalk": 0.3,
          "GyroBiasStabilityTau": 500,
          "GyroBiasStability": 4.6,
          "VelocityRandomWalk": 0.24,
          "AccelBiasStabilityTau": 800,
          "AccelBiasStability": 36
        },
        "Magnetometer": {
          "SensorType": 4,
          "Enabled": true,
          "NoiseSigma": 0.005,
          "ScaleFactor": 1,
          "NoiseBias": 0,
          "UpdateLatency": 0,
          "UpdateFrequency": 50,
          "StartupDelay": 0
        },
        "LidarSensor1": {
          "SensorType": 6,
          "Enabled": true,
          "NumberOfChannels": 16,
          "RotationsPerSecond": 10,
          "PointsPerSecond": 100000,
          "X": 0,
          "Y": 0,
          "Z": -1,
          "Roll": 0,
          "Pitch": 0,
          "Yaw": 0,
          "VerticalFOVUpper": -15,
          "VerticalFOVLower": -25,
          "HorizontalFOVStart": -20,
          "HorizontalFOVEnd": 20,
          "DrawDebugPoints": true,
          "DataFrame": "SensorLocalFrame"
        },
        "Distance": {
          "SensorType": 5,
          "Enabled": true,
          "Yaw": 0,
          "Pitch": -90,
          "Roll": 0
        }
      }
    },
      "Parameters": {
        "NAV_RCL_ACT": 0,
        "NAV_DLL_ACT": 0,
        "COM_OBL_ACT": 1,
        "LPE_LAT": 47.641468,
        "LPE_LON": -122.140165
      }
    }
  }
}

4.设置环境变量

在 Linux 命令行中输入以下命令以添加(或改变)环境变量 。注意,此处的 IP 地址应为主机 IP(LocalHostIp)

export PX4_SIM_HOST_ADDR=172.18.96.1

5.启动 sln 文件的调试以进入 UE4 编辑器,并在 Linux 中启动 PX4

make px4_sitl_default none_iris

就可以啦~

最后记得关防火墙!!!

GitHub 加速计划 / ws / WSL
17.09 K
797
下载
Issues found on WSL
最近提交(Master分支:2 个月前 )
86fa5afa 3 个月前
e899d0b7 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐