Quadcopters Testing Platform for Educational Environments

This work focuses on the design and construction of an experimental test bench of three degrees of freedom with application in educational environments. It is constituted by a gyroscopic structure that allows the movements of a quadcopter to analyze the control systems. In this context, the main features of the mechanical and electronic design of this prototype are described. At the same time, the main characteristics with respect to existing platforms are highlighted in aspects such as: system autonomy, cost, safety level, operation ranges, experimental flexibility, among others. The possible controller design approaches for quadcopter stabilization can extend to many basic and advanced techniques. In this work, to show the operation and didactic use of the platform, the development of the controller for tilt angle stabilization under two different approaches are presented. The first approach is through PID control, oriented for undergraduate students with basic level in control theory. The second approach is by means of State Feedback, oriented to students with more advanced level in this field. The result of this work is an open test bench, enabled for the experimentation of control algorithms using Matlab-Simulink.


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 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.

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. • Power specifications Propellers used: 10.14 cm length, 11.43 cm pitch, three blades. Motor revolution constant: 2300 kv; maximum power supply rating: +12 V; 12.5 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 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.

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.

System Dynamics and Kinematics
As mentioned in [25], in previous work related to UAVs, mathematical models derived from the reference of aerial vehicles with similar dynamics have been used to reach quite identical conclusions. However, some assumptions made for other types of aircraft may not be appropriate for quadcopters due to the fact that they do not accurately represent the kinematics of this particular system. To design appropriate attitude controllers, the use of an accurate dynamic model is required. In [26] they emphasize the importance of using models based on capturing the existing dependence between the dynamics and kinematics of the system for obtaining governing equations of motion.
The following is a brief description of physical foundations of the prototype in Figure 1. The dynamic performance of a quadcopter and the kinematics of the gyroscopic structure are exhibited.

Quadcopter Dynamics
The six quadcopter degrees of freedom are defined by its rotational and translational motions, which are generated from forces and moments produced by each of its four motors [17]. The free-body diagram of a quadcopter is shown in Figure 3. The reference frame [X a , Y a , Z a ] is fixed and used to describe translational displacements, while system [X b , Y b , Z b ] represents the inertial reference frame which rotates with the vehicle. Each motor is located at a distance l from the center of the vehicle and runs at speed ω n to generate a thrust force f n with perpendicular direction to the plane of rotation. The vector sum of all forces is the net force F, which acts at the center of mass and counteracts the total weight mg of the drone when it is hovering at a fixed point. Displacement through space at a linear velocity [u, v, w] is caused by variation of forces f 1 , f 2 , f 3 and f 4 , which magnitudes are regulated by the rotational speed of each motor, and their directions by induction of angular moments on the reference frame [X b , Y b , Z b ] [27]. These torques are generated from the application of [τ φ , τ θ , τ ψ ] that give rise to rotational motions in the vehicle, which are known as pitch, roll, yaw and are defined by the euler angles [φ, θ, ψ]. The relationship between [φ,θ,ψ] and angular velocities [p, q, r] is presented later in Section 8.1. To generate clockwise and counterclockwise yaw torques, the configuration of motors is set such that velocities ω 1 and ω 3 have clockwise direction, while velocities ω 2 and ω 4 have counterclockwise direction as shown in Figure 3. With reference to system [X a , Y a , Z a ], translation of quadcopter is produced as a consequence of the forces and torques that are defined by Equations (1)- (5).
Displacement at Z a is caused by the effect of the vertical component of net force F (1) with respect to vehicle inclination.
Pitching motion (angular displacement θ) is created from torque τ θ (2), which rotates vehicle on X b axis and as a result it induces a translational motion on Y a axis.
where d is the geometric distance in perpendicular direction between the point of application for each force ( f n ) and the axis of rotation, defined by the Equation (3).
Roll motion (angular displacement φ) is created from torque τ φ (4),which generates rotation on Y b axis, causing translation on X a axis.
And finally, yaw motion (angular displacement ψ) is originated by the total sum of drag torques generated from each propeller (5), resulting in rotation on Z b axis.
where c is a positive yaw constant that depends on the ratio of thrust to drag of motors.

Kinematic Description of the Gyroscopic Structure
The design of this test platform is focused on the dynamic principles of a quadcopter to perform its angular motions. Figure 4 represents kinematic operation by describing the rotational motion of each platform component in relation to the reference system Elements in red rotate on X C axis and have the function of enabling roll φ motion. Elements in green enable pitch motion θ rotating on Y C axis. Elements in blue define rotation on Z C axis establishing a yaw orientation ψ. Elements in black are anchors for the entire prototype.

Methods, Materials and Components
The following is a general description of the mechanical and electronic structure of elements that constitute the prototype.

Quadcopter Structural Design
The quadcopter structural system has two essential functions, to resist forces and torques present in its dynamic performance and to contain the necessary electronic components for its operation. The structure designed for this prototype ( Figure 5a) is based on the architecture of a set of quadcopters with low commercial value on the market, which contributes to a higher level of replicability. It has a symmetrical configuration, such that each motor has a location equidistant to the geometric center. It is designed to be light, resistant and has a set of protectors to protect the user's integrity during the operation phase. Figure 5b-d show the three main components that constitute the vehicle structure, which are specified below.

•
Center plate: Element that joins the four quadcopter arms. It is made of PLA material by 3D printing. Its geometry comes from an elliptical segment and has a thickness of 5 mm. The .cad files of the 3D printed parts of this structure can be found in the documentation folder for this prototype, which is accessible at [28].

Gyroscopic Platform Structural Design
The structural function of the test platform is to hold the quadcopter system so that its natural rotational motions are enabled. For this, slip rings [29] are used to transmit free rotational motion between pieces. In addition, these components are also used to conduct electrical current and USB communication signal through their connection channels. Flexibility in the design of this structure allows the coupling of different aerial vehicles with similar dimensions. This feature expands the scenario of possible experimentation analysis using this prototype.
The following is the description of each structural element that constitutes the test platform according to the nomenclature shown in Figure 6. Roll movement is executed by the action of an aluminium tube (VI) which is connected between two slip rings located in II and III. At the same time, these slip rings are integrated into the main hoop (X) that is used to perform pitching motion. This hoop is made up of 16 pieces joined together, of which 8 of them have male configuration and 8 female configurations, each piece constitutes 45 degrees of the circumference that forms the complete hoop. From female pieces that form this hoop, 4 of them are modified in a different way for the adaptation of slip rings located in numbers I, II, III and IV. These modifications consist of a hole located in the center of each piece for insertion of the shafts of each slip ring. A metal frame with a square cross-section (XIII) is used to support the assembled hoop. Two rectangular supports (XI and XII) are attached to the upper ends of this frame to hold slip rings I and IV. The lower end of this frame is embedded through two supports (VII and VIII) to a circular wooden base (IX) which is used as an anchor point for the whole prototype.
As well, the .cad files of the components that integrate this platform and are 3D printed can be found in prototype documentation at [28].

Quadcopter Electronic Design
The quadcopter electronic system is integrated by devices specified in Table 3, which are connected according to the diagram shown in Figure 7. Yellow lines represent communication signal, while red and black lines represent VCC and GND poles respectively for transmission of electric current. As one of the main criteria considered in the electronic design, component selection is based on the economic feasibility to build multiple replications of the prototype. In this sense, the selected set of electronic components is based on devices used in qav250 quadcopter model, since it is relatively inexpensive, it is widespread internationally and it is easy to find any necessary component for replacement.

Gyroscopic Platform Electronic Design
As a secondary function, the platform is responsible for conducting electric current from external power supply to vehicle. In addition, it also conducts communication signal between the computer and quadcopter via USB connection. For this purpose, the prototype has integrated connection channels, which are connected via the slip rings. Each ring has 12 connection channels, which are distributed as shown in Figure 8. Red and black arrows indicate VCC and GND power transmission poles. USB communication is represented by yellow arrows. The number of channels used between each connection is shown next to each arrow.

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.

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 PX4_Simlink_App 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.

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 PW M 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.

System Parameters Identification
This section sets out parameters that are subsequently used to design a control system. Using a digital scale, the weights of each component of the prototype were measured. From this information, a CAD model was created by making a mass distribution. In this way, the moments of inertia of the prototype were obtained, which are part of the mathematical equations used to model the system. The results obtained from this calculation are as follows: moment of inertia I xx = 0.11 kgm 2 , moment of inertia I yy = 0.41 kgm 2 and moment of inertia I zz = 1.07 kgm 2 . Other parameters obtained from physical measurements include: total vehicle mass (m) = 0.720 kg, arm distance (l) = 0.129 m, gravitational acceleration (g) = 9.81 m/s 2 .
Using the RC Benchmark 1580 series dynamometer [32], the thrust produced f n by one of the Emax brushless motors under a PWM signal variation was measured. This test was carried out using propellers model 4045 with three blades. Data from this experiment are shown in Figure 10, where the thrust produced is expressed in Newtons (N) and the period of pulse width modulation in milliseconds (ms). Subsequently, a linear regression was applied to these data (red curve) to finally obtain the function presented in (6), which characterises the force f n produced by each motor at a given PWM signal.

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.

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. φ = p + q sin φ tan θ + r cos φ tan θ θ = q cos φ − r sin φ ψ = q sin φ sec θ + r cos φ sec θ p = 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 [p, q, r] denote angular positions and velocities respectively shown in Figure 3, [I xx ,I yy , I zz ] represent the vehicle moments of inertia, [τ φ , τ θ , τ ψ ] are the torques from Equations (2), (4) and (5) that induce angular motion in quadcopter. [τ φ d , τ θ d , τ ψ d ] represent gyroscopic and aerodynamic disturbance effects.

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.

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.

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 [φ r , θ r ] are the reference angles for each system output. The outputs of the controller are torques [φ r , θ r ] 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 PW M signals. These are created by mixer block, which is responsible for filtering signal coming from rotation control to PW M signal and distribute to each motor of the quadcopter. The inputs of this block are torques [F b ,F b ] resulting from the calculation made by the rotation controller and base on the thrust force (F b ), 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 [F φ , F θ ] 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 PW M φ and PW M θ 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 PW M 1 , PW M 2 , PW M 3 , PW M 4 are the signals sent to the motors 1, 2, 3 and 4 respectively.
In addition, in these expressions is also added the base thrust F b with which the system operates. This is added in PWM signal form (PW M b ). 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 PW M signal magnitude from a suitable range to start accelerating.

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.

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 u φ = τ φ and the output is y φ = φ.

Subsystem for pitch motion
where the input is u θ = τ θ and the output is y θ = θ.
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 G(s) φ y G(s) θ 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 [K c φ , τ i φ , τ i φ ] as the control action coefficients for roll motion and [K c θ , τ i θ , τ d θ ] for pitch motion. Therefore, each controller is defined by the functions C(s) φ and C(s) θ as follows: Due to the unstable nature of quadcopters and the difficulty of performing openloop 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. Table 4. Ranges of uncertainties considered in the moments of inertia of the system. 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:

Moment of Inertia
• Roll motion φ: T ss ≈ 8s, M p ≈ 40%, ς ≈ 0.28 and ω n ≈ 1.32. • Pitch motion θ: T ss ≈ 4.s, M p ≈ 9%, ς ≈ 0.6 and ω n ≈ 1.22. Where T ss is the settling time of the system response, M p is the maximum overshoot, ω n is the natural frequency of the system and ς is the damping factor. These specifications define the closed-loop poles ω pφ for roll motion and ω pθ 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 1+C(s)G(s) . Following this approach, the parameters for each PID controller are the following:

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 [φ r , θ r ] 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).
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: Ω A = {0, 0, 0, 0, 0, 0}. Then, to create the controller it is proposed to set the closed-loop poles ω pφ and ω pθ 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 [ω pφ ,ω pθ ] 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).

Implementation and Results
As a prototype focused on educational environments, it is of special interest to highlight the level of practicality and simplicity of the platform to carry out implementation and evaluation of designed controllers. As described in Section 6, the main interaction tool between user and platform is Matlab-Simulink, where block diagrams for control systems are edited. In addition, as auxiliary functions provided by this tool, it is possible to modify system parameters, enter commands to execute predefined actions and monitor both control inputs and system response in real-time.
Experimental results obtained with the implementation of controllers developed in Sections 9.1 and 9.2 are presented below.

State Feedback Control Experimentation
According to the scheme shown in Figure 14, continuous measurement of the elements in the state vectorx is required to feed back this control loop. Figure 15 presents the Simulink block system created to implement this controller. Blocks highlighted in red allow reading angular positions and velocities received from sensors, while blocks in green "Signal 1", "Signal 2" and "Signal 3" are set by user at runtime to send reference signals [φ r ,θ r ] and to set the base thrust signal PW M b present in (14)- (17). The subsystem entitled "Control Algorithm" processes all these inputs to define as a result of a PWM signal to each motor of quadcopter at each time in the block titled "Motors". Figure 16 illustrates the internal block diagram in this subsystem. Green blocks with numbers 1-4 represent states contained in vectorx which refer to angular positions and velocities, blocks 5 and 6 are the reference signals applied to calculate the errors [ε φ , ε θ ] which constitute the 2 remaining states inx. Block number 7 is the base thrust set. Orange blocks are gains of the control laws defined in (22)-(23) for computation of stabilization torques [τ φ ,τ θ ]. Red blocks are functions that evaluate the magnitude of each torque and define a required thrust force in PWM signal using Equation (6). The "Mixer" subsystem handles the proportional signal distribution for each motor using Equations (14)- (17). The pink block acts as a switch for disarming the motors when zero base thrust is set. Figure 17 shows the system response of an experiment done with this implementation, where initial conditions [φ 0 , θ 0 ] = [0, 0] and duration 500 s. Where [φ r , θ r ] represent the imposed reference signals, [φ E , θ E ] are the system response on the test platform and [φ S , θ S ] are the numerical simulation response.
On the other hand, Figure 18 shows the control actions applied, where [τ φ E , τ θ E ] are the stabilisation torques calculated by the controller in experimental test and [τ φ S , τ θ S ] are the control actions calculated during numerical simulation.

PID Control Results
To create the block diagram for this approach, a similar structure to the one shown in Figure 15 is used, but with the difference that the control loop is fed back only with the information provided by the errors between angular positions and reference signals. Figure 20 shows the block diagram to implement PID controller. The function of the blocks with similar titles to those presented in Figure 15 is the same. The subsystem with the title "Control Algorithm" contains the internal PID control system to carry out control actions. This subsystem is shown in Figure 21, where green blocks with numbers 1-4 define the errors [ε φ , ε θ ] in which control actions act for feedback. The PID(z)s blocks represent these control actions, which are created from structure and gains presented in Section 9.2.  In addition, an anti-windup mechanism is added in each loop to saturate each torque to a limit of 0.8 Nm. The blocks in common in this subsystem with those in Figure 16 have the same function as described before.
As a second test, an experiment was performed for a period of 350s. Initial conditions were [φ 0 ,θ 0 ] = [0, 0]. Figure 22 shows the system response in this second test, where [φ r , θ r ] are the imposed reference signals, [φ E , θ E ] represent the system response and [φ S , θ S ] the system response in numerical simulation. On the other hand, Figure 23 shows the control inputs to carry out each movement, where [τ φ E , τ θ E ] are inputs present in real test and [τ φ S , τ θ S ] are control actions calculated in numerical simulation. Figure 24 illustrates thrust forces f 1 , f 2 , f 3 and f 4 respectively for each motor in this experiment.   One of the main differences between the experimental and numerical response in Figures 18,19,23 and 24 for the experiments carried out is the offset observed between τ φ E and τ φ S . This is related to the additional mechanical resistance added to the quadcopter system due to the platform connections that support the vehicle. This factor limits the operation of the controller for the compensation of very small errors. The same offset is found between τ θ E and τ θ S , although on a smaller magnitude. This indicates that there is a higher mechanical resistance in the operation of roll motion in relation to pitch motion. In any case, the assumption of these drawbacks does not seem to significantly affect the system response in Figures 17 and 22, since the system reaches the references effectively during the experiments. One more point to discuss is the periodic interruption in signal transmission due to the speed difference between microcontroller and computer processing. However, this data interruption is only perceived in the data displayed on the computer and does not represent a problem for the control system compiled in the microcontroller, since as observed in the scheme of Figure 9 it has its own feedback.
Finally, the .slx files with the Simulink block diagrams used in this section to carry out experiments can be found as application examples in the documentation folder for this prototype, which is accessible in [28].

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.