Implementation Sim U Link
Implementation Sim U Link
Abstract— A quadrotor is a type of Unmanned Aerial Vehicle is a flow chart diagram explaining the approach taken to
(UAV) that is popular for its vast applications due to its small size implement the proportional integral and derivative (PID)
and maneuverability. UAVs fall under the category of drones. controller to successfully to achieve attitude and altitude control
Drones are unmanned aircrafts or ships guided by remote control on the quadrotor.
or on-board computers. They are high in demand because of their
deployment for surveillance, product delivery, aerial photography
and defence applications. Implementing a control system on a
quadrotor can be very challenging due to its nonlinear functioning.
Thus the motivation of this paper is to successfully implement the
PID algorithm on the plant to achieve altitude and attitude control.
This paper also compares a linearized plant system of the
quadrotor with that of a nonlinear plant system.
Quadrotors are a class of Unmanned Aerial Vehicles II. SCOPE OF THIS PAPER
(UAVs) which are small and offer great manoeuvrability. They The goal of this paper is to utilize existing work on the
are also classified as Vertical Take-Off and Landing (VTOL) mechanics and dynamics of quadrotors [5] [6] to successfully
vehicles. Quadrotors are built for several different purposes model and simulate a quadrotor in Simulink Matlab [7]. We will
encompassing carrying payloads and deliveries, surveillance, be ignoring some of the more complicated effects while
recreational purposes, photography, videography, and for modelling the quadrotor. These can be found in [8] Furthermore,
defence applications to name a few. While the structure of the this paper will begin with modelling and simulating a quadrotor
quadrotor changes according to its purpose, the general in 1-dimension and build to a 3-dimensional simulation to allow
structure remains the same. A quadrotor, aptly suggested by its for proper understanding on which the PID [9] algorithm will be
name, has 4 motors which are equidistant from its centre, which implemented to achieve attitude and altitude control in each
is where the centre of mass lies. They make use of the 4 motors case. Gain tuning will be discussed briefly for PD and PID
for take-off, landing and other kinds of manoeuvring in the air. models in each case. Furthermore, few graphs will be shown to
As estimated in a study by Goldman Sachs, the drone highlight the difference between a nonlinear plant and a
market is estimated to be worth $100 billion by the end of 2020, linearized one. Finally, desired outputs versus actual outputs will
with the defence sector being responsible for $70 billion, be looked at and the degree of success of the modelling and
consumer market being worth $17 billion and the commercial simulation will be determined.
and civil market being worth $13 billion. All major companies
are trying to automate their processes with robotics for
enhanced efficiency and accuracy. Quadrotors, being reliable,
are being used in numerous sectors. Further details on the
application and scope of the industry can be found in [1]. Below
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
III. 1-D MODELLING AND SIMULATION OF QUADCOPTER We will use the provided block and after tweaking the gain
coefficients a bit, the following results were the ones that lead
A. Mechanics and Quadrotor Dynamics
to an acceptable response.
For one dimensional analysis of the drone, we shall
investigate the altitude control such that the quadrotor is only D. System Response using PD and PID controllers
allowed to move in the Z direction. Furthermore, the drone will
be considered symmetrical around the centre of mass and the X
and Y axes. The equation of motion along the Z axis for a
quadrotor can be derived from the figure below.
TABLE I. PID GAINS OF SYSTEM ABOVE
Constants Gains
Kp 50
Ki 25
Kd 10
′′ = 1 − (1)
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
From the free body diagram in fig 7, one can derive the Finally, after implementing the PID controller on the plant
equations for y’’, z’’ and ɸ’’ in which U1 is the thrust input system we can observe the step responses.
and U2 is the moments input.
D. Gains and PID
′′= − 1 sin(ɸ) (3)
In the 2D system, there are 3 PID blocks to control the
error of all the 3 variables that are being worked with – z, y
′′ = − + 1 cos(ɸ) (4) and ɸ. The aim will be to control z and y and let ɸ vary
independently to provide the desired y output since y and ɸ
ɸ′′ = 2
(5) are dependent on each other. Another important thing to take
care of in nested PID loops is that the internal loop should
−sin(ɸ)
0 always have higher gains than the external ones to provide
′′ 0 effective responsiveness. Below are the gains for the PID
cos(ɸ) 1
′′ = − + 0 (6) loops.
2
ɸ′′ 0 1
0
TABLE II. PID GAINS OF SYSTEM ABOVE
Extending (3), (4) and (5) : ɸ y z
2 Kp 100 45 40
= ′′ = − 1 sin ɸ (7) Ki 0 20 30
2 Kd 100 10 15
2
= ′′ = − + 1 cos ɸ (8)
2 E. System Response of Linear and Nonlinear Systems
2ɸ
For the simulation described above, the system responses
= ɸ′′ = 2 (9) are shown. Below are the system responses for the altitude
2
control of the linear system.
B. Linearization
In the situation of the quadrotor hovering, the angle ɸ
changes nominally. Hence one can linearize the above
equations by applying the small angle approximations:
2
= ′′ = − ɸ (10)
22
= ′′ = − + 1
(11)
2
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
Now one can look at the moments acting on the quadrotor (Mb)
i = 1 2Ω 2
i (15)
2
i =1 2Ω 2
i (16)
2
Where:
ρ = Air Density
Ct, Cd = Coefficients
The step response of y is almost identical in both the Ωi = Angular Velocity of motor
nonlinear and linear implementation and for the sake of
brevity is not included here. Equations (15) and (16) can be written as
ƒ ɸ ƒ ɸ ƒ+ ɸ ƒ
= ƒ ɸ ƒ+ ɸ ƒ ɸ ƒ− ƒ (12)
− ɸ ɸ Fig. 11. Forces and Moments acting on the Quadrotor
c is the shorthand for cosine and s is the shorthand for sine here. Now calculating the moment about the X,Y and Z axes from
The rotational equation of motion can be written as follows Fig.13
= ′ + + (13) = ( 4 − 2) = ƒ (Ω4
2 − Ω2 2 ) (19)
= ( − )= (Ω 2 −Ω 2) (20)
1 3 ƒ 1 3
Where: = 1- 2+ 3 - 4 =
J = Inertial Matrix which because of the symmetry around the (Ω12 − Ω22 + Ω32 − Ω42 ) (21)
centre is Combining (19), (20), and (21)
Ixx 0 0
ƒ (Ω4 − Ω2 2 )
2
0 Iyy 0
Mb = ƒ (Ω1 − Ω3 )
2 2 (22)
0 0 Izz
(Ω12 − Ω22 + Ω32 − Ω42 )
ω = Angular Rates of Velocity
The translational motion of equation take the general form:
Mg = [0 0 JrΩr]T = Gyroscopic moments (14)
0
Ωr = Relative motor speed. ′′ = 0 + (23)
Mb = Moments acting on the body frame
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
Fb represents all the non-gravitational forces acting in the body These provide the rotational equations. The translational
frame and is given by equations can be derived from expanding (23) and using (12),
0 0 ƒ ɸ ƒ ɸ ƒ+ ɸ ƒ 0
= 0 + ƒ ɸ ƒ+ ɸ ƒ ɸ ƒ− ƒ 0
Fb = 0 (24) − ɸ ɸ − 1
- ƒ (Ω1
2 + Ω2 2 + Ω3 2 + Ω 4 2 ) Expanding and rewriting,
U2 = ƒ (Ω4
2 − Ω2 2 ) (27) C. Simulink Implementation
U3 = ƒ (Ω1
2 − Ω3 2 ) (28) The parameters used for the simulation are listed below.
Parameter Value Unit
U4 = (Ω12 − Ω22 + Ω32 − Ω42 ) (29)
L 0.24 m
From equations (26) to (29), a coefficient matrix can be formed M 1 kg
g 9.81 m/s2
ƒ ƒ ƒ ƒ Ω12 Ixx 0.01 kg m2
1
0 − ƒ 0 Ω22 Iyy 0.01 kg m2
2 ƒ
= (30) Izz 0.02 kg m2
3 ƒ 0 − ƒ 0 Ω32 -6
Kf 1.87 x 10 -
4 − − Ω42 Km 1.87 x 10-6 -
Equation (30) can be rearranged so that the coefficient matrix Equations (32), (33), and (34) will be implemented to
achieve the roll pitch and yaw accelerations which in turn will
for motor speeds can be found from control vector U. provide the roll, pitch and yaw angles.
Ω 12 1/4Kf 0 1/2Kf 1/4Km U1
ɸ′′ = 1 ( 2 − 4Ω +( − ) 4 6) (32)
′′ = 1
( 3 − 2Ω +( − ) 2 6) (33) Fig. 12. Implementation to get roll acceleration, ɸ’’.
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
Fig. 14. Implementation to get relative motor speed, Ωr from control inputs,
Ui.
Now one can connect these subsystems with each other so
that the behaviour of the drone i.e., the plant system, is now
entirely modelled. Once the plant system is ready, the PID
control system will be implemented on the plant to achieve
altitude and attitude control. The gains used are mentioned in
the next section.
Fig. 15. Step response of roll angle, ɸ Fig. 19. Step response of Z in non-linear case
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Computer Communication and Informatics (ICCCI -2021), Jan. 27 – 29, 2021, Coimbatore, INDIA
It is observed that attitude control implementations are Lastly, motion planning and environment tracking remain areas
identical in both the linear and nonlinear models. However, that need to be explored further for nuanced control of the drone
altitude control has a huge difference and so the small angle in its surrounding environment.
approximation is not one that is appropriate here. Further
methods or techniques must be looked into to provide a REFERENCES
smoother and more robust altitude controller for the 3D
nonlinear plant system. The results from the simulation are
tabulated below. [1] L. Camilli, “Emerging technologies, applications, regulations, and market
challenges in the consumer aerial drone industry,” Technical Report, San
TABLE IV. RESULTS OF SIMULATIONS Francisco State University College of Business, 2015.
Attribute Settling Rise Time Peak [2] O. M. Hamdy, and A. O. El-Nady, “Modeling, Simulation and Control of
Time (ms) (ms) Overshoot (%) Quadcopter using PID controller,” 4th International under-Graduate
Research Conference, IUGRC 2019, Cairo, 2019.
Nonlinear 413.0 179.7 14.2 [3] A. T. Bayisa, “Controlling Quadcopter Altitude using PID-Control
System,” in International Journal of Engineering Research & Technology
Altitude (IJERT), Vol 8, pp. 195-199, 2019.
Linear Altitude 214.9 35.8 13.0 [4] Q. Huang, “Mathematical Modeling of Quadcopter Dynamics,” Report,
Rose Human Institute of Technology, 30 May 2016.
Roll 195.7 52.5 12.1
[5] “MathWorks,” [Online]. Available: www.mathworks.com [Accessed
Pitch 837.2 9.3 30.2 May 2020]
[6] University of Pennsylvania, “Robotics: Aerial Robotics,” Coursera,
Yaw 499.5 18.8 21.7 [Online]. Available: https://www.coursera.org/learn/robotics-
flight?specialization=robotics. [Accessed June 2020].
[7] V. Desh, “MATLAB & Simulink Tutorial: Quadrotor UAV Trajectory
VI. CONCLUSION AND FUTURE RESEARCH and Control Design (PID + Cascaded),” YouTube, [Online]. Available:
https://www.youtube.com/channel/UCRaiKJHsh_Ii4H-86uqXT_g.
As seen, one can quite accurately simulate the behavior of a [Accessed July 2020]
quadrotor discounting a few effects that would unnecessarily [8] T. Lukkonen, “Modelling and Control of quadcopter,” Thesis, Aalto
complicate the physics. While the simulations are fairly University - School of Science, 22 August 2011.
accurate and the PID algorithm is good enough to elicit the [9] A. Zulu, and S. John “A Review of Control Algorithms for Autonomous
desired response from the drone, this only provides us with a Quadrotors,” Open Journal of Applied Sciences, pp. 547-556, 2014.
starting point while building and testing a drone. Furthermore, [10] J. Anand, "Automatic Traffic Control Technologies for Remote
the nonlinear altitude control needs to be improved. It would Monitoring of Unmanned Railway Gates," Journal of Electronics, pp. 30-
37, 2020.
require a lot of further tweaking of the gains as the physics that
[11] E. Kamel, and K. Kamel, "PLC Batch Process Control Design and
has been used for the simulation involve approximations. Implementation Fundamentals," Journal of Electronics, pp. 155-161,
Upcoming research will be based on the different optimization 2020.
tools to precisely predict the gain values such as reinforced
learning, genetic algorithms, and swarm optimization etc.
Authorized licensed use limited to: BOURNEMOUTH UNIVERSITY. Downloaded on June 26,2021 at 18:51:30 UTC from IEEE Xplore. Restrictions apply.