Popular science px4 introduction

1 PX4 Autopilot

PX4 is platform-independent autopilot software (or firmware) that can drive drones or unmanned vehicles. It can be programmed on some hardware (such as Pixhawk v2), and together with the ground control station to form a completely independent autopilot system.

The PX4 ground control station is called QGroundControl, which is an integral part of the PX4 self-driving system and can run on multiple platforms such as Windows, OS X or Linux.

Using QGroundControl, you can write the PX4 firmware to the hardware, set up the machine, change different parameters, get real-time flight information, create and execute completely autonomous tasks.

2 drone head orientation

Whether it is a ship or an aircraft, there should be a machine head facing or the direction of its forward motion should be defined as the machine head direction.

drone head orientation

In the illustrations in this article, we use red paddles to indicate the head orientation of the multicopter.

3 PX4 connection

In order to configure, control and interact with your PX4 unmanned pilot, you need to connect it first. There are three types of connections for Pixhawk hardware:

Remote control connection-Realize the connection of remote control to flight control via radio.

Data connection-the connection between QGroundControl ground station and drone using data transmission, WiFi or USB cable.

External connection-data connection between PX4 and an external computer that can control PX4.

4 remote control

The most basic form of control for drones is to use a remote control. There are many types of remote controllers, here we will explain by using the most popular aircraft remote controllers.

Figure 4 Left-hand throttle, right-hand throttle, right-hand throttle

The difference between the remote control "MODE 1" and the remote control "MODE 2" is to place the throttle channel on the left or right according to different people's hand preferences. It is recommended that you try and decide which of the above two types of remote controls to buy.

5 basic flight

In order to control your aircraft, you need to know and deeply understand the basic Roll, Pitch, Yaw and Throttle commands and the motions these commands are applied to the aircraft in three-dimensional space. effect.

Figure 5 Corresponding channels for roll, pitch, yaw, and throttle commands

The above commands are applied to hoverable aircraft such as helicopters, multi-rotor and forward-facing aircraft such as fixed-wing aircraft, and the aircraft will produce different responses.

The basic movement of hoverable aircraft (such as helicopter, multi-rotor or vertical take-off and landing drone):

What needs to be kept in mind is that for hoverable aircraft (multi-axis drones, helicopters),

Roll command will produce left/right flight effect;

pitch command will produce forward/reverse flight effect;

Yaw command will produce a left/right rotation flight effect based on the center point of the aircraft.

Figure 7 The effect of control commands on fixed wing control

What needs to be kept in mind is that for forward flying vehicles (fixed-wing drones),

Roll command will produce left/right rotation and turning flight effects;

pitch command will produce up/down flight effect;

yaw command will produce left/right rotation of the tail and turning flight effects.

Using the above 4 basic commands, you can control your drone to fly in any direction in the air. The most important thing is that you will be able to perform the most important flight operations in the aircraft-take-off and landing.

PX4 drone frame selection

1 frame selection

If you plan to use PX4 on a drone. Before choosing a rack, the first question you should answer is what is the purpose of your drone.

If you need precise hovering function and can accept a shorter endurance time, it is recommended to use a multi-rotor drone;

If the battery life and coverage requirements are high, fixed-wing drones are recommended;

There is a hybrid type of aircraft called "vertical take-off and landing aircraft", which can take off vertically like a multi-rotor, and after takeoff, it will fly forward like a fixed-wing aircraft.

The vertical take-off and landing aircraft combines the advantages of multi-rotor drones and fixed-wing multi-rotor drones. It has longer battery life, larger coverage and accuracy compared with fixed-wing drones. The ability to hover.

Figure 1 Schematic diagram of the four-rotor UAV frame

(The orange triangle points toward the machine head,

The arrow direction of the four motors is the direction of the motor)

2 Rack configuration

Once the rack is selected and purchased or assembled, during the initialization phase of the drone's flight control, you need to choose a rack with a structure similar to the one you are using from the numerous rack templates in the ground station QGroundControl.

 PX4 UAV sensor selection

  1 Introduction to drone sensors

Since the Pixhawk flight controller has built-in sensors, the PX4 autopilot can completely control the drone without any external sensors.

Pixhawk flight control has built-in three-axis gyroscope + three-axis accelerometer + three-axis magnetometer + barometer sensor (barometer is used to obtain drone altitude information).

It is strongly recommended to install GPS on the aircraft to release the full potential of the aircraft, and after installing GPS, the drone can complete the task in fully automatic mode.


Since Pixhawk's built-in magnetometer is very close to other electronic devices, it is susceptible to electromagnetic interference.

In order to reduce this kind of interference, usually an external magnetometer can be connected to the flight controller, and try to keep the magnetometer away from other electronic devices on the aircraft.

Airspeed sensor is mandatory for most fixed-wing UAVs and vertical take-off and landing UAVs. The airspeed sensor is so important because the PX4 autopilot has no other means to detect stalls other than the airspeed indicator. It is recommended to use a digital airspeed sensor.

Airspeed meter

Preliminary configuration of PX4 autopilot

1 QGroundControl download & install


Hardware: PC/Mac/mobile terminal, Pixhawk flight control

Software: QGroundControl ground station

Firmware: PX4

QGroundControl support list

QGroundControl runs on the above-listed platform devices, and the PX4 firmware runs on Pixhawk flight control.

Schematic diagram of ground station connection to flight control

Use a computer or mobile terminal to download the QGroundControl ground station of the corresponding platform. After completing the QGroundControl installation, connect to the Pixhawk flight control, and you can start to configure the autopilot PX4.

QGroundControl download link

Please master the following postures for the configuration of PX4 autopilot:

Frame selection, you can choose helicopters, multi-rotors, vertical take-off and landing drones, etc.

Calibrate the sensor of the autopilot and choose the correct orientation of the autopilot

Calibrate the remote control

Configure the switch on the remote control to control the flight mode

In addition, there are many items that can be configured using the ground station, but the above steps are essential

QGroundControl video tutorial

The main content of the video tutorial is as follows:

1, firmware upgrade

2. Frame selection

3. Sensor calibration

5. Airplane mode channel settings

PX4 UAV hardware connection

1 PX4 drone hardware connection

PX4 UAV mission planning and execution 

1 Mission planning

PX4 drone flight mission planning is very simple, just click on the top row of the QGroundControl ground station tab to switch to the mission view (the tab turns yellow to indicate that it is selected), click the ➕ (plus sign) icon in the upper left corner, and then click The screen map can be used for task planning.

Task view before task planning

It should be noted that you only need to click the plus sign in the upper left corner once to set multiple waypoints by clicking on the screen multiple times, and the route will be automatically generated according to the order of the waypoints.

Each waypoint information will be displayed on the right side of the ground station. At the same time, the stay time, relative altitude and other information of the waypoint can be edited.

For example, in the following figure, the drone will stay at waypoint 6 for 0 seconds, and the height relative to the home position is 25 meters.

The bottom of the task view shows the relative distance (Distance), relative height (Alt diff), and gradient (Gradient) between each waypoint and the previous waypoint.

For example, the relative distance between waypoint 1 and waypoint 2 is 176.76 meters, and the relative height is 25 meters, so the inclination is tanα=25/176.76≈14%.

After the above operations, click the Send To Vehicle button in the upper left corner to send the planned mission to the drone.

Send flight mission to drone

After completing the above mission planning and mission upload, switch the ground station to the flight view and unlock the PX4 drone. The drone can automatically follow the planned mission path and the ground station will display the drone's flight trajectory in real time.