Windows下使用Airsim+QGC进行PX4硬件在环HITL(二)

Windows下使用Airsim+QGC进行PX4硬件在环HITL

This tutorial will guide you through the installation of Airsim and QGC on Windows, so that the hardware-in-the-loop experiment can be conducted.

Hardware-in-the-Loop (HITL or HIL) is a simulation mode in which normal PX4 firmware is run on real flight controller hardware. This approach has the benefit of testing most of the actual flight code on the real hardware.

In 2017 Microsoft Research created AirSim (Aerial Informatics and Robotics Simulation) – an open-source robotics simulation platform. From ground vehicles, wheeled robotics, aerial drones, and even static IoT devices, AirSim enabled data capture data for models without costly field operations.​

(一)Required softwares

Windows下使用Airsim+QGC进行PX4硬件在环HITL(一)

(二)Preperation for HITL

1, Bootloader preperation

If you have programmed the pixhawk board using self-written code, then it cannot work as flight controller any more. To restore the flight controller function, the firmware should be programmed into the board. This is usually done by QGroundControl. However, before downloading firmware, a bootloader program should first be downloaded using STLink Utility into the board for the purpose of initialization.

The prebuilt bootloader hex files(one for co-mcu, the other for main-mcu) are provided. You can also refer to the following links to do it on your own.

Official Github Repository: PX4/PX4-Bootloader: PX4 Bootloader for PX4FMU, PX4IO and PX4FLOW (github.com)

Blogs: pixhawk FMU/IO板bootloader烧写_pixhawk4 bootload烧写-CSDN博客

关于PX4-Bootloader编译的几个小问题 - 知乎 (zhihu.com)

2, Firmware download

Connect the board using micro-usb to your computer.
Open QGC, and click the upper-right icon.
请添加图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
Reboot your device(unplug and plug the USB), you will see interface like this. There may be some error windows popping up, just ignore them.
在这里插入图片描述
在这里插入图片描述

3, Hardware in the loop(HITL) Configuration

Follow the user guide(all the content before section Simulator-Specific Setup): Hardware in the Loop Simulation (HITL) | PX4 User Guide (v1.13)

4, Configure AirSim

You can find the configuration file for AirSim in path like this:

"C:\Users\YourUserName\Documents\AirSim\settings.json"

Copy the code to your own file. Note you should look up your own serial port number for Pixhawk after connecting it to your computer and modify this line: "SerialPort": "COM5",.

{
  "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/main/docs/settings.md",
  "SettingsVersion": 1.2,
  "SimMode": "Multirotor",
  "ClockType": "SteppableClock",
  "Vehicles": {
      "PX4": {
          "SerialBaudRate": 921600, 
          "SerialPort": "COM5",
          "VehicleType": "PX4Multirotor",
          "ControlIp": "127.0.0.1",
          "ControlPort": 14580,
          "LogViewerHostIp": "127.0.0.1",
          "LogViewerPort": 14388,
          "QgcHostIp": "127.0.0.1",
          "QgcPort": 14550,
          "UseSerial": true,
          "LockStep": true,
          "UdpIp": "127.0.0.1",
          "UdpPort": 14560,
          "TcpPort": 14560,
          "UseTcp": true,
          "Model": "Generic",
          "LocalHostIp":"127.0.0.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
          }
      }
  }
  }

(三)HITL Testing

Windows下使用Airsim+QGC进行PX4硬件在环HITL(三)

(四)Virtual flight in HITL

Windows下使用Airsim+QGC进行PX4硬件在环HITL(四)

  • 34
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值