本文主要是介绍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.
文章目录
- Windows下使用Airsim+QGC进行PX4硬件在环HITL
- (一)Required softwares
- (二)Preperation for HITL
- 1, Bootloader preperation
- 2, Firmware download
- 3, Hardware in the loop(HITL) Configuration
- 4, Configure AirSim
- (三)HITL Testing
- (四)Virtual flight in HITL
(一)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(四)
这篇关于Windows下使用Airsim+QGC进行PX4硬件在环HITL(二)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!