Keywords

1 Introduction

Quadrotor or quadcopter, known also as drone, has become one of the most attractive research topics. Mainly due to their ability to achieve autonomously multitude tasks, even in cluttered places. Recently, the use of this robot has been widened to cover new missions involving autonomous delivery, mapping and image acquisition [1]. Generally, quadrotor is an unstable flying robot suffering from the non-controllability in the lateral motions (x, y), its rotational and translational dynamics are under-actuated and strongly coupled [2]. Several stabilization approaches have been introduced to deal with these limitations. Among them, the PID controller has taken more attention, it has proven by many researchers especially in the practical implementation [3]. Additionally, nonlinear techniques such as sliding mode and backstepping controllers have been successfully proved in both simulations and experiments [4].

Recently, simulation platforms have been used in a great number of application domains such as, automotive systems, autonomous underwater robots and aerial applications [5]. There is a real need to visualize the quadrotor behavior in a virtual environment before performing physically the flight experimentation where the fail is forbidden. Herein we discuss the development of a quadrotor flight simulator based on a new approach that involves both the mechanical model and the flight controller. This simulator will be used as a virtual prototyping for drone model validation, it can be also adopted to simplify the challenging task when tuning the flight controller.

To scrutinize the contribution of this paper, we organize it as follows. In the second section, a general overview on the quadrotor system as well as the nonlinear dynamic model computation are discussed. The core of the flight simulator is presented in the third section. The simulator results are presented in section 5. Finally, the last section concludes the work and introduces some future directions of this study.

2 Quadrotor System

2.1 Quadrotor Description

Quadrotor is an aerial robot powered by four identical rotors arranged in a plus or cross configuration. It consists of two pair’s propeller-rotor, as shown in Fig. 1. The first pair (\(M_{1} ,\) \(M_{3}\)) spin in the counter clockwise direction, while the second pair (\(M_{2}\), \(M_{4}\)) rotates in the clockwise direction. This configuration makes the reactive force produced by each propeller-Rotor being cancelled.

Fig. 1
figure 1

Quadrotor configuration

Quadrotors are controlled by the thrust forces produced by four identical rotors. However, the rotation around x axes called roll motion can be achieved by inversely changing the speed of the pair (\(M_{2}\), \(M_{4}\)), also the pitch movement is obtained by creating an unbalance between the generated force by rotors \(M_{1}\) and \(M_{3}\). Yaw motion is screamed by changing the counter-torque between each pair propeller-rotor. The vertical flight is obtained by simultaneously varying the speed of all rotors.

2.2 Quadrotor Model

The obsession behind the quadrotor modeling studies is the design of a near-realistic model. This can be achieved using the Newton Euler methodology [6] or the Lagrange Euler formula. In this work, the quadrotor system is modeled using the Newtonian formalism, and the modeling phase is based on the following assumptions:

  • The quadrotor body frame and the propellers are rigid.

  • The quadrotor structure is symmetrical.

  • The thrust and drag forces are proportional to the square of the rotor speed.

The quadrotor translational and rotational equations of motions are as follows:

$$\left( {\begin{array}{*{20}c} {\ddot{x}} \\ {\ddot{y}} \\ {\ddot{z}} \\ {\ddot{\varphi }} \\ {\ddot{\theta }} \\ {\ddot{\psi }} \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {\frac{{U_{1} }}{m}U_{x} } \\ {\frac{{U_{1} }}{m}U_{y} } \\ {\frac{{U_{1} }}{m}\left( {cos\varphi \;cos\theta } \right) - g} \\ {\dot{\theta }\dot{\psi }\left( {\frac{{I_{y} - I_{z} }}{{I_{y} }}} \right) - \frac{{J_{r} }}{{I_{x} }}\dot{\theta }\varOmega + \frac{{U_{2} }}{{I_{x} }}} \\ {\dot{\varphi }\dot{\psi }\left( {\frac{{I_{z} - I_{x} }}{{I_{y} }}} \right) + \frac{{J_{r} }}{{I_{y} }}\dot{\varphi }\varOmega + \frac{{U_{3} }}{{I_{y} }}} \\ {\dot{\varphi }\dot{\theta }\left( {\frac{{I_{x} - I_{y} }}{{I_{z} }}} \right) + \frac{{U_{4} }}{{I_{z} }}} \\ \end{array} } \right)$$
(1)

With

$$\left\{ {\begin{array}{*{20}l} {U_{1} = b\left( {\omega_{1}^{2} + \omega_{2}^{2} + \omega_{3}^{2} + \omega_{4}^{2} } \right)} \hfill \\ {U_{2} = bl\left( {\omega_{4}^{2} - \omega_{2}^{2} } \right) } \hfill \\ {U_{3} = bl\left( {\omega_{3}^{2} - \omega_{1}^{2} } \right) } \hfill \\ {U_{4} = d\left( {\omega_{1}^{2} - \omega_{2}^{2} + \omega_{3}^{2} - \omega_{4}^{2} } \right) } \hfill \\ \end{array} } \right.$$
(2)
$$\left\{ {\begin{array}{*{20}l} {U_{x} = \cos \varphi \;\sin \theta \cos\uppsi + \sin \;\varphi \;\sin\uppsi} \hfill \\ {U_{y} = \cos \varphi \;\sin \theta \sin \;\uppsi - \sin \;\varphi \;cos\uppsi} \hfill \\ {\varOmega = \omega_{4} + \omega_{3} - \omega_{2} - \omega_{1} } \hfill \\ \end{array} } \right.$$
(3)

Where:

  • (x, y, z) and (φ, θ, ψ) denote the position and orientation coordinates.

  • \(I(I_{x}\), \(I_{y}\), \(I_{z}\)) is the diagonal matrix of inertia and \(m\) is the quadrotor total mass.

  • \(J_{r}\) is the rotor inertia, b and d symbolize the thrust and drag constant.

  • \(\omega_{i}\) and \(U_{i}\) are respectively the rotors speed and the input signals.

The vertical movement and the quadrotor orientation (φ, θ, ψ) are directly controlled by the control efforts \(U_{1} ,U_{2}\), \(U_{3}\) and \(U_{4}\). In contrast, the horizontal displacements (x, y) is indirectly controlled by selecting the appropriate roll and pitch angles.

Based on Eq. (3), the desired pitch and roll angles are calculated as:

$$\theta_{d} = \arctan \left( {\frac{{U_{x} \cos \left( \psi \right) + U_{{\mathcal{Y}}} \sin \left( \psi \right)}}{{U_{z} }}} \right);\varphi_{d} = { \arctan }\left( {\cos \left( {\theta_{d} } \right)\left( {\frac{{U_{x} \sin \left( \psi \right) - U_{y} \cos \left( \psi \right)}}{{U_{z} }}} \right)} \right)$$
(4)

With

$$U_{z} = \left( {\cos \left( \varphi \right)\cos \left( \theta \right)} \right) {{ U_{1} } \mathord{\left/ {\vphantom {{ U_{1} } m}} \right. \kern-0pt} m}$$
(5)

3 Proposed Flight Simulator

The quadrotor mechanical model is designed and validated using SolidWorks CAD. The design phase is done based on specifications listed in reference [7]. The designed components are imported to Simscape tools to generate the compatible file with MATLAB environment. Finally, the design of the control scheme is done using MATLAB/Simulink.

3.1 Quadrotor CAD-Models Design

The idea is to build each component of the quadrotor system in SolidWorks tools, this phase involves the 3D drawing, the visual appearance and the material specification. Next, the designed components must be correctly connected to shape the quadrotor assembly as shown in Fig. 2.

Fig. 2
figure 2

Quadrotor SolidWorks assembled CAD-models

Once the quadrotor model is properly designed, then correctly assembled and verified using the SolidWorks motion analysis. We use Simscape multibody link to generate the compatible files with MATLAB environment as illustrated in Fig. 3. The generated files involve the quadrotor mechanical model, the gravitational force and the system parameters (mass and inertial properties).

Fig. 3
figure 3

MATLAB simscape CAD-models

3.2 Control Strategy

The control strategy adopted in this work is a hierarchical controller having three loops, a full actuated inner loop that controls roll, pitch and yaw movements. An under actuated outer loop that controls the lateral position (x, y), and an altitude loop which controls the vertical flight. The PID controller is adopted for the control of the three loops using the configuration listed in Table 1. The synoptic scheme of the control strategy is shown in Fig. 4.

Table 1 Quadrotor flight controller parameters
Fig. 4
figure 4

Drone simulator structure

The near-optimal gains of the PID controller valid in our case, are selected based on empirical tests inspired by work [5], where a thoroughly description of the PID parameters is presented.

4 Simulator Environment

The main concept of the proposed flight simulator is illustrated in Fig. 4. However, the drone user defines the desired trajectory and then the control process begins. First, the position controller manages the quadrotor lateral behavior (x-y plane), and produces the desired roll and pitch angles which serve as a setpoint for the attitude controller Eq. (4). The altitude controller produces the sufficient thrust allowing the quadrotor to reach the desired z position. The controller’s outputs (\(U_{1} , U_{2} , U_{3}\) and \(U_{4}\)) are used to calculate the speed of each rotor based on the inverse transformation of Eq. (2). The propulsion system generates the needed forces to achieve the expected flight. The drone localization is obtained through six sensors, position (x, y, z) and orientation (φ, θ, ψ), added to mimic the role of the Inertial Measurement Unit (IMU).

5 Results and Discussions

Two different simulations were introduced to highlight the accuracy of the developed simulator. The fist, concerns the problem of stabilization, while the second simulation evaluates the ability of the quadrotor in path tracking missions.

Case 1: Hovering Mode

The simulation is carried out during 5 s which is sufficient to reach the desired altitude 1 m, with an initial configuration for the quadrotor attitude fixed at (0.2, 0.2, 0.2) rad.

As depicted in Fig. 5, the PID controller is able to push the quadrotor to achieve the desired altitude 1 m within less than 1 s. Also, the quadrotor orientation is maintained to zero rapidly. Furthermore, the offered simulator provides a 3D-visualization of the quadrotor motions. Figure 6 illustrates the Front, Top and Isometric views of the quadrotor system in the simulator environment when performing the hovering flight.

Fig. 5
figure 5

Drone-simulator attitude and altitude stabilization

Fig. 6
figure 6

Quadrotor views in MATLAB simscape interface

Case 2: Path Tracking

In order to check the trajectory tracking ability of the offered simulator, four flight tests have been performed. Figure 7 shows the 3D-representation of the real and the desired trajectories in the simulator environment using square trajectory (a), cross trajectory (b), Lemniscate trajectory (c) and circular trajectory (d).

Fig. 7
figure 7

Real and desired path for the square, cross, lemniscate and circular trajectory

As seen in the 3D-representation (Fig. 7), the quadrotor is well controlled and follows accurately the planned path. Even if the reference trajectory is suddenly changed, the quadrotor is able to accomplish the flight mission successfully. It should be mentioned that the adopted hierarchical methodology based on the PID controller has effectively controlled the quadrotor UAV in different flight tests.

6 Conclusion

In this paper, based on the quadrotor mechanical design a quadrotor simulator is developed. A hierarchical methodology based on the PID controller is adopted to solve the under-actuation and to steer the quadrotor behaviors in the simulator environment, contributing promising results in both stabilization and path following. The present simulator can be used as test platform to evaluate the quadrotor behaviors under several external conditions. It can be also used to configure the flight controller before moving on to the real time experimentation. In future work, robust adaptive controller will be used to enhance the flight ability in the presence of external perturbations.