当前位置:网站首页>Px4 simulation basis
Px4 simulation basis
2022-06-25 23:41:00 【Blue sky】
This article describes jmavsim and gazebo The use of two simulators
The simulator can make PX4 The flight control program is in the simulation “ The world ” To control a computer simulated aircraft . You can use QGroundControl Ground station procedures 、API Or the remote control interacts with the aircraft , It's like interacting with a real aircraft .
Software simulation means PX4 The flight control program runs in the host computer , The host computer we use here is one with ubuntu server Of thinkpad Laptop computer ,PX4 The flight control program is installed in the host computer .
Hardware emulation means PX4 The flight control program runs in a real flight control computer , What we use here is an installation PX4 Of flight control procedures pixhawk Flight control computer .
Operating environment Version Description :
Hardware : Hexing company pixhawk 2.1 cube black
Software :QGroundControl Ground station : 2021-02-23 daily version
PX4 The firmware :1.11.3
operating system :ubuntu server 20.0.04.2 LTS
1. jmavsim Emulator
Reference documents :https://docs.px4.io/master/en/simulation/jmavsim.html
1.1 jmavsim Software emulation (SITL)
step :
1.1.1. from px4 Web site to download PX4_Autopilot Source code
1.1.2. Get into PX4-Autopilot Catalog
1.1.3. Carry out orders
make px4_sitl_default jmavsim
px4 Source code and jmavsim plugin The corresponding source code is compiled , Then the interface of aircraft and flight environment appears
1.1.4. stay pxh Command line interface input command :commander takeoff, You can see the plane take off
1.1.5. start-up QGroundcontrol Ground station procedures , With this program, you can observe the flight path , You can also use the virtual remote control to operate the aircraft , You can also plan a flight mission and let the aircraft perform a flight mission .
1.2. jmavsim Hardware simulation (HITL)
step
1. 2.1 start-up QGroundControl Ground station software
1.2.2 stay Vechicle Setup Of safty In function Hardware in the loop Simulation Choose from HITL enabled
1.2.3 stay Vechicle Setup Of Aireframe Select among “HIL QuadCopter X” frame , Click on apply Button .
Be careful : After the flight control is restarted , Prompt appears Parameters are missing from firmware. You may be running a version of firmware which is not fully supported or your firmware has a bug in it. Missing params: 1:BAT_V_CHARGED, 1:BAT_N_CELLS, 1:BAT_V_EMPTY
This prompt means that several parameters of the system are missing , Mainly refers to the battery part , in fact ,uavcan The parameters of are also missing . You need to use missionplanner recovery . This is a pixhawk 2.1 Unique defects .
1.2.4 stay Application Settings Medium General Medium AutoConnect to the following devices, uncheck All checkboxes , leave “udp”.
1.2.5 close QGroundControl
1.2.6 Unplug the flight control usb Line
1.2.7 Plug in the flight control usb Line , Wait for the flight control to start .
1.2.8 Get into PX4-Autopilot Catalog , Run the command
./Tools/jmavsim_run.sh -q -s -d /dev/ttyACM0 -b 921600 -r 250
Simulation GUI The interface starts .
1.2.9 start-up QGroundControl
jmavsim The simulator will work with QGroundControl and px4 Auto connect .
1.2.10. Unlock the plane with the remote control , Push the oil valve to take off .
Be careful : When it is set to HITL after ,QGroundControl Tips , Loss of power parameters ( Three parameters ), It is necessary to verify the sensor and other information . Don't care , To recover these missing parameters , May refer to pixhawk 2.1 The instructions for ( Hexing company ).
2. gazebo Emulator
Reference documents :https://docs.px4.io/master/en/simulation/gazebo.html
gazebo 9, This is a px4 Specified on the official website gazebo edition , Because the current PX4 Only... Is packaged in the firmware source code gazebo 9 Corresponding code of ,gazebo 9 Self installation required .
gazebo9 Installation steps of :
install gazebo9 And development libraries , It's all binary .
First installation gazebo9-common
sudo apt-get install gazebo9-common
then
sudo apt-get install gazebo9
then
sudo apt-get install libgazebo9-dev
2.1 gazebo Software emulation (SITL)
step :
2.1.1 from px4 Web site to download PX4_Autopilot Source code
2.1.2 Get into PX4-Autopilot Catalog
2.1.3 Carry out orders
make px4_sitl gazebo
px4 Source code and corresponding gazebo plugin The source code is compiled , Then the interface of aircraft and flight environment will appear
2.1.4 stay pxh Command line interface input command :commander takeoff
You can see the plane take off
2.1.5 start-up QGroundcontrol Ground station procedures , With this program, you can observe the flight path , You can also use the virtual remote control to operate the aircraft , You can also plan a flight mission and let the aircraft perform a flight mission .
2.1.6 The flight background of the aircraft can be changed
such as :make px4_sitl gazebo_iris__warehouse
Be careful :iris And warehouse Between 2 Underscores , among iris stay gazebo Middle represents four axis aircraft ,warehouse Representative background .
2.2. gazebo Hardware simulation (HITL)
step :
2.2.1 start-up QGroundControl Ground station software
2.2.2 stay Vechicle Setup Of safety In function Hardware in the loop Simulation Choose from HITL enabled
2.2.3 stay Vechicle Setup Of Aireframe Select among “HIL QuadCopter X” frame , Click on apply Button .
Be careful : After the flight control is restarted , Prompt appears Parameters are missing from firmware. You may be running a version of firmware which is not fully supported or your firmware has a bug in it. Missing params: 1:BAT_V_CHARGED, 1:BAT_N_CELLS, 1:BAT_V_EMPTY
This prompt means that several parameters of the system are missing , Mainly refers to the battery part , in fact ,uavcan The parameters of are also missing . After completing the hardware simulation, you need to use missionplanner recovery . This is a uavcan The missing parameter is pixhawk 2.1 Unique defects .
2.2.4 stay Application Settings Medium General Medium AutoConnect to the following devices, uncheck All checkboxes , leave “udp”.
2.2.5 close QGroundControl
2.2.6 Unplug the flight control usb Line
2.2.7 Plug in the flight control usb Line , Wait for the flight control to start .
2.2.8 compile gazebo plugin
Get into PX4-Autopilot Catalog , Carry out orders
DONT_RUN=1 make px4_sitl_default gazebo
2.2.9 Modify according to the official website gazebo plugin Of xml The configuration file
Open the four axis plane sdf file Tools/sitl_gazebo/models/iris_hitl/iris_hitl.sdf. if necessary , take serialDevice Replace with /dev/ttyACM0
2.2.10 Set the environment variable , Carry out orders
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
2.2.11 function gazebo
gazebo Tools/sitl_gazebo/worlds/hitl_iris.world
2.2.12 start-up QGroundControl
gazebo The simulator will work with QGroundControl and px4 Auto connect .
2.2.13 Unlock the plane with the remote control , Push the oil valve to take off .
Be careful : When it is set to HITL after , start-up QGroundControl Post prompt , Loss of power parameters ( Three parameters ), It is necessary to verify the sensor and other information , Don't care . Recover the lost uavcan Parameters can refer to pixhawk 2.1 The instructions for ( Hexing company ).
边栏推荐
- 二进制、16进制、大端小端
- Mutual conversion between QT utf8 and Unicode encoding, and the Unicode encoding output format is &xxxxx
- 社招两年半10个公司28轮面试面经(含字节、拼多多、美团、滴滴......)
- Analysis and comprehensive summary of full type equivalent judgment in go
- Leetcode-1528- rearrange string - hash table - string
- A. Balance the Bits--Codeforces Round #712 (Div. 1)
- Ad20 learning notes II
- What is Unified Extensible Firmware Interface (UEFI)?
- UE4 learning record 2 adding skeleton, skin and motion animation to characters
- WordPress
猜你喜欢
随机推荐
Xinchida nd04 nd04c nrf52832 (52810) ble module (low power Bluetooth communication module) at command test
util. Collection and encapsulation of JS tool functions
1.8 billion pixel Mars panorama Ultra HD released by NASA, very shocking
自定义QComboBox下拉框,右对齐显示,下拉列表滑动操作
(serial port Lora module) centrida rf-al42uh private protocol test at instruction test communication process
Pointer strengthening and improvement
第五章 习题(124、678、15、19、22)【微机原理】【习题】
[Axi] interpretation of Axi protocol atomic access
Qlabel text scrolling horizontally
UE4 learning record 2 adding skeleton, skin and motion animation to characters
Record the ideas and precautions for QT to output a small number of pictures to mp4
Informatics Orsay all in one 1353: expression bracket matching | Luogu p1739 expression bracket matching
28 rounds of interviews with 10 companies in two and a half years (including byte, pinduoduo, meituan, Didi...)
Anaconda一文入门笔记
C. Yet Another Card Deck-Educational Codeforces Round 107 (Rated for Div. 2)
C# IO Stream 流(二)扩展类_封装器
C. Planar Reflections-CodeCraft-21 and Codeforces Round #711 (Div. 2)
Efr32bg22 ble module (low power Bluetooth communication module) at command test
excel如何实现中文单词自动翻译成英文?这个公式教你了
二叉排序树









