Lesson 02 Experimental Platform Configuration
Lesson 02 Experimental Platform Configuration
Lesson 02 Experimental Platform Configuration
1. Overall Introduction The RflySim Advanced version has been released for
free, which covers all experiments in this course. You
can also visit https://rflysim.com/docs/#/4_Pro/Advanced
2. Software Package Installation to acquire RflySim advanced versions if there is demand.
4. Summary
Overall Introduction
The experimental platform can be divided into two parts: the hardware platform
and the software platform. This lesson shall introduce the basic components of
each platform and present the deployment procedure in detail.
Installation files
Overall Introduction
Hardware Platform Airframe system Propulsion system
Arm Fuselage
Because all control algorithms are Motor
eventually deployed in a real aerial Battery
vehicle to perform flight tests, a ESC
hardware platform must be prepared Landing gear Propeller
for the basic flight test requirements.
Radio control (RC) system Autopilot hardware system
As shown in the right picture, the
experimental hardware platform USB cable
recommended in this book is Charger
composed of five main parts. RC transmitter Autopilot GPS receiver Ground control
RC receiver
computer
Overall Introduction
Hardware Platform Airframe system Propulsion system
(1) Ground Computer
Arm Fuselage
It is a high-performance Personal Computer Motor
(PC) with an operating system that performs Battery
two main tasks.
ESC
• Providing the software operating
Landing gear Propeller
environment for the simulation software tools
to perform functions such as control algorithm Radio control (RC) system Autopilot hardware system
development, SIL simulation, automatic code
generation, and HIL simulation; USB cable
• Working as a ground control station in Charger
outdoor flight tests to achieve functions such Autopilot
RC transmitter GPS receiver Ground control
as sensor calibration, parameter tuning, real- RC receiver
computer
time control, and communication.
Autopilot hardware system
Overall Introduction
Hardware Platform
Autopilot GPS receiver
(2) Autopilot System (also called flight control system)
• As the operating platform of control algorithms, it has many sensors and powerful computing
capability to estimate flight states and calculate the control signals for the propulsion system to
realize the flight control of multicopters.
• This lesson select a widely used open-source autopilot — Pixhawk as the development and
experimental autopilot system.
• Pixhawk is an independent open-hardware project that aims to provide standard readily-available,
high-quality, and low-cost autopilot hardware for education, amateurs, and developers.
• For different flight mission, performance, and cost requirements, the Pixhawk provides a series of
autopilot hardware products that highly promote the development of multicopters.
Overall Introduction
Hardware Platform
(3) Radio Control (RC) system Airframe system Propulsion system
FlightGear
This experimental platform relies on many
software tools to realize controller design, code Automatic code generation and firmware compiling Code view and modification
generation, autopilot code compilation, HIL
simulation, and other functions. The Simulation WSL/Msys2/
Software Package published along with this book Simulink PSP
toolbox
PX4 firmware
source code
Cygwin
compiling tool
has a one-click installation script. Readers can
HIL simulation
click the script to finish all the installation and
configuration process of the required software
environment. The MATLAB/Simulink and the CopterSim 3DDisplay QGC
Pixhawk
autopilot system
Ground
computer RC system
Simulation Software Package comprise the Indoor and outdoor flight tests
FlightGear
FlightGear
(2) FlightGear — Flight Simulator
It is a popular open-source flight simulator that can be Automatic code generation and firmware compiling Code view and modification
used to easily observe the flight states of a simulated
aerial vehicle in Simulink by receiving flight data from
WSL/Msys2/
Simulink via a User Datagram Protocol (UDP) Simulink PSP
toolbox
PX4 firmware
source code
Cygwin
compiling tool
interface.
HIL simulation
(3) PX4 Software — Source Code
PX4 is an open-source flight control software system Pixhawk Ground
that runs on the Pixhawk hardware platform. The CopterSim 3DDisplay QGC autopilot system computer RC system
Pixhawk hardware + PX4 software constitutes an Indoor and outdoor flight tests
FlightGear
2021/10/8 17
Toolbox one-key installation script
Noteworthy: 1
yes
OK Cancel
Toolbox one-key installation script
1. Software package installation directory. All dependent files on the software package are installed in
this directory, which requires around 6G storage. The default installation directory is “C: \PX4PSP”. If
the C disk space is not sufficient, the readers should choose a directory in other disks; the directory
name must be correct with only letter and number to prevent compilation failures.
2. The default compiling command for PX4 is “px4fmu-v3_default”. By selecting this compiling
command, the compiling toolchain is automatically called to compile the PX4 source code to a
firmware file “px4fmu-v3_default.px4” after the PSP generates the controller code. Then, the file
“.px4” is uploaded and burned to the supported hardware to realize the deployment of the control
algorithms. Different Pixhawk hardware products must select different PX4 firmware compiling
commands. Next picture shows some Pixhawk hardware products, where “px4fmu-v3_default” can be
used for three popular products: Pixhawk 1 (2MB Flash version), mRo Pixhawk, and Cube (Pixhawk
2). The command “px4mu-v2_default” corresponds to the most famous Pixhawk 1 (1MB Flash). PX4
also supports other hardware (for example, Intel Aero, Crazyfile, and so on). The corresponding
compiling commands are listed in the next page.
Note: after installing the toolbox, if you want to change compiling command (e.g., px4-fmu-v5_default) for different Pixhawk hardware boards,
another feasible method is to input command in MATLAB: PX4CMD('px4-fmu-v5_default'), or use command : PX4CMD px4-fmu-v5_default
Software Package Installation px4fmu-v3_default
Advanced Settings
• Pixhawk 1: px4fmu-v2_default
• Pixhawk 1 (2MB flash): px4fmu-v3_default
• Pixhawk 4: px4fmu-v5_default
• Pixracer: px4fmu-v4_default Pixhawk 1 (fmu-v2) mRo Pixhawk Cube/Pixhawk 2
• Pixhawk 3 Pro: px4fmu-v4pro_default 2MB flash Version (fmu-v3) (fmu-v3) (fmu-v3)
• Pixhawk Mini: px4fmu-v3_default
• Pixhawk 2: px4fmu-v3_default
• mRo Pixhawk: px4fmu-v3_default
• HKPilot32: px4fmu-v2_default
• Pixfalcon: px4fmu-v2_default
• Dropix: px4fmu-v2_default Pixhawk 3 Pro Pixhawk 4 Pixhawk 4 Mini
• MindPX/MindRacer: mindpx-v2_default
(fmu-v4) (fmu-v5) (fmu-v5)
• mRo X-2.1: auav-x21_default
• Crazyflie 2.0: crazyflie_default
• Intel® Aero Ready to Fly Drone: aerofc-v1_default
Software Package Installation
px4fmu-v3_default
Advanced Settings
Method to find out the desired compiling
command for your Pixhawk:
1) Open QGroundControl (QGC) and
enter the “Setting” (Gear icon) –
“Firmware” Page;
2) Connect Pixhawk with a USB cable,
and the QGC will turn to the state in the
right figure, then click “OK” to update;
3) QGC will auto download the
desired .px4 firmware, so the compiling
command can be found in the download
link. For example, px4fmu-v3_default is
obtained for Pixhawk 1 (2Mb Flash).
Software Package Installation 1
Advanced Settings 2
3. PX4 firmware version. The version of the PX4 source code is updated constantly, and the latest
firmware version was 1.11 when this book was written. As the firmware version is upgraded, new
features may be introduced, and more new products will be supported, but the compatibility with
some old autopilot hardware will be affected. Because the Pixhawk 1 hardware selected in this
book is an old Pixhawk product with LED for better experimental observation effect, the older
PX4 firmware version 1.7.3 was selected with the compiling command “px4fmu-v3_default” to
achieve better-using effect.
4. PX4 firmware compiling toolchain. Because the compilation of PX4 source code depends on the
Linux compiling environment, the software package provides three sets of compiling toolchains
to realize the simulation of the Linux compiling environment under the Windows environment.
Win10WSL based on the Windows Subsystem for Linux (WSL);
(b) Msys2Toolchain based on toolchain;
(c) CygwinToolchain based on the toolchain.
Software Package Installation
Advanced Settings
Example 1: if you are using the recommended Pixhawk 1
(2M flash, px4fmu-v3 firmware):
• Configure the RflySim installation script and connect the
Pixhawk with RC receiver according to the figure at right
• Use the recommended compiling command px4fmu-
v3_default
• Use the recommended PX4 firmware version 1.7.3
• Use the recommended compiling toolchain Msys2
• Pixhawk 1 has LED on the shell, so no external LED is
required. Pixhawk 1
Software Package Installation
Advanced Settings
Example 2: if you are using the Pixhawk 4 hardware
(fmu-v5), you should adopt the configuration as shown in
the figures at right:
• Please select PX4 firmware >= 1.8.2 (PX4 1.10.2 is
recommended), because it is known that PX4 1.7.3 GPS
with
cannot recognize the S.BUS RC, you may need a PPM LED
module to transfer RC signals.
• Use a GPS module with LED integrated, because
Pixhawk 4 has no LED on the body. Besides, the you
should use JST GH interface to connect RC receiver.
Pixhawk 4
• Use compiling command px4fmu-v5_default
Note: You can use RflySim advanced platform to use PX4 1.12 to get
the best experience of Pixhawk4, because some Pixhawk with latest
LED chip may not work on PX4 1.8
Software Package Installation
Advanced Settings yes
Note that the CygwinToolchain only supports PX4 firmware with version 1.8 or above; the
Msys2Toolchain only supports PX4 firmware with version 1.8 or below. Both the CygwinToolchain
and the Msys2Toolchain support Windows 7 and above, which are easy to deploy, but the compiling
speed is slow. For Windows10 with version 1809 and above, readers can follow the tutorial in
“0.UbuntuWSL\Win10UbuntuInstallationStep.docx” to install an Ubuntu subsystem in Windows
and then choose the Win10WSL. The Win10WSL toolchain can greatly accelerate the compiling
speed and is compatible with all versions of PX4 firmware.
5. Whether to reinstall the PSP Toolbox (yes or no). If this option is set to “yes”, the PSP
Toolbox is installed on MATLAB/Simulink. If the PSP toolbox has already been installed,
a new installation of the PSP Toolbox is performed. If this option is set to “no”, the script
does not do anything on the existing PSP toolbox (it will not uninstall the PSP toolbox or
carry out other actions).
Software Package yes
Installation
Advanced Settings yes
6. Whether to reinstall the dependent software packages. If this option is set to “yes”, software
tools (such as FlightGear, QGC, CopterSim, and 3DDisplay) are deployed to the selected
installation directory and shortcuts for them are generated on the desktop. The related drivers
for Pixhawk hardware are also installed. If the software tools have already been installed,
selecting “yes” will remove the old installation files and reinstall them. If this option is set to
“no”, then no change will be made.
7. Whether to reinstall the selected compiling toolchain. If this option is set to “yes”, the selected
compiling toolchain (Win10WSL, CygwinToolchain, or Msys2Toolchain) will be deployed to
the selected installation directory. If the toolchain already installed, the script will remove the
old toolchain files and reinstall it. In contrast, if this option is set to “no”, then no change will be
made.
Software Package Installation
yes
yes
8. Whether to reinstall the selected PX4 firmware source code. If this option is set to “yes”, the
selected PX4 firmware source code will be deployed to the selected installation directory. If the
firmware files already exist, the old firmware folder will be deleted, and a new copy of the source
code will be deployed. If this option is set to “no”, then no change will be made.
9. Whether to pre-compile the selected firmware. If this option is set to “yes”, the PX4 source code
will be pre-compiled. This can greatly save the compiling time of the subsequent code generation
process; whether the compiling environment is installed properly can also be checked. If this
option is set to “no”, then no change will be made.
10. Whether to block the actuator outputs of the PX4 original controller. If this option is set to “yes”,
the control signals of the PX4 original controller will be blocked to prevent them from conflicting
with the generated controller in Simulink. This option must be set to “yes” for the simulations and
experiments in this book. If this option is set to “no”, the PX4 outputs will not be blocked, and this
mode can be used to test the PX4 original controller.
Software Package Installation
Installation Completion
1) When the above one-key installation scripted is successfully executed, the shortcuts for the
core software tools will be generated in the RflyTools folder on the Desktop. according to the
specific compiler type selected by the user configuration, only one compiler shortcut,
Msys2Toolchain, CygwinToolchain and Win10WSL, will appear.
Futaba T14SG
Hardware Platform Configuration
RC System Configuration (1) RadioLink AT9S Pixhawk USB
wire
port charging head of the battery is inserted into the Battery box on the back
socket on the charger. Red and green indicator colors Battery interface
represent the “charging” and “fully charged” status,
respectively. The RC transmitter battery is installed
as follows. Open the battery slot on the back of the
RC transmitter and insert the two-line battery power
Battery
supply interface (red line for the battery positive Charger Charger Interface (four pins, red for positive pole)
pole) into the battery power slot. Note: Unplug the
battery from the RC transmitter while charging.
Avoid using the RC transmitter while charging.
Hardware Platform Configuration
RC System Configuration (1) RadioLink AT9S
RC System Configuration
E
CH4 R
Mode Black-Red-
White
2. How to rematch the RC transmitter with an RC receiver (the connection has been completed by
default, and this step needs to be performed only when problems occur in the connection of the
receiver and the transmitter). Turn on the power of the RC transmitter (all other RC transmitters
should be turned off), and correctly connect the receiver with the Pixhawk and the computer.
Then, press the matching switch on the right side of the receiver with a pen tip or needle (see the
right) for more than one second. At this time, the LED of the receiver starts to flash, which
indicates that it is searching for the nearest RC transmitter. When the receiver LED flashes seven
or eight times and then remains constant, it means that the matching process is finished and a
connection has been successfully established between the RC transmitter and receiver.
The arrow
points to
CH5 back CH6
RC System Configuration
E
CH4 R
Mode Black-Red-
White
OK
Selection
Link mode
switch
button
Wheel
White-Red-Black JR
Note: the arrows point to the increasing direction of PWM wire
RC System Configuration
E
CH4 R
OK
Black-Red-
White
Return
Method to check connection of RC system and Pixhawk
Link mode
switch
button
Selection
1. Connect the Pixhawk autopilot and the RC receiver Wheel
White-Red-Black JR
with a JR wire. Note: the arrows point to the increasing direction of PWM wire
CH2
CH3
CH2
CH3
Mode
CH2
CH3
CH2
CH3
needs to be set.
• Press the “Mode” button for several seconds to
enter the “REVERSE” setting page shown in
right figure.
• Change the throttle channel from “NOR” to
“REV”.
Hardware Platform Configuration
RC System Configuration (1) RadioLink AT9S
5) CH5-CH6 mode switching channel setting
• Because of experimental requirements, CH5 of the RC transmitter needs to be mapped to a three-
position switch in the upper left corner for mode switching of the Pixhawk.
• Press the “Mode” button for several seconds, and click the “AUX-CH” item next to the
“REVERSE” item.
• On the “AUX-CH” setting page, click the “CH5” item to enter the channel setting page, and map
CH5 to a three-position switch “SwE” on the RC transmitter (switch “E” is located in the top-left
corner of the RC transmitter.
• Similarly, the “CH6” item must be modified to a three-position CH5
switch “SwG” of the RC transmitter (switch “G” is located
in the upper-right corner of the RC transmitter in right figure.
CH3
Hardware Platform Configuration
RC System Configuration (1) RadioLink AT9S
6) Channel confirmation Mode
OK
Restart the RC transmitter, and press the “Return” button (see right Return
left to right, corresponding to a PWM value that changes from 1100 Return
OK
stick of the RC transmitter. The right-hand stick moves from top to Note: the arrows point to the increasing direction of PWM
bottom, corresponding to a PWM value that changes from 1100 to
1900 (QGC’s Channel Monitor moves from left to right).
3. CH3:this corresponds to the vertical movement of the left-hand
stick of the RC transmitter. The left-hand stick moves from top to
bottom, corresponding to a PWM value that changes from 1900 to
1100 (opposite to CH2, right to left in QGC’s Channel Monitor).
Hardware Platform Configuration
The arrow
6) Channel confirmation
4. CH4:this corresponds to the horizontal movement of the left-hand CH3
CH2
6. CH6:this corresponds to the three-position switch on the upper- Note: the arrows point to the increasing direction of PWM
right side of the RC transmitter. The switch moves to the top position
(the farthest position to the user), middle position, and bottom
position (the closest position to the user), corresponding PWM
values of 1100, 1500, and 1900, respectively. (left to right in QGC)
Hardware Platform Configuration
RC System Configuration (2) Futaba T14SG
SE SG
transmitter is introduced.
Plug in the right
side USB port Return
Left-down
S.Bus port
If you are interested in RflySim advanced platform and courses for rapid development
and testing of UAV Swarm/Vision/AI algorithms, please visit:
https://rflysim.com/en/4_Pro/Advanced.html
2021/10/8 60
Thanks