1. Introduction
Recently, unmanned aerial vehicles (UAVs) have shown a remarkable advance in their technological development. Specifically, vertical take-off and landing (VTOL) aircraft are of special interest since they do not need a runway to perform take-off or landing manoeuvres [
1]. There are several configurations for this type of aircraft and one of the most widely used is the quadcopter, whose flight stability is defined by regulation of revolution speed between its four motors. This type of UAV are widely used as experimental platforms due to their mechanical simplicity and inherent robustness [
2]. Trends imply that analyses on quadcopters are becoming more and more relevant in the field of aerial robotics, as they are considered very practical prototypes in university teaching to promote programming and robotics skills [
3]. However, educational platforms based on multirotors are very challenging in terms of design and control due to their nature of operation, as they require moving in a three-dimensional space.
The design of an attitude control algorithm for a quadcopter requires a long period of development including analysis under simulation and flight testing. Most control systems require an experimental phase on the physical system for validation, since unexpected performances may occur as a consequence of limitations in the control design, e.g., unmodelled dynamics [
4]. For this reason, there is a necessity to use test platforms that allow an easier transition between numerical and experimental analysis, by evaluating the performance of a controller under a safe environment for user and vehicle, without any risk of collision [
5].
From a teaching perspective of control systems involved with UAVs, some contributions presented are the software platform [
6], in which detection, tracking and control algorithms can be evaluated and tested all together in a 3D graphical tool. There are also educational multi-rotor platforms such as [
7], with intuitive software that allows the basic learning of aerodynamic principles. Hardware-in-the-loop (HIL) platforms represent an effective approach in UAV design due to their potential to execute simulations and experiments [
8]. In university laboratories, it is also common to find the use of different types of inverse pendulums for teaching control systems [
9].
All these platforms represent experimental tools that allow students to evaluate and tune control algorithms, which operate based on the application of inertial devices such as micro-gyroscopes that measure the angular velocities and positions of the system. Nowadays, the analysis of control systems based on this technology is highly important in control engineering subjects, since it has many automotive applications, such as anti-rollover systems, antiskid control and electronic stability control. Some consumer applications are camera stabilization, cell phone stabilization, inertial mouse and navigation for portable electronics. In addition, micro-gyroscopes have a wide range of military applications on missiles navigation, aeronautics and astronautics, stable platform, GPS and so on [
10].
This article presents the design and construction of a three degree of freedom (DoF) experimental platform for validation of control systems before being implemented in quadcopters. Likewise, its design is oriented to be used for teaching purposes in university laboratories. Regarding the development of control systems in aerial vehicles with four rotors, some of the different control techniques that are used for research and teaching are proportional integral derivative (PID) control, linear quadratic regulator (LQR) [
11] and linearization by feedback [
12,
13]. Other kinds of more advanced control strategies are also mentioned in such as H infinity [
14], fuzzy logic [
15], back-stepping [
12,
16], dynamic inversion [
17], sliding mode (SMC) [
18] and so on.
The outstanding features of the proposed platform in comparison with existing prototypes involve the following aspects: energy (system autonomy), programming level, cost, safety level, system operation ranges, experimental flexibility and replication level. These highlights contribute to a better adaptation of the proposed prototype to the student environment for performing laboratory sessions.
The academic perspective of the testing platform is to allow students to evaluate the approach of a control system experimentally, partially or totally, modifying the control algorithm through the editing of Matlab/Simulink block diagrams.
To show the potential of this prototype in an educational environment, this work considers laboratory tasks focused on the design of controllers for two different groups of undergraduate students, as described below:
Student group A: Students belonging to basic level control and automation courses, with lacking base knowledge and no notions of implementation in real physical systems.
Student group B: Students belonging to intermediate level control and automation courses, with solid basic knowledge and without notions of implementation in real physical systems.
As a global approach, for the group of students A, the development of a classical PID controller is proposed. While for the group of students B, the development of a controller using the state feedback technique is proposed. For both cases, the working hypothesis is considered a basic knowledge in control theory from the student’s side, so basic control schemes are used, in continuous time, obviating implementation issues, as the discretization of the controller or the use of the filtered derivative term. Despite this, it should be noted that it is possible to use the platform for the evaluation of more sophisticated control designs that consider these aspects, typical of courses for more advanced graduate students, master’s degree, etc.
The remainder of the paper is organised as follows.
Section 2 provides a concise overview of the prototype developed in this work.
Section 3 presents background about prototypes with similar approaches.
Section 4 discusses the kinematics and dynamics principles of the prototype.
Section 5 describes the methods, materials and components associated with both the electronic and the structural design of the prototype.
Section 6 describes the hardware and software implemented in the project.
Section 7 describes the system parameter identification. In
Section 8, the model and strategy for designing the controller to be implemented in the system are formulated.
Section 9 shows the development of the control laws to be evaluated in the platform.
Section 10 shows the implementation process and the numerical and experimental results obtained.
Section 11 summarizes the conclusions.
2. System Overview
The prototype built for this work and previously mentioned is presented in
Figure 1, it performs the function of a test bench for control law evaluation designed for the stabilisation of aerial vehicles with four rotors. It is constituted by a system of 4 main elements, which are: a gyroscopic structure with three degrees of freedom, a quadcopter, an external power supply and a computer. Each of these elements is described in more detail below.
Three degrees of freedom gyroscopic structure: mechanical structure that enables pitch, roll and yaw motions in a quadcopter, while at the same time constraining translational movements.
Quadcopter: aerial vehicle with specifications for control law experimentation inside a laboratory.
External power supply: element responsible for supplying electric current to the quadcopter.
Computer: auxiliary tool for communication between user and platform in implementation of control algorithms using Matlab-Simulink.
Some technical specifications of the test platform are presented below.
Dimensional specifications
Maximum volume: m3 ; base diameter: m ; total weight: kg ; maximum height: m
Motion specifications
Allowed ranges of motion: 360 degrees for roll, 360 degrees for pitch and 0 degrees for yaw.
Power specifications
Propellers used: cm length, cm pitch, three blades. Motor revolution constant: 2300 kv; maximum power supply rating: V; A.
Since this platform is designed to be used as an educational tool in robotics and automation laboratories from basic courses, the prototype incorporates two powerful IMUs combined with a sensor fusion algorithm that allows obtaining measurement signals with very low noise levels. Consequently, students in introductory control courses can focus on the design of basic control strategies without the need to consider implementation details. However, it is possible to formulate more sophisticated strategies for advanced courses, where the use of observers, filters, predictors, etc. can be considered. As an example of an application, a video of this prototype in operation can be found at [
19].
In introductory courses, the main objective for the students is to be able to verify, evaluate and experiment with the parameters/gains of the control system, which is predetermined by the teacher. On the other hand, in advanced courses, the selection and implementation of the control structure can be considered. Some of the tasks proposed for the students are the following:
Possible control systems laboratory assignments
Design of a controller for angular stabilization
Design of a controller for angular velocity
Design of a controller for disturbance rejection
Design of an uncertainty tolerant controller
Design of a fault tolerant controller
Verification of mathematical models
Possible robotics lab assignments
Identification of multirotor system elements
Understanding of basic multirotor maneuvers
Control and operation of brushless motors
Application of inertial sensors
Signal processing and tuning of noise filters
As in most laboratory activities, it is required that students have some prior theoretical knowledge in certain areas of engineering. According to the laboratory work to be performed in relation to the level of complexity of the student subject in the area of control theory, it is desirable that students possess certain prior knowledge. In the
Table 1, the basic areas of knowledge desirable for students in the performance of laboratory tasks are indicated. Further, the areas of knowledge with preferably intermediate or advanced level that is desirable in students in relation to the complexity of the task to be performed with respect to the content of the current student subject are indicated. As is usual in university courses, an introductory theory lesson may be given before students are asked to perform a laboratory task.
3. Background and System Approach
Experimental tests under completely safe conditions are very important for the development of flight controllers. Since it is possible to find unconsidered variations in vehicle behaviour, the use of a test platform becomes an interesting solution [
5].
The main goal of the prototype shown in
Figure 1 is to minimize the difficulty of experimental testing for quadcopter systems in reduced spaces with appropriate safety measures. The design of this prototype is focused on academic applications, due to its dimensions and manufacturing method it is ideal to be installed and replicated in university laboratories where it can be used to analyse quadcopter dynamics under any control law proposed. In addition, with the auxiliary use of MATLAB-Simulink software for algorithm implementation and sensor monitoring, this prototype becomes more accessible to be used by engineering students.
The state of the art shows the existence of some mechanisms used as test benches for UAVs, some of them have been developed by research groups such as the Australian National University [
20], Stanford University [
21], the Swiss Federal Institute [
22] and the University of La Rioja [
23], this last prototype manages to solve some problems that other platforms have been facing, such as limitations in time of use, construction complexity, low level of reproducibility and design conditions such as lightness and balance of components concerning vehicle’s center of gravity. However, it lacks a protection system that would naturally increase the safety level.
Apart from these platforms, there are others available on the market, such as the FFT GYRO platform developed by Eureka dynamics or the three DOF Hover prototype shown in
Figure 2 which belongs to Quanser [
24]. This last platform consists of three degrees of freedom mechanism that is equipped with three decoders that provide information about the platform inclinations for their control and stabilisation. However, this mechanism adopts a configuration based on a fixed ball and socket joint that limits the platform rotation angles in a given range.
Table 2 compares some features of the prototype presented in this article (PT-1), the platform developed by the University of La Rioja (PT-2) and the commercial platforms FFT GYRO (PT-3) and three DOF Hover (PT-4).
Some features that stand out in PT-1 with respect to the others are as follows:
The power supply does not depend on the discharge time of a conventional UAV battery as in PT-3.
It has full rotation range in its three axes unlike PT-4.
It has a protection system that increases its safety level with respect to PT-2 and PT-3.
The incorporation of MATLAB-Simulink for control algorithm programming promotes its adaptation to educational environments.
It can adapt different quadcopter vehicles with similar geometrical dimensions, since they can be mounted on the gyroscopic structure without any difficulty. PT-2, PT-3 and PT-4 platforms do not have this feature since their design are more rigid.
Due to the method for algorithm implementation that is proposed (external mode) and described later in
Section 6.2, it is possible to define tuning parameters in the control algorithm that can be regulated during experimentation. This adds extra flexibility in the development phase of a control system.
Since it is composed mostly of elements manufactured by 3D printing, its construction has a low level of complexity, which makes it feasible to replicate for laboratories and at lower cost compared with the market price of PT-3 and PT-4 platforms.
6. Hardware and Software
To implement and execute control algorithms in the prototype, the Pixhawk (PX4) microcontroller is used, which consists of an open hardware autopilot ecosystem based on NuttX operating system (RTOS) with flight control units that are powered by embedded sensors to execute algorithms on ARM® Cortex®-M microprocessors, which drive the vehicle’s motors through PWM outputs. The main purpose for employing PX4 hardware in this prototype is to use MathWorks Build Tool Integration (BTI) to enable MATLAB software to invoke the ARM-GCC compiler in building applications based on Simulink block models. The system target file is ert.tlc (Embedded Real-Time) and is available with Embedded Coder.
6.1. Capabilities and Features
By using the Embedded Coder ™ support package for PX4
® autopilots, it is possible to generate C++ code from Simulink
® models designed for Pixhawk FMUs (Flight Management Units). In this context, the PX4 toolchain is used to compile algorithms designed for this flight management unit, in which data from integrated sensors are incorporated [
30].
Pixhawk Support Package (PSP) offers the possibility to incorporate Pixhawk Toolchain for compiling and downloading firmware in the Pixhawk FMU unit, which includes a block library for accessing data from inertial sensors, GPS, PWM output, ADC, serial Rx/Tx and other available functions that can be used in Simulink model at runtime. Using this library it is possible to create block models to design a control system to manipulate quadcopter motors. Once this control system is successfully modelled, simulated and verified, PSP generates the source code that is subsequently compiled. Since this tool generates code for a Simulink PX4 module, the Pixhawk support package attaches the generated code to the compilation process to match the general firmware in the built environment when using the CMake command. This source code interfaces between the designed control system and the base hardware drivers that constitute PX4 firmware. As a result of this process, a NuttX application titled is created with the algorithm defined by the designed block model. This application is included as part of the boot script in the firmware that is compiled and executed in PX4.
As part of the set of PX4 sensors, a magnetometer is integrated, which is used to measure the orientation of the quadcopter with reference to the earth’s magnetic field. As a consequence of electromagnetic interferences existing in a laboratory, interferences generated by motors and current circulating through cables distributed in the prototype, an erroneous data reading is generated by this sensor, causing a deviation in yaw orientation measurement with respect to the actual position. This drawback could be solved by implementing a secondary external magnetometer at a longer distance from motors to reduce electromagnetic interference.
6.2. External Mode Execution
External mode is a way in which it is possible to monitor and adjust in real-time the execution of the source code compiled in PX4, from its graphical interface environment. This feature is included with Matlab/Simulink Embedded Coder tool and greatly enhances the interactive debugging capabilities for models executed in real-time by providing all the source files necessary to establish a serial communication channel between the computer and PX4 [
31]. Using this mode, the created Simulink model becomes a user interface for interaction with the previously compiled code during code execution, achieving two main actions:
1. Visualize the output value of a given signal at each moment. In addition, it is possible to store signal data and generate a *.mat file.
2. Set parameters as global variables that can be modified in the generated code during its execution, so that an external program can have more control over them in relation to the predefined instruction set.
Before starting the simulation of a created application and linking communication between computer and microcontroller, a COM port for USB connection to PX4, a baud rate of 115,200 baud and a timeout of 0.5 s are set.
Figure 9 depicts the operation of the prototype with Matlab-Simulink software in external mode while the simulation is running.
Blue box represents the plant, which is constituted by the quadcopter mounted on the test platform. Inside is another box representing PX4 hardware, which controls the platform with the previously compiled algorithm. Both subsystems are in constant feedback through the control algorithm, on the one hand, the microcontroller sends the signal to each motor and on the other hand, the platform performs actions that are subsequently measured by sensors integrated into the microcontroller. The sensed measurements are sent to the computer through the USB connection for storage. Red box represents the computer with Matlab-Simulink environment, where the block diagram of the control system compiled on the Pixhawk FMU board is located. This block system contains a set of adjustable parameters that the user can modify and send to the microcontroller to update the control algorithm that is running. With this set of adjustable parameters, it is possible to set reference signals, gains, switches for control blocks, etc.
8. Model and Control Strategy
In recent years, different mathematical models have been proposed that represent the quadcopter as a sub-actuated mechanical system with six degrees of freedom and only four control inputs. Most authors consider the vehicle as a rigid body, as shown in [
33,
34]. In a large number of these papers, the controller is developed through a linearized system [
35] or by neglecting insignificant terms.
8.1. Nonlinear State Space Model
The quadrocopter rotation system represents three degrees of freedom corresponding to angular displacement on its three rotation axes. The dynamic model for this system [
36] is indicated by the following differential equations.
These scalar equations of motion describe the nonlinear dynamics of vehicle, taking a symmetric rigid body approach subjected to external forces applied at its center of mass. Where [
] and [
] denote angular positions and velocities respectively shown in
Figure 3, [
,
,
] represent the vehicle moments of inertia, [
] are the torques from Equations (
2), (
4) and (
5) that induce angular motion in quadcopter. [
] represent gyroscopic and aerodynamic disturbance effects.
8.2. Linear State Space Model
In order to focus the analysis to a specific operating point of interest, linearization of system is carried out. Using equations that describe the nonlinear model, the linearized system defined by the Equations (
7)–(
12) is obtained:
where the equilibrium point selected for linearization refers to the stationary flight of aircraft, where all moments are counteracted and the net thrust force is equivalent to vehicle weight.
As a consequence of an insufficient thrust generation for this particular quadcopter model, there is a very small operating margin to manipulate yaw movements. In addition to this problem, there is also the previously described problem of yaw angle measurement error caused by electromagnetic interference in the magnetometer. Due to these factors, it makes no sense to design a control system to operate with yaw motion, so it is decided to restrict this movement and design a control system for pitch and roll motions.
8.3. Linear State-Space Model for Pitch and Roll Motions
As discussed at the end of the previous section, the control design is focused on the pitch and roll dynamics. For that reason, the linearized three DoF model described by Equations (
7)–(
12) is reduced to two DoF model.
As a result of the linearization process, a complete decoupled model is obtained, so that each rotational motion is expressed independently. This approach is appropriate when the system operates around the selected equilibrium point, then the effect between motions is negligible. From this approach, Equations (
9) and (
12) belonging to yaw motion are dispensed with and the remaining equations are maintained.
So, by performing a matrix approach of Equations (
7), (
8), (
10) and (
11) in form (
13), the system is defined by the matrices below:
where A is the state matrix of dimension , B is the input matrix of dimension and C is the output matrix of dimension . On the other hand, the state vector is constituted as , the input vector is composed by and the output vector is defined as .
8.4. Control Scheme for System Stabilization
The control approach for stabilization of the tilt angles
and
is schematized in
Figure 11. In this diagram, there are four elements as inputs to the controller, [
] are the two tilt angles of the quadcopter to be controlled and [
] are the reference angles for each system output. The outputs of the controller are torques [
] which are the inputs to the rotation system responsible for generating vehicle actuation. Specifically, the input
controls roll motion and
controls pitch motion.
From this approach, a second one is developed (
Figure 12) in which the system inputs are expressed as
signals. These are created by mixer block, which is responsible for filtering signal coming from rotation control to
signal and distribute to each motor of the quadcopter. The inputs of this block are torques [
,
] resulting from the calculation made by the rotation controller and base on the thrust force
, which is proportionally distributed.
From the torque definition, the set of forces required by each motor to generate torques demanded by the control system are calculated using following equations:
where
d is the parameter defined in Equation (
3) and [
,
] are forces required to generate pitch and roll torques respectively. From calculation obtained by these equations, (
6) is used to obtain PWM signal modulation, defining
and
signals associated to each movement. Subsequently, Equations (
14)–(
17) distribute the signal to each motor so that together they contribute in equal proportion to required torques. Where
are the signals sent to the motors 1, 2, 3 and 4 respectively.
In addition, in these expressions is also added the base thrust with which the system operates. This is added in PWM signal form (). The magnitude of this force is set by the user at each point in time. Constant 1000 is set so that motors start receiving a signal magnitude from a suitable range to start accelerating.
9. Controller Development
In order to show the potential of the platform for implementation, experimentation and evaluation of a control system, it is proposed a practical exercise to design a control law using two techniques well studied, PID from the classical control theory and state feedback from the modern control theory.
9.1. Basic Control Theory Student Lab Assignment: PID-Based Controller Design
As mentioned at beginning of
Section 8.3, the set of equations shown in (
7)–(
12) describes a fully decoupled rotating system. The matrix representation for pitch and roll motions according to these equations is as follows:
Subsystem for roll motion
where the input is and the output is .
Subsystem for pitch motion
where the input is and the output is .
As can be seen, each movement is a function of single control input. Subsequently, it is possible to go from state-space to transfer function representation using Equation (
18).
The transfer functions are expressed as y for each subsystem as follows:
Once model is defined in this form, it is easy to define the closed loop for each system output.
Figure 13 shows the block diagram that refers to PID control approach with ISA structure, where it is identified [
] as the control action coefficients for roll motion and [
] for pitch motion.
Therefore, each controller is defined by the functions and as follows:
Due to the unstable nature of quadcopters and the difficulty of performing open-loop experiments, it is difficult to establish a set of dynamic specifications that would be appropriate for the controllers that the students will design. For that reason, a previous state-space feedback control law has been obtained via Linear Matrix Inequalities (LMI) [
37]. In particular, the stability problem has been formulated and solved in terms of LMIs, where parametric uncertainties in the moments of inertia present in the model shown in (
7)–(
12) have been considered under the operating ranges shown in
Table 4.
As mentioned before, the purpose of this control analysis is to define a set of appropriate dynamic specifications for the students. The resolution of this approach leads to the following dynamic specifications:
Roll motion : , , and .
Pitch motion : , , and .
Where is the settling time of the system response, is the maximum overshoot, is the natural frequency of the system and is the damping factor. These specifications define the closed-loop poles for roll motion and for pitch motion which are shown below:
For the design of the PID gains for pitch and roll control, it is proposed to use the technique based on pole placement [
38], where a reference close-loop behaviour is described by
. PID control parameters with the structure
are obtained by solving the close-loop equation
. Following this approach, the parameters for each PID controller are the following:
9.2. Advanced Control Theory Student Lab Assignment: Controller Design from a State Feedback
To establish the control model under this approach and in order to ensure the system reaches a given reference, an integrator is inserted between the error estimator and the plant by formulating an extra equation for each output in the control model. These equations are:
where [
,
] represent reference signals imposed for each output and [
,
] symbolize error dynamics through its derivative for each output. Adding this system of equations to model presented in
Section 8.3 yields the model detailed in (
19).
where
,
and
are augmented matrices of dimension
,
and
respectively, the state vector is constituted by
, the augmented input vector is composed by
[
,
,
,
] and the output vector is defined as
[
,
]. The closed-loop scheme for state feedback is presented in
Figure 14.
where vector
is composed by elements [
,
,
] and vector
is constituted by [
,
,
]. Making use of the control law
, the controller for this model is defined by Equations (
20) and (
21). Where
,
,
,
,
,
are feedback constants defined by eigenvalue reassignment.
To design steady-state feedback, it is essential to verify system controllability. From evaluating the controllability matrix derived from the system defined by matrices in (
19) it is possible to infer that it is a fully controllable system of rank 6 and is characterised by the following open-loop eigenvalue set:
.
Then, to create the controller it is proposed to set the closed-loop poles
and
to match the eigenvalues assigned in state feedback approach. So, once the system controllability is verified, the feedback state matrix
K is calculated by using the vector [
,
] and the eingevalue placement method by the Ackermann function implemented in Matlab [
39]. The result is as follows:
Using the gain values obtained in
K, the control law for each system input is presented in (
22) and (
23).
11. Conclusions and Future Work
This work has presented the design of a test platform with a gyroscopic structure. Its main purpose is to validate control systems for quadcopters. It is considered a useful prototype to evaluate the performance and operation of control systems, minimizing the necessity for an experienced pilot to operate an aerial vehicle. Due to the manufacturing and assembly processes involved in its construction, it is easy to replicate this prototype at a lower cost compared to existing platforms on the market. Due to its unlimited autonomy and safety level, it can be used in a university laboratory for an indefinite time. The integration of Matlab/Simulink as user interface facilitates its adaptation to the student environment. This tool represents the work area where students can formulate their own control algorithms by creating diagrams using the Pixhawk block library to access sensor data and drive motors. In this context, editing or creating a new block diagram to modify or define a control algorithm to experiment on the platform becomes a very simple process.
Since the main focus of this paper is the presentation of the test platform, the description of its design, manufacture, application and main features, the control approaches presented here have been kept as simple as possible, in order to show as simple and clear as possible the process of implementation and experimentation of a control system without diverting the main focus of the paper to the development of more advanced control techniques. In this sense, the evaluation of a more sophisticated control system design for optimal performance of the platform is established as future work or as part of the assignments to be carried out by students in robotics and automatic control laboratories.
In addition to the laboratory assignments already described above, some application goals such as control design for angular position under static or dynamic loads, automatization of motions for trajectory tracking, and development of protocols for physical failures in the system (e.g., loss of thrust efficiency in a motor) are also proposed. In the field of construction design, it is proposed to use this platform as a test bench to analyse vehicle performance when implementing different components (experiment with propellers and motors of different specifications, evaluate the accuracy of sensors, etc.). In the field of teaching, this platform can also be used as a functional model for a fundamental understanding of quadcopter dynamics or pilot training (e.g., to practice complicated acrobatic aerial manoeuvres).
Finally, as future work, two possible modifications to the prototype are proposed in order to improve performance and solve the current drawbacks.
1. Add encoders on the three axes of rotation that validate/contrast the IMU’s measurement of Euler angles and, at the same time, deal with the signal problem in yaw angle estimation.
2. Analyze possible design modifications to the qav250 quadcopter frame to improve maneuverability in all axes, including yaw motion.