The four axes of the sky DIY” Wechat official account training materials are right Pixhawk Aircraft installation Raspberry Pi Introduced , About software simulation , This paper introduces the in Ardupilot Flight control system software simulation , Run the... Sent by Shumei Dronekit Flight control application , This article is about PX4 Flight control system software simulation environment , Run the... Sent by Shumei MAVSDK-Python Flight control application .
Basic simulation environment :
stay PC Or the operating system installed on the laptop is ubuntu 20.04.2, It can also be 16.0.4,PX4 The software simulation environment of is installed on this machine .
In Shumei sect ( such as :Raspberry Pi 3B) What's installed on ubuntu-mate desktop 16.04.2( You can download it at this address :https://releases.ubuntu-mate.org/archived/xenial/armhf/), The flight control application will be installed on this machine .
In addition, it needs to be installed on Shumei pie python3.6, because MAVSDK-Python This program requires 3.6 Previous versions of python, Carry out orders :sudo apt install python3.6.
The establishment of basic simulation environment and how to communicate with Rasberry Pi establish wifi Connect , Please refer to wechat official account “ The four axes of the sky DIY” Training materials and articles :《Pixhawk UAV extended tutorial (2)--- Shumei sect installation ubuntu-mate System and necessary settings 》.
Follow the steps below to realize the MAVSDK-Python Flight control application program control software simulation environment PX4 Flight control system :
1. stay PC Or on a laptop ( hypothesis :IP The address is 192.168.3.12) install PX4 development environment
Reference resources px4 Articles on the official website :https://docs.px4.io/master/en/dev_setup/building_px4.html
2. stay PC Or on a laptop ( hypothesis :IP The address is 192.168.3.12) start-up jmavsim Software emulation (SITL)
stay PX4 The installation directory PX4-Autopilot in , Enter the command :
make px4_sitl_default jmavsim
3. stay PC Or on a laptop ( hypothesis :IP The address is 192.168.3.12) Start the ground station ( If you don't want to see 3D According to the effect , This item can be omitted )
Get into QGroundControl In the installation directory , Enter the command :
./QgroundControl.AppImage
stay QGroundControl Check the parameters on the :MAV_BROADCAST, Should be set to Always broadcast.
4. stay PC Or on a laptop ( hypothesis :IP The address is 192.168.3.12) install mavlink-router
Reference resources mavlink-router Articles on the official website :https://github.com/mavlink-router/mavlink-router
5. stay PC Or on a laptop ( hypothesis :IP The address is 192.168.3.12) start-up mavlink-router
stay mavlink-router Directory , Enter the command :
./mavlink-routerd -e 192.168.3.11:14540 0.0.0.0:14540
perhaps
./mavlink-routerd -e 192.168.3.11:14540 127.0.0.1:14540
notes :mavlink-router The function is in PC Or laptop and Raspberry Pi The establishment between is based on UDP Communication connection , Also is to 192.168.3.12:14540 And 192.168.3.11:14540 Establish a connection between (udp Routing of information ).
6. In Shumei sect ( hypothesis :IP The address is 192.168.3.11) Installation on MAVSDK-Python
Reference resources MAVSDK Articles on the official website :https://mavsdk.mavlink.io/develop/en/getting_started/installation.html
notes :MAVSDK-Python It is used in the reference materials on the official website pip Where available python3.6 -m pip Instead of .
7. In Shumei sect ( hypothesis :IP The address is 192.168.3.11) Start manually on the mavsdk_server
perform :
./mavsdk_server -p 50051
notes :
a. If it is not started manually mavsdk_server, Application and mavsdk_server There will be unstable connections between , Unknown cause .
b. my mavsdk_server edition (arm edition ) yes v0.36.0
8. modify MAVSDK-Python Under the table of contents examples/takeof_and_land.py file
take
drone = System()
Change it to :
drone = System(mavsdk_server_address="localhost",port=50051)
And then execute :
python3.6 takeoff_and_land.py
Can be viewed QGroundControl Flight interface and jmavsim 3D Show , Unlock , take off , Flight route , land , locked .