0% found this document useful (0 votes)
58 views60 pages

199938995

This master's thesis by Saba Mulualem Walle focuses on the dynamic modeling and trajectory tracking control of a hexacopter using a sliding mode controller. The study formulates a nonlinear dynamic model of the hexacopter and designs a controller to stabilize its motion in six coordinates, achieving effective trajectory tracking with minimal error. Simulation results demonstrate the controller's capability to follow the reference trajectory within an average of 0.5 seconds after the simulation starts.

Uploaded by

nugget mstr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views60 pages

199938995

This master's thesis by Saba Mulualem Walle focuses on the dynamic modeling and trajectory tracking control of a hexacopter using a sliding mode controller. The study formulates a nonlinear dynamic model of the hexacopter and designs a controller to stabilize its motion in six coordinates, achieving effective trajectory tracking with minimal error. Simulation results demonstrate the controller's capability to follow the reference trajectory within an average of 0.5 seconds after the simulation starts.

Uploaded by

nugget mstr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

DYNAMIC MODELING AND TRAJECTORY TRACKING

CONTROL OF HEXACOPTER USING SLIDING MODE

CONTROLLER

A MASTER’S THESIS

BY

SABA MULUALEM WALLE

DEPARTMENT OF ELECTRICAL AND COMPUTER

ENGINEERING

ADDIS ABABA SCIENCE AND TECHNOLOGY UNIVERSITY

JANUARY 2019
DYNAMIC MODELING AND TRAJECTORY TRACKING CONTROL OF

HEXACOPTER USING SLIDING MODE CONTROLLER

BY

SABA MULUALEM WALLE

A Thesis Submitted to

The Department of Electrical and Computer Engineering for the Partial Fulfillment of the

Requirements for the Degree of Master of Science in Electrical and Computer Engineering

(Control and Instrumentation Engineering)

to

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

ADDIS ABABA SCIENCE AND TECHNOLOGY UNIVERSITY

JANUARY 2019
Declaration
I, the undersigned, declare that this thesis work entitled “Dynamic Modeling and Trajectory
Tracking Control of Hexacopter Using Sliding Mode Controller” was developed and written
by myself with the help of my advisor. The sources have not been used without the declaration in
the work. The Master thesis contained herein is my own except where explicitly stated otherwise
in the text and this work has not been submitted in the similar version to achieve any other
academic degree or processional qualification.

Name: Signature, Date:


Saba Mulualem Walle _________________

Witnessed by:

Name of student advisor; Signature, Date:

Prof. Venkata Mayol L.N.K

Name of student co-advisor Signature, Date:

Mr. Beza Nekatibeb ______________


Certificate
This is to certify that the thesis prepared by Ms. Saba Mulualem Walle entitled “Dynamic
Modeling and Trajectory Tracking Control of Hexacopter Using Sliding Mode Controller”.
In addition, submitted in the fulfillment of the requirements for the Degree of Master of Science
complies with the regulations of the University and meets the accepted standards with respect to
originality and quality.

Singed by Examining Board:


External Examiner: Signature, Date:

Dr. Fisseha ______________ ___________

Internal Examiner: Signature, Date:

Mr. Mulugeta Debebe ______________ ___________

Chairperson: Signature, Date:

Dr. Asrat Mulatu ______________ ___________

DGC Chairperson: Signature, Date:

_____________________ ______________ ___________

Collage Dean/Associate Dean for GP Signature, Date:

_____________________ ______________ ___________


Abstract
This thesis presents dynamic modelling and design of controller for improving trajectory tracking
of Hexacopter. Hexacopter is currently a popular unmanned aerial vehicle (UAV); it is used in
versatile activities like security, aerial filming, fire-fighting, pesticide spraying and delivery of
goods.

In this work, the nonlinear dynamic modeling of Hexacopter is formulated by using Newton Euler
modeling equations. Hexacopter is a six degree of freedom aerial robot in which it has three
translational (x, y and z) and three rotational (ϕ, θ and ψ) components. It has a highly nonlinear,
unstable and coupled dynamics. It is an under actuated system in which there are four control
inputs and six outputs. After modeling the dynamics of the system sliding mode controller (SMC)
is designed to control the motion in six-coordinates of Hexacopter in space; implemented for
stabilization of internal dynamics and external dynamics. Besides, the reference trajectory is
generated and track this trajectory by implementing SMC controller with minimum possible error.

Finally, the thesis presents simulation results for controller action and trajectory tracking by
employing MATLAB Simulink. The results shows that the controller follows the reference, in all
the coordinates, with in an average of 0.5 seconds after simulation starts.

Keywords: Hexacopter, Unmanned Aerial Vehicle (UAV), Sliding Mode Control (SMC)

i
Acknowledgments
First, I would like to thank Addis Ababa Science and Technology University as well as Electrical
and Mechanical Engineering College for giving me the opportunity to undertake this Master
program in Control and Instrumentation Engineering stream.

It is a privilege and honor to express my sincere gratitude to my advisor Prof. Venkata Mayol
L.N.K for all his kind help, guidance, suggestions and support through the whole work of this
research paper. I would also like to express my sincere thanks to my co-advisor Mr. Beza
Nekatibebe for all his guidance and support in completion of this thesis. I would also like to thank
my classmate Mr. Biruk Tadesse for his assistance and encouragement from the beginning up to
the end of this work.

Last, but not list, I give special thanks to all Electrical and Computer Engineering Department
administrative and teaching staffs at Addis Ababa Science and Technology University.

ii
Table of Contents
Abstract .......................................................................................................................................................... i
Acknowledgments......................................................................................................................................... ii
List of Tables ................................................................................................................................................ v
List of Figures ............................................................................................................................................... v
List of Acronyms ......................................................................................................................................... vi
List of Symbols ............................................................................................................................................ vi
Chapter One .................................................................................................................................................. 1
Introduction ................................................................................................................................................... 1
1.1. Background ................................................................................................................................... 1
1.1.1. Classification of unmanned aerial vehicle (UAV) ................................................................ 1
1.1.2. Applications of UAVs ........................................................................................................... 3
1.2. Statement of the problem .............................................................................................................. 3
1.3. Objective ....................................................................................................................................... 4
1.3.1. General objective .................................................................................................................. 4
1.3.2. Specific objectives ................................................................................................................ 4
1.4. Methodology ................................................................................................................................. 4
1.5. Limitations .................................................................................................................................... 5
1.6. Thesis outline ................................................................................................................................ 5
Chapter Two.................................................................................................................................................. 6
Theoretical background and literature review............................................................................................... 6
2.1. Hexacopter .................................................................................................................................... 6
2.1.1. Basic movements .................................................................................................................. 6
2.2. Literature Review.......................................................................................................................... 8
Chapter Three.............................................................................................................................................. 10
System modeling and Controller design ..................................................................................................... 10
3.1. Kinematic modeling .................................................................................................................... 10
3.2. Dynamic modeling of Hexacopter .............................................................................................. 13
3.2.1. Translational Dynamics ...................................................................................................... 14
3.2.2. Rotational dynamics ............................................................................................................ 15
3.2.3. Applied forces on the Hexacopter ....................................................................................... 15
3.2.4. Applied torques ................................................................................................................... 16
3.3. Final system modeling ................................................................................................................ 18

iii
3.3.1. Control input vector 𝑈 ........................................................................................................ 18
3.3.2. Translational equation of motion ........................................................................................ 20
3.3.3. Rotational equation of motion............................................................................................. 20
3.3.4. State space representation ................................................................................................... 21
3.4. Dynamic system model verification ........................................................................................... 23
3.5. Controller design ......................................................................................................................... 26
3.5.1. Block diagram for controlling system ................................................................................. 27
3.6. Sliding mode controller: the general principle ............................................................................ 28
3.7. SMC in Hexacopter..................................................................................................................... 30
3.7.1. Altitude controller ............................................................................................................... 30
3.7.2. Roll controller ..................................................................................................................... 31
3.7.3. Pitch controller .................................................................................................................... 32
3.7.4. Yaw controller..................................................................................................................... 33
3.7.5. Linear X motion controller ................................................................................................. 34
3.7.6. Linear y motion controller .................................................................................................. 35
Chapter Four ............................................................................................................................................... 36
Simulation results and analysis ................................................................................................................... 36
4.1. Desired trajectory ........................................................................................................................ 36
4.2. Closed loop simulations .............................................................................................................. 36
4.2.1. Z Altitude tracking .............................................................................................................. 36
4.2.2. X position tracking .............................................................................................................. 37
4.2.3. Y position tracking .............................................................................................................. 38
4.2.4. Psi tracking.......................................................................................................................... 39
4.2.5. Attitude phi and theta tracking ............................................................................................ 39
4.2.6. Control inputs response ....................................................................................................... 41
4.2.7. Tracking response with disturbance .................................................................................... 42
Chapter Five ................................................................................................................................................ 46
Conclusions and Recommendations ........................................................................................................... 46
5.1. Conclusions ................................................................................................................................. 46
5.2. Recommendations ....................................................................................................................... 46
References ................................................................................................................................................... 47
Appendix ..................................................................................................................................................... 49

iv
List of Tables
Table 1: Methodology ................................................................................................................................. 4
Table 2: The values for parameters used in the simulation ........................................................................ 23
Table 3: Numerical values for constant 𝜆𝑖 and 𝐾𝑖 ..................................................................................... 36

List of Figures
Figure 2.1: Roll Movement of Hexacopter .................................................................................................. 7
Figure 2.2: Pitch Movement of Hexacopter ................................................................................................. 7
Figure 2.3: Yaw Movement of Hexacopter ................................................................................................. 8
Figure 3.1: The two frames of references .................................................................................................. 10
Figure 3.2: Hexacopter rotor distance from center of gravity .................................................................... 17
Figure 3.3: Simulink block diagram of the open loop uncontrolled model ............................................... 24
Figure 3.4: Simulation result of open loop uncontrolled model with 𝑤1 = 𝑤2 = 𝑤3 = 𝑤4 = 𝑤5 = 𝑤6 =
300𝑟𝑝𝑚 (a) translational components and (b) rotational components ................................... 25
Figure 3.5: Open loop uncontrolled simulation result with(𝑤1 = 𝑤2 = 𝑤3 = 𝑤4 = 𝑤5 = 𝑤6 =
0𝑟𝑝𝑚…………………………..…………………………………………………………..26
Figure 3.6: General block diagram of controlling system ......................................................................... 27
Figure 3.7: Graphical demonstration of SMC............................................................................................ 30
Figure 4.1: a) reference tracking and (b) tracking error responses for the altitude .................................... 37
Figure 4.2: (a) trajectory tracking and (b) tracking error response of the x position simulation ............... 38
Figure 4.3: (a) trajectory tracking (b) error response of y position ........................................................... 39
Figure 4.4: (a) output tracking response of psi (b) error of the response of psi ......................................... 39
Figure 4.5: (a) tracking response of phi (b) tracking error of phi .............................................................. 40
Figure 4.6: (a) tracking response of theta (b) tracking error of theta ......................................................... 41
Figure 4.7: SMC control inputs simulation response ................................................................................. 42
Figure 4.8: (a) z tracking response with disturbance (b) tracking error.......................................…...43
Figure 4.9: (a) x position tracking response with disturbance (b) tracking error………………………...43
Figure 4.10: (a) y position tracking response with disturbance (b) tracking error…………………….....44
Figure 4.11: (a) psi tracking response with disturbance (b) tracking error……………………………....45

v
List of Acronyms
DOF Degree Of Freedom

UAV Unmanned Aerial Vehicle

LQR Linear Quadratic Regulator

PD Proportional Derivative

PID Proportional Integral Derivative

SMC Sliding Mode Control

MPC Model Predictive Control

List of Symbols
𝐽𝑥𝑥 Area moment of inertia about x-axis

𝐽𝑦𝑦 Area moment of inertia about y-axis

𝐽𝑧𝑧 Area moment of inertia about z-axis

𝐽𝑟 Rotor inertia

𝑈 Control input vector

𝜙 Roll angle about x-axis

𝜃 Pitch angle about y-axis

𝜓 Yaw angle about z-axis

vi
Chapter One
Introduction
This thesis work involves a simulation study of the dynamic modelling and reference-tracking
control of Hexacopter UAV, which is a multirotor with six rotors. These rotors are symmetrical
and fixed, and they controlled by varying the angular speed of those rotors to change the thrust
and torque.

This chapter introduces the background, statement of the problem, objective and methodology of
the thesis .

1.1. Background

An Aircraft is a vehicle, which is capable of flying. Depending on how they can be controlled,
aircrafts can be classified as manned aerial vehicles and unmanned aerial vehicles. Manned aerial
vehicles are vehicles with onboard pilots whereas unmanned aerial vehicles are one type, which
can fly without a human operator but need aerodynamic force to fly on air. They may either be
controlled remotely by humans or can be controlled autonomously by using onboard computer that
is programmed to do a task [1].

1.1.1. Classification of unmanned aerial vehicle (UAV)


UAVs can be classified based on different factors such as depending on range of action and
function of their configuration [1, 2].

1. Based on range of action

UAVs can classified into seven different part depending on their range of altitude and endurance
as follows [2]:

(A). High-Altitude Long-Endurance (HALE): These types of UAVs are capable of flying
altitude over 15000 m and have endurance of more than 24hrs. They are important in performing
long-range reconnaissance and surveillance mission.

1
(B). Medium-Altitude Long-Endurance (MALE): These types of UAVs are capable of flying
altitude between 5000m-15000m and have endurance of maximum 24hrs. These are important for
surveillance mission the same as HALE.

(C). Medium Range or Tactical UAV (TUAV): these are capable of flying altitude between 100
and 300 km.

(D). Close-Range UAV: They operate in range of 100km. they are important in target designation,
airfield security, crop spraying, power line inspection and traffic monitoring etc.

(E). Mini UAV (MUAV): They operate in the range of about 30km and have weight of 20kg.

(F). Micro UAV (MAV): They have wingspan of maximum 150mm. They are required to fly
slowly and hover.

(G). Nano Air Vehicle (NAV): They have a size of 10mm. They are used for radar confusion and
for ultra-short range surveillance.

2. Based on their configuration


Depending on the aerodynamic configuration, UAVs can be classified as follows [2, 3]:
(A). Fixed wing UAVs: These are UAVs which need a run-away for take off and landing. They
have advantage of high cruising speed and long flying time. They can be used for long distance,
long range and high altitude missions and perform scientific applications like metrological
reconnaissance and environmental monitoring.

(B). Rotary wing UAVs: This type of UAVs can vertically take off and land in a small place
without requiring a run away. They have a great advantage than the fixed wing in terms of
maneuverability capabilities and hovering at a specified place. They in turn can classified as
follows [1]:

(i). Single rotors: These UAVs have one main rotor on top and another rotor at the tail for stability
which is the same as the helicopter configuration.

(ii). Coaxial rotors: This type have two rotors mounted to the same shaft which are rotating in
opposite direction.

(iii). Quadrotor: This type have four rotors that are found in the corners of a cross.

2
(iv). Multirotors: These are UAVs having six or eight rotors. They are advantageous in that they
can fly without a crash if one rotor fails and have a high lifting capacity that can make it to move
quickly and easily [4].

1.1.2. Applications of UAVs


UAVs have the ability to replace humans and become advantageous. UAVs have many
applications in the military sectors such as to observe a region and locate an enemy, to ascertain a
strategic feature, to attack a mission and to do a border surveillance. However, they are also
important in nonmilitary civil applications such as for forecasting a metrology, for security
surveillance and inspection of power lines, for monitoring a traffic and for performing a mission
such as taking photo and videos, in places where there is high human risk. Moreover, they are
advantageous in commercial aerial surveillance, mineral exploration and production, and
transportation of goods [3, 4].

Furthermore, UAVs have an application in earth science for cloud and Aerosol measurement, for
studying global warming in measuring ice thickness and for measuring gravitational acceleration.
They are also used in law enforcement and in industrial applications for pipeline inspection [1].
The rotorcraft UAV we study in this work is Hexacopter which is a multirotor rotorcraft lifted with
six rotors.

1.2. Statement of the problem


Hexacopter is a highly nonlinear, unstable and multi input multi output system. Moreover, it is
under actuated system with four inputs and six outputs, which are coupled each other, makes the
controlling more challenging. Mostly the previous works on Hexacopter were done by using linear
controllers like PID, LQR-PID, LQR-PD controllers to make the system stable. However, using
these linear controllers need a linearized model and they will be linearized at hovering position.
Then the Hexacopter cannot follow the path when it is out of hover [1]. In addition to these, the
Hexacopter system has highly affected by disturbances like wind. For this reason, formulation of
a robust method is a nonlinear controller sliding mode control (SMC), will give a good
performance for tracking the path, good in disturbance rejection and increase the stability.
Therefore, in this work sliding mode control (SMC) will be used for trajectory tracking control of
a Hexacopter.

3
1.3. Objective
1.3.1. General objective
The general objective of this work is to design a mathematical model and trajectory tracking
control of a Hexacopter using sliding mode control (SMC).

1.3.2. Specific objectives


 Mathematically model the dynamics of the Hexacopter
 Design the SMC controller
 Generating trajectory and Simulating the trajectory tracking using MATLAB Simulink
 Validate the results

1.4. Methodology

The methodology followed in this thesis work is described in tabular form in Table 1.

Table 1: Methodology

Methodology Task
Literature review Summarizing existing works published on the
topic that are published in books, journals and
articles
Modeling the system Designing a mathematical relation of dynamics
of a Hexacopter
Designing a controller Formulating proper controller that control the
system model
Simulation Simulating the open loop system dynamics and
closed loop controlling system using MATLAB
Simulink
Analysis and interpretation Analyzing and interpreting the result of
simulation

4
1.5. Limitations
The scope of this thesis is limited to modeling and controlling the system and designing the system
using a MATLAB simulation only. The hardware work is not done on this thesis because of lack
of financial and material.

1.6. Thesis outline


This thesis is structured in five chapters as follows:

 Chapter Two deals with the over view of Hexacopter and review of works done before
about the title.
 Chapter Three discusses about terminologies used for modeling, presents the model that is
formulated using Newton Euler formalism and shows the verification of the model. It also
includes the development of the controller that makes the system to track the trajectory
effectively.
 Chapter Four focuses on the simulation of the system using MATLAB Simulink
simulations and analyze the result.
 Chapter Five finalizes by concluding the work and suggesting a recommendation.

5
Chapter Two
Theoretical background and literature review
This chapter deals about the theoretical background about haxacopter and the related works done
about the topic.

2.1. Hexacopter

In this paper work, the multirotor that is studied is a Hexacopter. It is a rotorcraft type UAV, which
has six rotors in the vertices of a regular hexagon. These rotors are connected symmetrically to the
central hub. Three of the propellers rotate in the same direction (clockwise) and the other three
propellers rotate in opposite direction (counter clockwise) to balance the total system torque. When
all the propellers rotate in the same direction the body will start rotating in opposite direction
because of the torque created by rotors. So to remove this problem there must be anti-torque and
the rotors must rotate in opposite direction.

Hexacopter is an under actuated system because it has six degree of freedom (DOF) but has four
control inputs, the trust force and the aerodynamic torques. The six DOF is because six variables
𝑥, 𝑦, 𝑧, 𝜙, 𝜃, 𝜓, which are the translational and rotational components, are used to express its
position in space. The translational variables 𝑥, 𝑦 and 𝑧 express the distance of the Hexacopter
center of mass with respect to x, y and z axes whereas the rotational variables 𝜙, 𝜃, 𝜓 are the Euler
angles that tells the orientation of the Hexacopter. 𝜙 is the roll angle through the x axis, 𝜃 is the
pitch angle through the y axis and 𝜓 is the yaw angle along the z axis [5].

Hexacopter is controlled by using its propellers. Each of the six propellers produces an upward
thrust force by pressing the air down and with the same time, they will generate a vertical
movement. Whereas, in order to generate a down ward movement the speed of all the propellers
must be decrease.

2.1.1. Basic movements


There are three basic movements in a Hexacopter such as roll, pitch and yaw.

6
2.1.1.1. Roll
Roll movement is the movement of the Hexacopter about the x-axis. As shown in Figure 2.1, it is
performed by increasing/decreasing the speed of rotors 4, 5 and 6 and decreasing/increasing the
speed of rotors 1, 2 and 3. Then the total thrust will remained constant and the roll rotation can be
achieved by rotating around the x-axis.

Figure 1.1: Roll Movement of Hexacopter [9]

2.1.1.2. Pitch
Pitch movement is the movement of the Hexacopter about the y-axis. It is performed through the
increasing/decreasing the speed of rotors 1 and 6 and decreasing /increasing of speed of rotors 3
and 4 as shown in Figure 3. Then the total thrust will remain constant and the pitch rotation can be
achieved by rotating around the y-axis.

Figure 2.2: Pitch Movement of Hexacopter [9]

7
2.1.1.3. Yaw
Yaw movement is the movement of the Hexacopter about the z-axis or flying straight up ward. As
described in Figure 4, it is performed by increasing/decreasing the angular speed of rotors rotating
clockwise (1, 3, 5) and decreasing/increasing the angular speed of rotors rotating counter clockwise
(2, 4, 6). Then the total thrust will remain unchanged and this makes the Hexacopter stable.

Figure 2.3: Yaw Movement of Hexacopter [9]

2.2. Literature Review

Recently multirotors have become an interesting field of research in which different papers have
analyzed different aspects of Hexarotor including modeling of a rigid body, controlling and
simulation of it.

Moussed, Sayouti, Medromi [5]; have analyzed on modeling of the Hexarotor using Newton Euler
formalism for rotational and translational equation of motion. Proportional integral derivative
(PID), Backstepping and Sliding mode controllers (SMC) have been applied for controlling the
attitude, altitude and heading of a Hexarotor UAV system in space. The performance of these
controllers were compared and they show that SMC and Backstepping controllers are good in
stabilizing the system with great dynamic performance and are robust whereas PID is not adequate
to stabilize the system and eliminate the disturbance. They recommended developing a hybrid
controller such as integral action with a Backstepping controller and applying it on a real Hexarotor
hardware.

A.Alaimo. etal, [6]; have used Newton Euler formalism in terms of quaternion for modeling
Hexacopter in order to improve the numerical efficiency and stability of the controller algorithm.

8
Six PID were used as a controller for system trajectory tracking but to apply the controller
quaternion error is used instead of classical linearization using Lyapunov approach.

A.Alaimo. et el. [7]; design the modeling of the Hexacopter dynamics using Newton Euler
formalism. They control the Hexacopter dynamics using optimal control algorithms that are linear
quadratic regulator (LQR) using PD and PID controllers to make the system more stable by
linearizing the system around hovering configuration. The result has been tested by comparing the
impulse disturbance response of the nonlinear dynamical system with the response of the linearized
model. The result show that the system has stabilized at hovering position.

Geovanny D.C.G. et el. [8]; design the model of the system using Newton Euler formalism for the
translational and rotational component dynamics. In their work sliding mode controller has been
used as a controller for making the system stable. The chosen SMC algorism was implemented by
applying Proportional derivative (PD) controller as sliding surface. A control strategy such as PID
and SMC has been tested and compared to control the system can take off and land with the
involvement of a disturbance. SMC shows a better performance in stability and have a satisfactory
output in spite of nonlinearity in different operating conditions. In comparison with PID controller,
SMC is more robust, having less steady state error and have less oscillation.

Tobias Magnusson [9]; wrote a thesis on Hexarotor by modelling the system using Newton Euler
formalism based quaternion presentation to eliminate a singularity on system. Model predictive
control is used as a controller to make the system stable and compare the result with a linear
quadratic controller. Their results shows that MPC has a great tracking ability through the
reference trajectory than linear quadratic.

In sum, most of the studies in the literature reviewed above have focused on stability and
controlling the altitude. However, in this work a nonlinear controller SMC is used for controlling
the whole system altitude, attitude, heading and position of the Hexarotor in tracking a specific
reference. For a highly nonlinear, coupled and unstable Hexarotor system, SMC has better result
for making the system more stable, to get a better tracking response with a minimum error and fast
convergence.

9
Chapter Three

System modeling and Controller design

In this chapter, the kinematic and dynamic model of the Hexacopter and the control design for
the Hexacopter system will be discussed.

3.1. Kinematic modeling

Kinematics is a branch of mechanics that focus on the motion of objects without the reference to
the cause of the motion. To express it there are two frames of references in a rigid motion: body
fixed frame and earth inertial frame of reference. In inertial frame, the absolute linear position of
the body is expressed as 𝑋𝐸, 𝑌𝐸 𝑎𝑛𝑑 𝑍𝐸 . Whereas the body fixed frame (𝑋𝐵 , 𝑌𝐵 𝑎𝑛𝑑 𝑍𝐵 ) which
center at center of gravity of Hexacopter. The orientation of the body fixed frame can be expressed
by Euler angle as roll (ϕ), pitch (θ) and yaw (ψ) expressing rotation about x, y and z axes
respectively.

Figure 3.1: The two frames of references [9]

The body-fixed frame’s position in the earth-fixed frame can be described by using the vector 𝜉 =
[𝑥 𝑦 𝑧]𝑇 and its orientation, attitude and heading by the vector 𝜂 = [𝜙 𝜃 𝜓]𝑇 where the angles
𝜙, 𝜃 𝑎𝑛𝑑 𝜓 are called the roll, pitch and yaw respectively. To bring the body-fixed frame into
coincidences with the earth-fixed frame the following rotations are considered.

10
To describe the rotation from body to earth frame first rotate the z- axis by yaw angle 𝜓 and
subsequently rotate the new frame about y- axis by pitch angle θ then rotate the new frame about
x-axis by roll angle ϕ.

Rotation about the earth fixed frame z-axis about a yaw angle 𝜓 and forming the new frame A

𝑐𝑜𝑠𝜓 𝑠𝑖𝑛𝜓 0
𝑅(𝜓) = [−𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜓 0] (3.1)
0 0 1

Then resulting new frame A is rotated about y-axis by pitch angle θ to form a new frame A’ which
is expressed by

𝑐𝑜𝑠𝜃 0 −𝑠𝑖𝑛𝜃
𝑅(𝜃) = [ 0 1 0 ] (3.2)
𝑠𝑖𝑛𝜃 0 𝑐𝑜𝑠𝜃

Then lastly rotation of new frame A’ about x-axis by roll angle ϕ which result in the body frame.
This rotation is given by

1 0 0
𝑅(𝜙) = |0 𝑐𝑜𝑠𝜙 𝑠𝑖𝑛𝜙 | (3.3)
0 −𝑠𝑖𝑛𝜙 𝑐𝑜𝑠𝜙

Finally, the rotation matrix to transform earth frame to body frame will become the multiplication
of the above rotations matrixes given by

𝑅𝐵𝐸 = 𝑅(𝜓)𝑅(𝜃)𝑅(𝜙)

1 0 0 𝑐𝑜𝑠𝜃 0 −𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓 𝑠𝑖𝑛𝜓 0


= [0 𝑐𝑜𝑠𝜙 𝑠𝑖𝑛𝜙 ] [ 0 1 0 ] [−𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜓 0] (3.4)
0 −𝑠𝑖𝑛𝜙 𝑐𝑜𝑠𝜙 𝑠𝑖𝑛𝜃 0 𝑐𝑜𝑠𝜃 0 0 1

After multiplication the rotation matrix for transformation of earth frame to body frame is
expressed as

𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜓 −𝑠𝑖𝑛𝜃


𝑅𝐵𝐸 = [𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜃 − 𝑠𝑖𝑛𝜓𝑐𝑜𝑠𝜙 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 ] (3.5)
𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜙 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃

In order to transform quantities defined in the body frame to earth fixed frame, The inverse of the
rotation matrix expressed by the transpose of the 𝑅𝐵𝐸 is used and given by

11
𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜃 − 𝑠𝑖𝑛𝜓𝑐𝑜𝑠𝜙 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓
𝑅𝐸𝐵 = 𝑅𝐵𝐸 𝑇 = [ 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜙 ] (3.6)
−𝑠𝑖𝑛𝜃 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃

This rotation matrix has an importance for transforming forces that are defined in a given frame to
a different or similar frame of reference. For instance, some forces such as gravitational force are
defined in earth frame and some forces like forces produced by propeller are defined in a body
frame.

The linear velocity in the body frame is expressed as vector 𝑉𝐵 = [u v w] T and its transformation
to the earth frame is given by

𝜉𝐸̇ = 𝑅𝐸𝐵 𝑉𝐵 (3.7)

where 𝜉𝐸̇ = [𝑥̇ 𝑦̇ 𝑧̇ ]𝑇 is time derivative of position in earth frame

In order to relate the body angular velocity, which can be expressed as 𝜔𝐵 = [𝑝 𝑞 𝑟]𝑇 where
𝑝, 𝑞 𝑎𝑛𝑑 𝑟 are the rotations around 𝑥𝐵 , 𝑦𝐵 𝑎𝑛𝑑 𝑧𝐵 axises respectively, with angular velocity in the
earth fixed frame 𝜂̇ 𝐸 = [ϕ θ ψ]T, yaw transformation by angle ψ is first applied and then will be
followed by pitch transformation by angle θ and finally roll transformation by angle ϕ will be
applied.
0
Initially 𝜔𝐸 = [0] that tells there is no rotation in the earth frame
0

First rotation about z axis by yaw angle 𝑅(𝜓) forming a new reference frame A’ and is given
by

0 0
𝜔𝐴′ = 𝑅(𝜓)(𝜔𝐸 ) + [ 0 ] = [ 0 ] (3.8)
𝜓̇ 𝜓̇

Next rotating the new frame A’ about y-axis by pitch angle 𝑅(𝜃) to a frame A’’

0 0 −𝜓̇𝑠𝑖𝑛𝜃
𝜔𝐴" = 𝑅(𝜃) [ 0 ] + [𝜃̇] = [ 𝜃̇ ] (3.9)
𝜓 ̇ 0 𝜓̇𝑐𝑜𝑠𝜃

Then rotating frame A’’ about x axis by roll angle 𝑅(𝜙) to the body frame

12
−𝜓̇𝑠𝑖𝑛𝜃 𝜙̇ 𝜙̇ − 𝜓̇𝑠𝑖𝑛𝜃
𝜔𝐵 = 𝑅(𝝓) [ 𝜃̇ ] + [ 0 ] = [ 𝜃̇𝑐𝑜𝑠𝜙 + 𝜓̇𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 ] = 𝑅𝑣𝑒𝑙 𝐸𝐵 𝜂̇ 𝐸 (3.10)
𝜓̇𝑐𝑜𝑠𝜃 0 −𝜃̇𝑠𝑖𝑛𝜙 + 𝜓̇𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃

where 𝑅𝑣𝑒𝑙 𝐸𝐵 is the rotation matrix for transforming the angular velocity Euler angles from earth
fixed frame to body frame. It is defined from the above equation (3.10) that 𝜂̇ 𝐸 = [𝜙̇, 𝜃̇, 𝜓̇]𝑇 and
substituting it to 𝜔𝐵 = 𝑅𝑣𝑒𝑙 𝐸𝐵 𝜂̇ 𝐸 .

𝜙̇ − 𝜓̇𝑠𝑖𝑛𝜃 𝜙̇
[ 𝜃̇𝑐𝑜𝑠𝜙 + 𝜓̇𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 ] = 𝑅𝑣𝑒𝑙 𝐸𝐵 [ 𝜃̇ ] (3.11)
−𝜃̇𝑠𝑖𝑛𝜙 + 𝜓̇𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃 𝜓̇

1 0 −𝑠𝑖𝑛𝜃
Then we get 𝑅𝑣𝑒𝑙 𝐸𝐵 = [0 𝑐𝑜𝑠𝜙 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 ] (3.12)
0 −𝑠𝑖𝑛𝜙 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃

On the other hand, the inverse transformation for transforming angular velocity from body frame
to earth fixed frame becomes

1 𝑠𝑖𝑛𝜙𝑡𝑎𝑛𝜃 𝑐𝑜𝑠𝜙𝑡𝑎𝑛𝜃
𝑅𝑉𝑒𝑙 𝐵𝐸 = [0 𝑐𝑜𝑠𝜙 −𝑠𝑖𝑛𝜙 ] (3.13)
𝑠𝑖𝑛𝜙 𝑐𝑜𝑠𝜙
0 𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜃

This relates the time derivative of Euler angles 𝜂̇ 𝐸 with angular velocity 𝜔𝐵 from equation (3.10)
which give by

𝜂̇ 𝐸 = 𝑅𝑉𝑒𝑙 𝐵𝐸 𝜔𝐵 (3.14)

𝛱
Here the orientation shows that 𝑅𝑉𝑒 𝐵𝐸 is defined if and only if 𝜃 ≠ + 𝐾𝛱 where K ϵ Z.
2

3.2. Dynamic modeling of Hexacopter

The dynamic model of the Hexacopter has translational components (altitude, x position and y
position) and rotational components (roll, pitch and yaw). In order to derive the equation of motion
we begin with stating certain assumptions [5]:

 Hexacopter is a type of rigid body;


 It has symmetrical structure;

13
 The trusts and force are proportional to the square of speed of the rotors;
 The six rotors are found in vertices of a regular hexagon.

In order to drive the dynamic model for position and orientation of the Hexacopter, Newton Euler
general formalism is applied [5].

𝑚𝐽3𝑥3 03𝑥3 𝑉̇ 𝜔 𝘟 𝑚𝑉 ∑𝐹
[ ][ ]+ [ ]=[ ] (3.15)
03𝑥3 𝐽 𝜔̇ 𝜔 𝘟 𝐽𝜔 ∑𝑀

Where 𝑚 is the mass of the body in Kg , 𝐽 is the inertia in 𝑁𝑚𝑠 2 , 𝑉 is the linear velocity in m/s, 𝜔
is the angular velocity in rad/sec, 𝐹 is the force acting on body in N and 𝑀 is the torque affecting
body of the Hexacopter in Nm, 03𝑥3 is zero matrix with size 3, 𝐽3𝑥3 is a unit matrix with size 3.

3.2.1. Translational Dynamics

In the earth frame of reference, the translational dynamics of the Hexarotor can be calculated by
using newton’s second law of motion as

𝑥̈
𝐹 = 𝑚𝑎 = 𝑚𝜉̈ = 𝑚 [𝑦̈ ] (3.16)
𝑧̈

Where F force acting on the body

𝑚 mass of Hexacopter body

𝑎 Acceleration in the earth frame

𝜉̈ Time double derivative of the position in reference of the earth frame.

By using rotational matrix as derived in previous section, the above equation (3.5) can be
expressed in body fixed frame as

𝑅𝐵𝐸 𝐹 𝐵 = 𝑚𝑅𝐵𝐸 𝑎𝐵 = 𝑚𝑅𝐵𝐸 𝑉̇ (3.17)

V is the velocity of the body and its time derivative is in body frame. Then the final expression of
the translational dynamics in the body fixed frame becomes

𝐹 𝐵 = 𝑚𝑉̇ + 𝜔 𝑥 𝑚𝑉 (3.18)

14
3.2.2. Rotational dynamics

The rotational dynamics of a Hexacopter is derived by using Euler’s second axiom in the inertial
frame that states the time derivative of the angular momentum is equal with the external torques
applied on the body.

𝑀𝐸 = 𝐿̇𝐸 (3.19)

where 𝐿̇𝐸 is the angular momentum of the body in the earth frame and

𝑀𝐸 denotes the sum total of external applied moments in the body frame

Using rotational matrix it can be transformed to body reference frame as

𝑑𝐽𝜔
𝑅𝐵𝐸 𝑀𝐸 = 𝑅𝐵𝐸 𝐿̇𝐸 = 𝑅𝐵𝐸 ( ) (3.20)
𝑑𝑡

𝐽𝑥𝑥 0 0
where the inertial matrix 𝐽 , defined by 𝐽 = [ 0 𝐽𝑦𝑦 0 ] is a diagonal matrix in which the
0 0 𝐽𝑧𝑧
non-diagonal elements are zero because of the symmetry of the Hexacopter.

Finally, the rotational dynamics in the body frame gives

𝑀𝐵 = 𝐽𝜔̇ + 𝜔 𝑥 𝐽𝜔 (3.21)

3.2.3. Applied forces on the Hexacopter

1. Gravity

Naturally most forces, torques and other factors exist in the body frame whereas gravity is the only
force that naturally exist in the earth inertial frame. Depending on Euler’s first axiom,
gravitational force is a force that happens at the Hexacopter center of gravity. It is located in the
downward direction and expressed as

0
𝐹𝑔 = [ 0 ] (3.22)
−𝑚𝑔

In body frame is expressed as

15
0 −𝑠𝑖𝑛𝜃
𝐹𝑔𝐵 = 𝑅𝐵𝐸 [ 0 ] = −𝑚𝑔 [ 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜃 ] (3.23)
−𝑚𝑔 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜃

where m is the mass of the body and g is the acceleration due to gravity

2. Thrust force

Thrust force is the force that happens due to the propellers that makes the body to lift upward or
makes to move in the direction of motion. It is located in the direction positive z- axis.

The lift force is defined as the summation of thrusts of the six propellers

𝐹𝑇 = 𝑇1 +𝑇2 +𝑇3 +𝑇4 +𝑇5 +𝑇6 (3.24)

Where 𝑇𝑖 is the thrust from propellers

Since the origin of thrust is a propeller, the generated thrust 𝑇𝑖 from speed of propeller Ω𝑖 is
expressed as

𝑇𝑖 = 𝑏Ω2𝑖 = 𝐶𝑇 𝜌𝐴𝑟 2 Ω2𝑖 (3.25)

where Ω𝑖 is angular speed of propeller 𝑖,

𝑏 is propeller specific constant expressed by 𝐶𝑇 𝜌𝐴𝑟 2,

𝐶𝑇 is thrust coefficient,

𝜌 is air density,

𝐴 is rotor disk area and

𝑟 is rotor radius.

Finally, it is obtained that the total thrust force expressed in the body frame becomes

𝐹𝑇 = ∑6𝑖=1 𝑇𝑖

= 𝑏Ω12 + 𝑏Ω22 + 𝑏Ω23 + 𝑏Ω24 + 𝑏Ω25 + 𝑏Ω26 (3.26)

3.2.4. Applied torques

1. Torque induced by thrust forces

16
As the propellers are not found at the center of gravity, they will create a torque in different axis
of rotation. As seen in the Figure 3.2, each rotor creates a moment with direction opposite to
rotation of the rotor.

Figure 3.2: Hexacopter rotor distance from center of gravity [5]

Around the x-axis, by applying a right hand rule in relation with the axes of rotation, the applied
moment produced by propellers 𝑀𝑟 becomes

𝑙 𝑙 𝑙 𝑙
Roll torque 𝑀𝑟 = − 2 𝑇1 − 𝑙𝑇2 − 2 𝑇3 + 2 𝑇4 + 𝑙𝑇5 + 2 𝑇6 (3.27)

where 𝑇𝑖 is the thrust force, which is equal to 𝑏Ω2𝑖 , and

𝑙 is the length of the arm.

Around the y-axis by applying right hand rule, rotor 2 and 5 do not have any moment on y axis,
thus the applied torque moment 𝑀𝑃 gives

√3 √3 √3 √3
Pitch torque 𝑀𝑝 = 𝑙𝑇1 − 𝑙𝑇3 − 𝑙𝑇4 + 𝑙𝑇6 (3.28)
2 2 2 2

The torque around the z-axis is the result of action and reaction forces. That is when the propellers
rotate, they exert a torque through the air frame. From [9] the reaction torque 𝑄𝑖 of the propeller
𝑖 gives

𝑄𝑖 = 𝑑Ω2𝑖 (3.29)

where d is a specific constant of the propeller.

Yaw torque 𝑀𝑦 = −𝑇1 + 𝑇2 − 𝑇3 + 𝑇4 − 𝑇5 + 𝑇6 (3.30)

17
Finally, the total applied torque through the induced thrust forces of the propeller in relation to the
speed of the propellers is written as

1 1 1 1
𝑀𝑟 = − 2 𝑏𝑙Ω12 − 𝑏𝑙Ω22 − 2 𝑏𝑙Ω23 + 2 𝑏𝑙Ω24 + 𝑏𝑙Ω5 + 2 𝑏𝑙Ω26

√3 √3 √3 √3
𝑀𝑝 = 𝑏𝑙Ω12 − 𝑏𝑙Ω23 − 𝑏𝑙Ω24 + 𝑏𝑙Ω26 (3.31)
2 2 2 2

𝑀𝑦 = −𝑑Ω12 + 𝑑Ω22 − 𝑑Ω23 + 𝑑Ω24 − 𝑑Ω25 + 𝑑Ω26

2. Gyroscopic effect from propellers

Gyroscopic effect produced by the propeller rotation through the shaft called spin and rotation of
the airframe called precision. Gyroscopic torque from propeller is given by

0
𝑀𝐺 = 𝜔 × 𝐽𝑝 [ 0 ] (3.32)
−(1)𝑖 Ω𝑖

where 𝜔 is the speed of propeller and 𝐽𝑝 is propellers inverse matrix

0 𝑞𝐽𝑝,𝑧𝑧 (−1)𝑖 Ω𝑖
𝑀𝐺 = 𝜔 × [ 0 ] = [−𝑝𝐽𝑝,𝑧𝑧 (−1)𝑖 Ω𝑖 ] (3.33)
𝑖
𝐽𝑃,𝑧𝑧 (−1) Ω𝑖 0

𝑞𝐽𝑝,𝑧𝑧 Ω𝑟
Which is the same as 𝑀𝐺 = [−𝑝𝐽𝑝,𝑧𝑧 Ω𝑟 ] (3.34)
0

where Ω𝑟 is the resultant angular velocity expressed as Ω𝑟 = ∑61(−1)𝑖 Ω𝑖

3.3. Final system modeling


3.3.1. Control input vector 𝑼
By controlling the rotational inputs, one can control the rotors movement of the vehicle. The input
for the Hexacopter system is chosen as the rotational speed of all the six propellers. These
rotational speeds have a relation with the aerodynamic thrust force and torques. For this system
there are four control inputs defined by

𝑈 = [𝑈1 𝑈2 𝑈3 𝑈4 ]

where 𝑈1 = 𝑏(𝛺1 2 + 𝛺2 2 + 𝛺3 2 + 𝛺4 2 + 𝛺5 2 + 𝛺6 2 ) = 𝐹𝑇 (3.35)

18
1 1 1 1
𝑈2 = − 2 𝑏𝑙Ω12 − 𝑏𝑙Ω22 − 2 𝑏𝑙Ω23 + 2 𝑏𝑙Ω24 + 𝑏𝑙Ω5 + 2 𝑏𝑙Ω26 = 𝑀𝑟 (3.36)

√3 √3 √3 √3
𝑈3 = 𝑏𝑙Ω12 − 𝑏𝑙Ω23 − 𝑏𝑙Ω24 + 𝑏𝑙Ω26 = 𝑀𝑝 (3.37)
2 2 2 2

𝑈4 = −𝑑Ω12 + 𝑑Ω22 − 𝑑Ω23 + 𝑑Ω24 − 𝑑Ω25 + 𝑑Ω26 = 𝑀𝑦 (3.38)

From the above equation 𝐹𝑇 corresponds to is the trust force defined at equation (3.26) and 𝑀𝑟 , 𝑀𝑝
and 𝑀𝑦 are the roll, pitch and yaw torques respectively defined at equation (3.31).

The control inputs in equation (3.35) to equation (3.38) can be expressed in matrix form as

𝛺1 2
𝑈1 𝑏 𝑏 𝑏 𝑏 𝑏 𝑏 𝛺2 2
𝑈 −𝑏𝑙/2 −𝑏𝑙 −𝑏𝑙/2 𝑏𝑙/2 𝑏𝑙 𝑏𝑙/2 𝛺 2
[ 2] = [ ] 32 (3.39)
𝑈3 √3𝑏𝑙/2 0 −√3𝑏𝑙/2 −√3𝑏𝑙/2 0 √3𝑏𝑙/2 𝛺4
𝑈4 −𝑑 𝑑 −𝑑 𝑑 −𝑑 𝑑 𝛺5 2
[𝛺6 2 ]

From the above matrix equation (3.38), 𝑈1 is the control input for the altitude that it is the sum of
the six rotors speed, which causes an upward thrust force. 𝑈2 is the difference in rotors thrust 1,2,3
and 4,5,6 which makes a roll movement. 𝑈3 is a control input which represents a difference of
rotors thrust 1,6 and 3,4 which is responsible for a pitch rotation. Finally, 𝑈4 is the difference in
rotors torque between the three clockwise rotating rotors and the three counter clockwise rotating
rotors that generates a yaw rotation.

If the rotor velocity is needed to be calculated from the control inputs, the inverse relation between
the rotor’s speed and control inputs is needed, which can be done by inverting the above matix in
equation (3.39).

1 1 −1
6𝑏 3𝑏𝑙
0 6𝑑
𝛺1 2 1 1 −√3 1
6𝑏 6𝑏𝑙 6𝑏𝑙 6𝑑
𝛺2 2
1 −1 −√3 −1 𝑈1
𝛺3 2 6𝑏 6𝑏𝑙 6𝑏𝑙 6𝑑 𝑈2
= 1 [𝑈3 ]
(3.40)
𝛺4 2 1 −1
0
6𝑏 3𝑏𝑙 6𝑑 𝑈
𝛺5 2 1 −1 √3 −1
4

[𝛺6 2 ] 6𝑏 6𝑏𝑙 6𝑏𝑙 6𝑑


1 1 √3 1
[6𝑏 6𝑏𝑙 6𝑏𝑙 6𝑑 ]

19
3.3.2. Translational equation of motion

The complete translational dynamics become

∑ 𝐹 = 𝑚𝑎 = 𝑚𝜉̈ = 𝑚[𝑥̈ 𝑦̈ 𝑧̈ ]𝑇 (3.41)

As seen above we have applied gravitational force and thrust forces and combining them, we have
got

𝑥̈
𝑚 [𝑦̈ ] = 𝐹𝑔 + 𝐹𝑇 (3.42)
𝑧̈

Substituting the values for 𝐹𝑔 and 𝐹𝜔 from equation (3.22) and (3.26), it becomes

𝑥̈ 0 0
𝐵
𝑚 [𝑦̈ ] = [ 0 ] + 𝑅𝐸 [ 0 ] (3.43)
𝑧̈ −𝑚𝑔 𝑏 ∑ Ω2𝑖

Finally rewriting the above equation, the acceleration of the translational components gives

1
𝑥̈ = 𝑚 (𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓)𝑈1 (3.44)

1
𝑦̈ = 𝑚 (𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓)𝑈1 (3.45)

1
𝑧̈ = 𝑚 (𝑐𝑜𝑠𝜃𝑐𝑜𝑠𝜙)𝑈1 − 𝑔 (3.46)

3.3.3. Rotational equation of motion


Combining the above torque equations, we get

𝐽𝜔̇ + 𝜔 × 𝐽𝜔 = ∑ 𝑀 (3.47)

𝐽𝜔̇ = 𝑀𝐴 + 𝑀𝐺 − 𝜔 × 𝐽𝜔 (3.48)

where 𝑀𝐴 is the torque through propellers equal with [𝑙𝑈2 𝑙𝑈3 𝑈4 ]𝑇


Substituting the value for 𝑀𝐺 in equation (3.34), it becomes
𝜙̈ 𝑙𝑈2 𝑞𝐽𝑟 (Ω𝑟 ) 𝜙̇ 𝜙̇
𝐽 [ 𝜃̈ ] = [𝑙𝑈3 ] + [−𝑝𝐽𝑟 (Ω𝑟 )] − [ 𝜃̇ ] × 𝐽 [ 𝜃̇ ] (3.49)
𝜓̈ 𝑈4 0 𝜓̇ 𝜓̇
Finally, the total rotational dynamics of a Hexacopter becomes

20
1
𝜙̈ = 𝐽 (𝜃̇𝜓̇(𝐽𝑦𝑦 − 𝐽𝑧𝑧 ) + 𝐽𝑟 Ω𝑟 𝜃̇ + 𝑙𝑈2 ) (3.50)
𝑥𝑥

1
𝜃̈ = 𝐽 (𝜙̇𝜓̇(𝐽𝑧𝑧 − 𝐽𝑥𝑥 ) − 𝐽𝑟 Ω𝑟 𝜙̇ + 𝑙𝑈3 ) (3.51)
𝑦𝑦

1
𝜓̈ = 𝐽 (𝜙̇𝜃̇ (𝐽𝑥𝑥 − 𝐽𝑦𝑦 ) + 𝑈4 ) (3.52)
𝑧𝑧

Finally, the complete nonlinear dynamic model of a Hexacopter becomes

1
𝑥̈ = 𝑚 [𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓]𝑈1

1
𝑦̈ = 𝑚 [𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓]𝑈1

1
𝑧̈ = 𝑚 [𝑐𝑜𝑠𝜃𝑐𝑜𝑠𝜙]𝑈1 − 𝑔

𝐽𝑦𝑦 −𝐽𝑧𝑧 𝐽 𝛺 𝜃 𝑙 ̇
𝜙̈ = 𝜃̇𝜓̇ ( 𝐽 ) + 𝑟𝐽 𝑟 + 𝐽 𝑈2 (3.53)
𝑥𝑥 𝑥𝑥 𝑥𝑥

𝐽 −𝐽 𝐽 𝛺 𝜙 𝑙̇
𝜃̈ = 𝜓̇𝜙̇ ( 𝑧𝑧𝐽 𝑥𝑥 ) − 𝑟𝐽 𝑟 + 𝐽 𝑈3
𝑦𝑦 𝑦𝑦 𝑦𝑦

𝐽𝑥𝑥 −𝐽𝑦𝑦 1
𝜓̈ = 𝜃̇𝜙̇( 𝐽 ) + 𝐽 𝑈4
𝑧𝑧 𝑧𝑧

3.3.4. State space representation


First defining the state vector of the Hexacopter

𝑋 = [𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 𝑥7 𝑥8 𝑥9 𝑥10 𝑥11 𝑥12 ]𝑇 (3.54)

This state vector is associated with the Hexacopter degree of freedom

𝑋 = [𝑥 𝑥̇ 𝑦 𝑦̇ 𝑧 𝑧̇ 𝜙 𝜙̇ 𝜃 𝜃̇ 𝜓 𝜓̇]𝑇 (3.55)

As it is shown above, this state vectors define the position of the Hexacopter and its linear and
angular velocities.

Now using the translational equations of model from equation (3.44) to (3.46) and rotational
equations (3.50) to (3.52), the full mathematical model can be represented by a state space
representation as follows

𝑥̇ 1 = 𝑥̇ = 𝑥2

21
1
𝑥̇ 2 = 𝑥̈ = [𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓]𝑈1
𝑚

𝑥̇ 3 = 𝑦̇ = 𝑥4

1
𝑥̇ 4 = 𝑦̈ = 𝑚 [𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓]𝑈1

𝑥̇ 5 = 𝑧̇ = 𝑥6

1
𝑥̇ 6 = 𝑧̈ = 𝑚 (𝑐𝑜𝑠𝜃𝑐𝑜𝑠𝜙)𝑈1 − 𝑔 (3.56)

𝑥̇ 7 = 𝜙̇ = 𝑥8

𝐽𝑦𝑦 − 𝐽𝑧𝑧 𝐽𝑟 𝛺𝑟 𝜃̇ 𝑙
𝑥̇ 8 = 𝜙̈ = 𝜃̇𝜓̇ ( )+ + 𝑈
𝐽𝑥𝑥 𝐽𝑥𝑥 𝐽𝑥𝑥 2

𝑥̇ 9 = 𝜃̇ = 𝑥10

𝐽𝑧𝑧 −𝐽𝑥𝑥 𝐽𝑟 𝛺𝑟 𝜙̇ 𝑙
𝑥̇ 10 = 𝜃̈ = 𝜓̇𝜙̇ ( )− + 𝐽 𝑈3
𝐽𝑦𝑦 𝐽𝑦𝑦 𝑦𝑦

𝑥̇ 11 = 𝜓̇ = 𝑥12

𝐽𝑥𝑥 −𝐽𝑦𝑦 1
𝑥̇ 12 = 𝜓̈ = 𝜃̇𝜙̇( 𝐽 ) + 𝐽 𝑈4
𝑧𝑧 𝑧𝑧

𝑥2
1
[𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓] 𝑈1
𝑚
𝑥4
1
[𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓]𝑈1
𝑚
𝑥6
1
(𝑐𝑜𝑠𝜃𝑐𝑜𝑠𝜙)𝑈1 − 𝑔
𝑚
𝑓(𝑋, 𝑈) = 𝑥8 (3.57)
𝐽𝑦𝑦 −𝐽𝑧𝑧 𝐽𝑟 𝛺𝑟 𝜃̇ 𝑙
𝜃̇𝜓̇ ( ) + 𝐽 + 𝐽 𝑈2
𝐽𝑥𝑥 𝑥𝑥 𝑥𝑥
𝑥10
𝐽 −𝐽 𝐽 𝛺 𝜙 𝑙 ̇
𝜓̇𝜙̇ ( 𝑧𝑧𝐽 𝑥𝑥 ) − 𝑟𝐽 𝑟 + 𝐽 𝑈3
𝑦𝑦 𝑦𝑦 𝑦𝑦
𝑥12
𝐽𝑥𝑥 −𝐽𝑦𝑦 1
[ 𝜃̇𝜙̇( 𝐽 ) + 𝐽 𝑈4 ]
𝑧𝑧 𝑧𝑧

22
3.4. Dynamic system model verification
Previously it has been stated that a Hexacopter has six degree of freedom and controlled by speed
of propellers. The translational and rotational components of a Hexacopter are modeled based on
the Newton Euler formalism. To check if the designed model has meet the principle of the
Hexacopter’s operation and response of the given constant inputs, MATLAB Simulink model
scheme is used.

For the system to be as arbitrary as possible with respect to the number of rotors, numerical values
for parameters in Table 2 has been used in simulation.

Table 2: The values for parameters used in the simulation

Symbol Description Numerical values Sources


𝑚 Mass of the body 2.1 𝑘𝑔 [Tobias,2014]
𝑙 Length of the arm 0.23 𝑚 [Tobias,2014]
𝐽𝑥𝑥 Moment of inertia along x-axis 0.0038 𝑘𝑔𝑚2 [Tobias,2014]
𝐽𝑦𝑦 Moment of inertia along y-axis 0.0038 𝑘𝑔𝑚2 [Tobias,2014]
𝐽𝑧𝑧 Moment of inertia along z-axis 0.0071 𝑘𝑔𝑚2 [Tobias,2014]
𝑔 Acceleration due to gravity 9.8 𝑚/𝑠 2 [Tobias,2014]
𝐽𝑟 Rotor inertia 0.0008 𝑘𝑔𝑚2 [Tobias,2014]
𝑏 Thrust constant 0.01458 𝑁𝑠 2 [Tobias,2014]
𝑑 Drag factor 0.001037𝑁𝑚𝑠 [Tobias,2014]

Simulink block

The Simulink block diagram for the designed open loop dynamic model of a Hexacopter is shown
in figure (3.3) below. Simulink model has different part. The first part of the Simulink block shows
the speed constants for the six propellers of the rotors that are important for calculating the torques
of the four control inputs of Hexacopter. The value for speed constants is chosen randomly.
Whereas, the second part of block is used for converting the speed values to torque input values in
which this input values drives the motion of the multirotor.

23
The third part is the main component of the Simulink in which the formulated dynamic
mathematical model of the Hexacopter is expressed using a MATLAB function block. The outputs
of this block shows the state derivative of both the translational components (𝑥̈ , 𝑦̈ , 𝑧̈ )and rotational
(𝜙̈, 𝜃̈, 𝜓̈)acceleration components of the system model and the integral is applied to all components
to get the state vector components(𝑥, 𝑦, 𝑧, 𝜙, 𝜃, 𝜓).

Figure 3.3: Simulink block diagram of the open loop uncontrolled model

By applying the parameters specified in the table (2) above, the output of the open loop system
without a controller as seen in the scope will look like in the figure below. This result be obtained
when applying the same amount of fixed rotating speed constants of the rotors having a value of
30 rpm for each of six rotor(𝑤1 = 𝑤2 = 𝑤3 = 𝑤4 = 𝑤5 = 𝑤6 = 30𝑟𝑝𝑚).

24
(a)

(b)

Figure 3.4: Simulation result of open loop uncontrolled model with 𝑤1 = 𝑤2 = 𝑤3 = 𝑤4 =


𝑤5 = 𝑤6 = 30𝑟𝑝𝑚 (a) translational components and (b) rotational components

From the above two Figures (figure 3.4a and 3.4b) it is clear to see that when all the six rotors are
rotating with in the same propeller speed, all the parameters except the altitude becomes zero. This
shows that the Hexacopter is flying in upward direction without any movement in the other
direction and without any effect of gravitational force. Moreover, varying the speed of the six

25
rotors, it also produces a roll, pitch and yaw rotation. This proves the correctness of the designed
dynamic model of the Hexacopter.

The Figure below show that when all the rotors are at an equilibrium position or the six rotors are
at 0 rpm then only the altitude will be down ward because of the gravitational effect of the earth.

Figure 3.5: Open loop uncontrolled simulation result with(𝑤1 = 𝑤2 = 𝑤3 = 𝑤4 = 𝑤5 = 𝑤6 =


0𝑟𝑝𝑚)

3.5. Controller design


Hexarotor is a system that has a highly nonlinear and unstable system. Moreover, a proper control
system is needed to make it stable. In this thesis work, a sliding mode controller (SMC) is used for
making Hexarotor track a given trajectory.

26
3.5.1. Block diagram for controlling system

𝑋, 𝑌

𝑌𝑑 Positon 𝑈𝑋 𝜙𝑑 𝑈2
control Roll
control
𝑋𝑑 𝑈𝑦 𝛺1
Block
correction
S

𝜃𝑑 𝑈3 𝛺2
Pitch

Rotor speed calculation


control Plant
𝛺3 dynamics

𝛺4

𝜓𝑑 𝑈4 𝛺5
Yaw
control
𝛺6 𝞨

Altitude
𝑍𝑑 𝑈1
control

𝜙, 𝜃, 𝜓, 𝑍

Figure 3.6: General block diagram of controlling system

From the block diagram in Figure 3.6, the control loop has the inner loop and outer loop. The inner
loop has four control laws which are the roll control (𝜙), pitch control (𝜃), yaw control (𝜓) and
altitude control (𝑍). In addition, the outer loop has two position control laws.

Since the Hexacopter is under actuated system, it needs a six control dynamics to track the desired
trajectories and to regulate roll and pitch angles at the same time [10]. To do this the outer loop
should produce a desired force to control the translations of x and y. Then the outer loop controls

27
the roll and pitch dynamics. From the block above, a block corrector is used to generate the desired
value for the roll and pitch angles 𝜙𝑑 and 𝜃𝑑 . This is done by analytical inversion as follows

From the dynamic model of translational component

Let 𝑈𝑥 = [𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓]𝑈1 (3.58)

𝑈𝑦 = (𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓)𝑈1 (3.59)

To simplify and get the expression for 𝜙𝑑 and 𝜃𝑑 ,

first make the above equation in matrix form

𝑈𝑦
𝑠𝑖𝑛𝜓 −𝑐𝑜𝑠𝜓 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃 𝑈
[ ][ ] = [𝑈𝑥1 ] (3.60)
𝑐𝑜𝑠𝜓 𝑠𝑖𝑛𝜓 𝑠𝑖𝑛𝜙
𝑈1

Then multiply it with the inverse matrix

𝑠𝑖𝑛𝜓𝑈𝑦 +𝑐𝑜𝑠𝜓𝑈𝑥
𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃 𝑈
[ ] = [−𝑐𝑜𝑠𝜓𝑈 1+𝑠𝑖𝑛𝜓𝑈 ] (3.61)
𝑠𝑖𝑛𝜙 𝑦 𝑥
𝑈1

Finally the desired values for roll and pitch angles becomes

−𝑐𝑜𝑠𝜓𝑈𝑦 +𝑠𝑖𝑛𝜓𝑈𝑥
𝜙𝑑 𝑠𝑖𝑛−1 ( )
𝑈1
[ ]=[ ] (3.62)
𝜃𝑑 𝑠𝑖𝑛−1 (
𝑠𝑖𝑛𝜓𝑈𝑦 +𝑐𝑜𝑠𝜓𝑈𝑥
)
𝑈1 𝑐𝑜𝑠𝜙

3.6. Sliding mode controller: the general principle


Sliding mode controller (SMC) is a type of nonlinear control system methods that change the
dynamics of the system by designing a multiple control structure to make sure that trajectories
slide towards a switching surface. The control law works by switching from one continuous
structure to another depending on position in state space. It is a robust control technique, which
has the ability to compensate modeling errors, system’s parameter differences and work for
nonlinear and time varying systems. However, it has a draw back in forming a chattering effect
that gives a high frequency oscillation [11, 12].

28
In designing a sliding mode control, there are two phases: choosing the sliding surface and forming
a control law. Sliding surface is a surface that the system needs to slide and satisfy the design
specifications. It is a geometrical locus that consists of boundaries. The control law is the second
step that make system attractive to the desired state [13].

The general typical form of the sliding surface is expressed as [13]:

d f−1
S(x) = (λx + dt) e(x) (3.63)

where λx is the tuning parameter for defining the S(x) performance,

X is a control variable or state vector,

e(x) is a tracking error defined as desired value minus actual value and

f is the relative degree between input and output.

The second step of designing the control law also consists of two components: the linear 𝑈𝑒𝑞 (𝑡)
and the nonlinear component 𝑈𝐷 (𝑡) [1, 11].

𝑈(𝑡) = 𝑈𝑒𝑞 (𝑡) + 𝑈𝐷 (𝑡) (3.64)

The linear part protects the movement of the system on the sliding surface whenever the system is
on the surface. This part of controller that maintains the sliding condition must satisfy a condition

𝑆̇ = 0

The discontinuous part of the control law is used to compensate any variation of the state
trajectories from the sliding surface in order to reach it. And can be expressed as

𝑈𝐷 (𝑡) = 𝐾 𝑠𝑖𝑔𝑛(𝑠(𝑡)) (3.65)

−1 𝑖𝑓 𝑠 < 0
where 𝑠𝑖𝑔𝑛(𝑠(𝑡)) = { 0 𝑖𝑓 𝑠 = 0
1 𝑖𝑓 𝑠 > 0

and 𝐾 is a design constant that must be greater than zero to satisfy the Lyapunov stability
condition 𝑠𝑠̇ > 0.

29
Sliding mode controller principle is shown in Figure 3.7 by following the sliding surface. When
the sliding surface is cached by the system, then it will determine the way of system in a closed
loop.

Figure 3.7: Graphical demonstration of SMC

3.7. SMC in Hexacopter


In this work, six sliding mode controllers are used to control all the states of the Hexacopter
dynamics.

3.7.1. Altitude controller


The first step in controlling all the states of the Hexacopter is designing the sliding surface. Since
it is trajectory tracking, it depends on the error.

sz = 𝑒̇1 + λz e1 (3.66)

where λz is a tuning parameter

The error equation for the altitude is given as

𝑒1 = zd − z (3.67)

Where zd is the desired state and z is the actual state

Inserting the error equation to the sliding surface gives

𝑠𝑧 = (𝑧̇𝑑 − 𝑧̇ ) + λz (𝑧𝑑 − z) (3.68)

The derivative of the sliding surface defined in equation (3.66) by substituting equation (3.67) it
gives

30
ṡ z = ë 1 + λz ė 1 = (z̈ d − z̈ ) + λz (ż d − ż ) (3.69)

Substituting the altitude dynamics of the Hexacopter from equation (2.46) to the derivative of
sliding surface gives

1
𝑠̇𝑧 = 𝑧̈𝑑 − (𝑚 (𝑐𝜙𝑐𝜃)𝑈1 − 𝑔) + 𝜆𝑧 (𝑧̇𝑑 − 𝑧̇ ) (3.70)

where 𝑐𝜙 is 𝑐𝑜𝑠𝜙 and 𝑐𝜃 is cos 𝜃

The next step is designing the sliding control law for the altitude that make the trajectories to attract
to the surface and keep on sliding on it for all time.

𝑈(𝑡) = 𝑈𝑒𝑞 (𝑡) + 𝑈𝐷 (𝑡) (3.71)

Since the system is in sliding condition 𝑈𝑒𝑞 = 𝑈1 and as 𝑠̇𝑧 =0, equation (3.70) gives the equivalent
equation
m
𝑈𝑒𝑞 = 𝑐𝜙𝑐𝜃 [z̈ d + 𝑔 + 𝜆𝑧 𝑒̇1 ] (3.72)

Then to design the discontinuous controller, the positive definite Lyapunov function must be
defined to be

1
𝑉 = 2 𝑆2 > 0 (3.73)

Moreover, the derivative of Lyapunov function at equation (3.73) which became 𝑉̇ = 𝑆𝑆̇ < 0 must
be negative definite. So for all 𝑡 > 0 and K z > 0 , the discontinuous control is formulated as

𝑈𝐷 = K z sgn(sz ) (3.74)

Finally, the Altitude controller input becomes


m
𝑈1 = 𝑐𝜙𝑐𝜃 [z̈ d + 𝑔 + 𝜆𝑧 𝑒̇1 + 𝐾𝑧 𝑠𝑔𝑛(𝑠𝑧 )] (3.75)

3.7.2. Roll controller


Controlling a roll movement is the same procedure as altitude control in that choosing the sliding
surface gives

sϕ = ė 2 + λϕ e2 (3.76)

31
where 𝑒2 = 𝜙𝑑 − 𝜙

Derivating the sliding surface equation (3.76) and substituting the error equation yields

ṡ ϕ = ë 2 + λϕ ė 2 = ϕ̈d − ϕ̈ + λϕ (ϕ̇d − ϕ̇) (3.77)

Substituting the dynamics equation of Hexacopter roll dynamics in equation (3.50) to the sliding
surface equation (3.77), we obtain

𝐽𝑦𝑦 −𝐽𝑧𝑧 𝐽𝑟 𝛺𝑟 𝜃̇ 𝑙
ṡ ϕ = ϕ̈d − 𝜓̇𝜃̇ ( )− − 𝐽 𝑈2 + λϕ (ϕ̇d − ϕ̇) (3.78)
𝐽𝑥𝑥 𝐽𝑥𝑥 𝑥𝑥

To get the equivalent control equation, ṡ ϕ = 0 gives

𝐽𝑥𝑥 𝐽𝑦𝑦 −𝐽𝑧𝑧 𝐽 𝛺 𝜃 ̇


Ueq = [ϕ̈d − 𝜓̇𝜃̇ ( 𝐽 ) − 𝑟𝐽 𝑟 + 𝜆𝜙 (𝜙̇𝑑 − 𝜙̇)] (3.79)
𝑙 𝑥𝑥 𝑥𝑥

The discontinuous part of controller selected for all 𝑡 > 0, K ϕ > 0 becomes

𝑈𝐷 = K ϕ sgn(sϕ ) (3.80)

Finally, the roll controller that makes the system to the selected sliding surface by adding the
linear and discontinuous components derived above, it gives

𝐽𝑥𝑥 𝐽𝑦𝑦 −𝐽𝑧𝑧 𝐽 𝛺 𝜃 ̇


U2 = [ϕ̈d − 𝜓̇𝜃̇ ( 𝐽 ) − 𝑟𝐽 𝑟 + 𝜆𝜙 (𝜙̇𝑑 − 𝜙̇) + K ϕ sgn(sϕ )] (3.81)
𝑙 𝑥𝑥 𝑥𝑥

3.7.3. Pitch controller


Controlling the pitch dynamics has also the same procedure with the others designed before

The sliding surface will be


sθ = ė 3 + λθ e3 (3.82)

where error 𝑒3 = 𝜃𝑑 − 𝜃

Derivating the sliding surface equation give

ṡ θ = λθ ė 3 + ë 3 = Ѳ̈d − Ѳ̈ + λθ (Ѳ̇d − Ѳ̇) (3.83)

𝐽𝑧𝑧 −𝐽𝑥𝑥 𝐽𝑟 𝛺𝑟 𝜙̇ 𝑙
Inserting the pitch dynamics 𝜃̈ = 𝜓̇𝜙̇ ( )− + 𝐽 𝑈3 into the above equation gives
𝐽𝑦𝑦 𝐽𝑦𝑦 𝑦𝑦

32
𝐽 −𝐽 𝐽 𝛺 𝜙 𝑙 ̇
ṡ θ = Ѳ̈d − 𝜓̇𝜙̇ ( 𝑧𝑧𝐽 𝑥𝑥 ) + 𝑟𝐽 𝑟 − 𝐽 𝑈3 + λθ (Ѳ̇d − Ѳ̇) (3.84)
𝑦𝑦 𝑦𝑦 𝑦𝑦

Next the control law is designed and to find the equivalent equation, we set 𝑠̇ 𝜃 = 0

Then
𝐽𝑦𝑦 𝐽 −𝐽 𝐽 𝛺 𝜙 ̇
Ueq = [θ̈d − 𝜓̇𝜙̇ ( 𝑧𝑧𝐽 𝑥𝑥 ) + 𝑟𝐽 𝑟 + λθ (Ѳ̇d − Ѳ̇)] (3.85)
𝑙 𝑦𝑦 𝑦𝑦

The discontinuous part of the pitch dynamics for all 𝑡 > 0, K θ > 0 becomes

U𝐷 = K θ sgn(sθ ) (3.86)

Finally, the pitch controller becomes

𝐽𝑦𝑦 𝐽 −𝐽 𝐽 𝛺 𝜙 ̇
U3 = [θ̈d − 𝜓̇𝜙̇ ( 𝑧𝑧𝐽 𝑥𝑥 ) + 𝑟𝐽 𝑟 + λθ (Ѳ̇d − Ѳ̇) + K θ 𝑠𝑔𝑛(𝑠𝜃 )] (3.87)
𝑙 𝑦𝑦 𝑦𝑦

3.7.4. Yaw controller


As using the same procedure with other controllers, first design a sliding surface

sψ = ė 4 + λψ e4 (3.88)

where error 𝑒4 = 𝜓𝑑 − 𝜓

The derivative of the sliding surface give

ṡ ψ = ë 4 + 𝜆𝜓 ė 4 == ψ̈d − ψ̈ + λ𝜓 (𝜓̇d − ψ̇) (3.89)

𝐽𝑥𝑥−𝐽𝑦𝑦 1
Inserting the yaw dynamics equation 𝜓̈ = 𝜙̇𝜃̇ [ 𝐽𝑧𝑧 ] + 𝐽𝑧𝑧 𝑈4 to the above equation (3.89), it

gives
𝐽𝑥𝑥−𝐽𝑦𝑦 1
ṡ ψ = 𝜓̈d − 𝜙̇𝜃̇ [ ] − 𝐽𝑧𝑧 𝑈4 + λψ (𝜓̇d − ψ̇) (3.90)
𝐽𝑧𝑧

Next designing the yaw dynamics controller the equivalent control becomes

𝐽𝑥𝑥−𝐽𝑦𝑦
Ueq = 𝐽𝑧𝑧 [𝜓̈𝑑 − 𝜙̇𝜃̇[ 𝐽𝑧𝑧 ] + λψ (𝜓̇d − 𝜓̇)] (3.91)

The discontinuous component chosen for all 𝑡 > 0, K ψ > 0

U𝐷 = K ψ sgn(sψ ) (3.92)

33
Finally, adding the continuous and discontinuous components of the controller, the yaw
dynamics controller becomes

𝐽𝑥𝑥−𝐽𝑦𝑦
U4 = 𝐽𝑧𝑧 [𝜓̈𝑑 − 𝜙̇𝜃̇[ 𝐽𝑧𝑧 ] + λψ (𝜓̇d − 𝜓̇) + 𝐾3 𝑠𝑔𝑛(𝑠3 )] (3.93)

3.7.5. Linear X motion controller


Linear x motion is the movement through the x direction in which it gives the desired value for
the x movement.

Choosing the sliding surface for the movement

𝑠𝑥 = 𝑒̇𝑥 + 𝜆𝑥 𝑒𝑥 (3.94)

where 𝑒𝑥 = 𝑥𝑑 − 𝑥

The time derivative becomes

𝑠̇𝑥 = 𝑒̈𝑥 + 𝜆𝑥 𝑒̇𝑥 (3.95)

Substituting the error equation to time derivate of surface equation give

𝑠̇𝑥 = 𝑒̈𝑥 + 𝜆𝑥 𝑒̇𝑥 = 𝑥̈ 𝑑 − 𝑥̈ + 𝜆𝑥 (𝑥̇ 𝑑 − 𝑥̇ ) (3.96)

From the dynamic model of the Hexacopter translational dynamics for position x in equation
(3.44) and inserting to the above equation gives

1
𝑠̇𝑥 = 𝑥̈ 𝑑 − (𝑚 [𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜙]𝑈1 ) + 𝜆𝑥 (𝑥̇ 𝑑 − 𝑥̇ ) (3.97)

Substituting 𝑈𝑥 by 𝑐𝑜𝑠𝜙𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 + 𝑠𝑖𝑛𝜙𝑠𝑖𝑛𝜓 yields

1
𝑠̇𝑥 = 𝑥̈ 𝑑 − 𝑚 𝑈𝑥 𝑈1 + 𝜆𝑥 (𝑥̇ 𝑑 − 𝑥̇ ) (3.98)

Finding the value for equivalent equation by making 𝑠̇𝑥 = 0 it becomes


𝑚
𝑈𝑥 = 𝑈 [𝑥̈ 𝑑 + 𝜆𝑥 (𝑥̇ 𝑑 − 𝑥̇ )] (3.99)
1

Then the discontinuous control part that makes the Lyapunov function 𝑉 positive definite is
designed as

𝑈𝐷 = 𝐾𝑥 𝑠𝑖𝑔𝑛(𝑆𝑥 ) (3.100)

34
Then the final controller for linear x position is expressed as
𝑚
𝑈𝑥 = 𝑈 [𝑥̈ 𝑑 + 𝜆𝑥 (𝑥̇ 𝑑 − 𝑥̇ )] + 𝐾𝑥 𝑠𝑖𝑔𝑛(𝑆𝑥 ) (3.101)
1

3.7.6. Linear y motion controller


The linear y motion is designed by applying similar procedure with the above mentioned
controllers

First choosing the sliding surface for the movement

𝑠𝑦 = 𝑒̇𝑦 + 𝜆𝑦 𝑒𝑦 (3.102)

where the error equation 𝑒𝑦 = 𝑦𝑑 − 𝑦

derivating the sliding surface and substituting the error equation on it gives

𝑠̇𝑦 = 𝑒̈𝑦 + 𝜆𝑦 𝑒̇𝑦 = 𝑦̈ 𝑑 − 𝑦̈ + 𝜆𝑦 (𝑦̇ 𝑑 − 𝑦̇ ) (3.103)

From the dynamic model of the Hexacopter translational dynamics for position y in equation
(3.45) and inserting to the above equation gives

1
𝑠̇𝑦 = 𝑦̈ 𝑑 − (𝑚 [𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓]𝑈1 ) + 𝜆𝑦 (𝑦̇ 𝑑 − 𝑦̇ ) (3.104)

Substituting 𝑈𝑦 in place of 𝑐𝑜𝑠𝜙𝑠𝑖𝑛𝜃𝑠𝑖𝑛𝜓 − 𝑠𝑖𝑛𝜙𝑐𝑜𝑠𝜓 we get

1
𝑠̇𝑦 = 𝑦̈ 𝑑 − 𝑚 𝑈𝑦 𝑈1 + 𝜆𝑦 (𝑦̇ 𝑑 − 𝑦̇ ) (3.105)

Then finding the equivalent equation at 𝑠̇𝑦 = 0 yields

𝑚
𝑈𝑦 = 𝑈 [𝑦̈ 𝑑 + 𝜆𝑦 (𝑦̇ 𝑑 − 𝑦̇ )] (3.106)
1

The discontinuous control component at 𝐾𝑥 > 0 becomes

𝑈𝐷 = 𝐾𝑥 𝑠𝑖𝑔𝑛(𝑆𝑥 ) (3.107)

The final controller for the linear y position controller is


𝑚
𝑈𝑦 = 𝑈 [𝑦̈ 𝑑 + 𝜆𝑦 (𝑦̇ 𝑑 − 𝑦̇ ) + 𝐾𝑥 𝑠𝑖𝑔𝑛(𝑆𝑥 )] (3.108)
1

35
Chapter Four

Simulation results and analysis


This chapter provides simulation based evidence on the trajectory tracking performance of applied
controller for the designed Hexacopter. The design is implementing into a software environment
specifically on MATLAB Simulink. This chapter also presents discussion of the simulation results.

4.1. Desired trajectory


The desired trajectory for the flight of the Hexacopter is designed as

𝑋𝑑 = sin(𝑡) + cos(𝑡)

𝑌𝑑 = cos(𝑡)2

𝑍𝑑 = cos(𝑡) + 𝑡

𝜓𝑑 = cos(2 ∗ 𝑡) + sin(𝑡)

4.2. Closed loop simulations


The gain parameters λi and K i for the altitude, attitude and position states of a Hexacopter are
designed by using a trial and error method that would give a least possible settling time and
minimize the error. Table 3 shows the values for the parameters got by try and error.

Table 3: Numerical values for constant 𝜆𝑖 and 𝐾𝑖

Dynamics λi Ki Settling time (seconds)


X position 15 30 0.65
Y position 15 50 0.5
Z altitude 15 100 0.4
Yaw (ψ) 20 100 0.3

4.2.1. Z Altitude tracking


Notice that the SMC controller input U1 was designed for the altitude control in the previous
chapter, and applying it to the system dynamics for tracking the given reference value the response

36
will looks like in Figure (4.1a). Figure (4.1) shows the tracking ability of the Hexacopter for a
given reference altitude and the respective error between the desired and actual values.

It is clear to see from the simulation that SMC has a good tracking response for a given desired
altitude. The controller follows the given desired trajectory with in a small response time. In
addition, the steady state error become zero within a few seconds. Tuning the value of parameters
λz and K z was made by trial and error tuning method until getting a better response while following
desired value as demonstrated in Table 3 .

(a)

(b)

Figure 4.1: a) reference tracking and (b) tracking error responses for the altitude

4.2.2. X position tracking


The result depicted in Figure (4.2) presents the simulation response of the position tracking in x-
axis by using sliding mode controller (SMC) and the error diagram between the desired and actual
values. The result shows that within a short period of time the controller gets the desired value and
give better response. It also presents that the error value becomes approximately zero with in a
finite time.

37
(a)

(b)

Figure 4.2: (a) trajectory tracking and (b) tracking error response of the x position simulation

4.2.3. Y position tracking


Figure (4.3) describes the simulation response of y position sliding mode controller for following
of a given trajectory. It can be seen from the figure that the controller gets the reference in
approximately 0.5seconds, which is minor, and the error becomes zero after this second.

(a)

38
(b)

Figure 4.3: (a) trajectory tracking (b) error response of y position

4.2.4. Psi tracking

The tracking response of psi in Figure 4.4 shows that the controller takes a few seconds time to
get a given desired value and have zero error thereafter.

(a)

(b)

Figure 4.4: (a) output tracking response of psi (b) error of the response of psi

4.2.5. Attitude phi and theta tracking


Figure (4.5) and (4.6) shows the simulation response of the rotational components phi and theta in
following a given trajectory and their respective tracking errors. As seen from the figure, the
39
response is highly oscillatory and it follows the desired input with a minimum error. However, it
is not exact tracking. This is because of the gain parameters and the controller.

(a)

(b)

Figure 4.5: (a) tracking response of phi (b) tracking error of phi

(a)

40
(b)

Figure 4.6: (a) tracking response of theta (b) tracking error of theta

4.2.6. Control inputs response


The response for the control inputs designed for SMC controller is shown in Figure 4.7.

(a) Control input U1

(b) Control input U2

41
(c) Control input U3

(d) Control input U4

Figure 4.7: SMC control inputs simulation response

4.2.7. Tracking response with disturbance


Since Hexacopter have lightweight, low power and slow speed, they can easily influenced by
external disturbances like wind, obstacles. This may disturb the flight performance and stability of
system. To overcome this problem, the system must be controlled by adding these unknown
disturbances. Figures 4.8- 4.11 shows the tracking response for the parameters when some random
disturbance is added to the system. The response shows that when some disturbance is added to
the system the controller gets the desired value with short time with minimum error values.

42
4.2.7.1. Z altitude position tracking

(a)

(b)

Figure 4.8: (a) z tracking response with disturbance (b) tracking error

4.2.7.2. X position tracking

(a)

43
(b)

Figure 4.9: (a) x position tracking response with disturbance (b) tracking error

4.2.7.3. Y position tracking

(a)

(b)

Figure 4.10: (a) y position tracking response with disturbance (b) tracking error

4.2.7.4. Psi tracking

44
(a)

(b)

Figure 4.11: (a) psi tracking response with disturbance (b) tracking error

Finally, the applied SMC controller for both rotational and translational components of a
Hexacopter gives a better response in following the given reference value with in a small response
time and steady state error. In addition, when random disturbance is added to the system it gives a
good tracking response.

45
Chapter Five

Conclusions and Recommendations


5.1. Conclusions
The main objective of this thesis work was to drive a mathematical model for a multirotor called
Hexacopter and to design a nonlinear controller that makes the system to track a specified reference
value for all the states of Hexacopter such as position, altitude, attitude and heading and to justify
the performance of the controller.

The mathematical model of a Hexacopter was formulated by using newton Euler formalism by
assuming the Hexacopter as a rigid body. A robust and nonlinear sliding mode controller (SMC)
was then developed. The entire system of the designed mathematical model of the Hexacopter was
implemented on MATLAB Simulink depending on the designed mathematical model of the
Hexacopter. The simulation environment was used to evaluate the correctness of the derived model
and the performance of the applied controller under a given condition.

Simulation results have shown that sliding mode controller (SMC) performs good in tracking a
reference value within a short settling time approximately in 0.5 seconds and has almost zero error
value. It has a significance on robustness and stability response.

5.2. Recommendations

The controller applied to the system has a good performance for tracking a reference but the tuning
method applied for the parameters of SMC is by trial and error. Developing a tuning equation to
better simplify the system is left for future study. Moreover, the control design for rotational
components could be improved by using a mixture of controllers such as adding fuzzy or neural
network with SMC to make the system more intelligent.

The dynamic model of a Hexacopter describes the dynamics of a real Hexacopter. A better physical
model of the system for instance, by adding a disturbance effect would make the system more
suitable for designing perfect controller and make the simulation design more realistic.

46
References
[1] Heba talla Mohamed, “Dynamic modeling and control of a Quadrotor using linear and
nonlinear approaches,” MSc thesis, American university, school of science and
engineering, Cairo, 2014.
[2] Luis Rodolfo G.C, Alejandro Enrique D.L, Rogelio Lozano, Claude Pegard, Advances in
industrial control, Quad rotorcraft control, 2012.
[3] Ruth Tesfaye, “Modeling and control of quad rotor unmanned aerial vehicle at hovering
position,” MSc thesis, Addis Ababa University, ECE department, Addis Ababa, December
2012.
[4] Johan Fogleberg, “Navigation and autonomous control of Hexacopter in indoor
environments,” MSc thesis, Lund University, Sweden, 2013.
[5] M.Moussid, A.Sayouti, H.Medromi, “Dynamic modelling and control of a Hexarotor using
linear and nonlinear methods,” International Journal of applied information systems-
ISSN: 2249-0868, vol. 9, no. 5, pp. 9-17, August 2015.
[6] A.Alaimo, V.Artale, C.L.R.Millazo, A.Ricciardello, “PID controller applied to Hexacopter
flight,” Journal of intelligent and robot system, vol. 73, pp.261-270, October 2013.
[7] A.Alaimo, V.Artale, C.L.R.Millazo, C.Orlando, A.Ricciardello, “LQR-PID control
applied to Hexacopter flight,” European society of computational methods in science and
engineering, vol. 9-10, no. 3-4, pp. 47-56, 2016.
[8] Geovanny D.C.G, O.Camacho, Control of Hexacopter: A sliding mode control and PID
controller, Rev. Tec. Ing. Universidad Del Zulia, vol. 39, no. 3, pp. 137-144, Venezuela,
December 2016.
[9] Tobias Magnusson, “Attitude control of a Hexarotor,” MSc thesis, Linköpings universitet,
EE department, Sweden, 2014.
[10] Farhad Parivash, Ali Ghasemi, Trajectory tracking control for a quadroter using fuzzy PID
control scheme, IEEE Fourth Int. conf. on KBEI, pp. 553-558, Iran, Dec.22, 2017.
[11] Andrzej Bartoszewicz, Sliding mode control, 1st ed. India: intech publisher, March 2011.
[12] Pablo Proano, Linda Capito, Andres Rosales, Oscar Camacho, Sliding Mode Control:
Implementation like PID for trajectory-tracking for mobile robots, IEEE Asia-pacific conf.
on CASE, pp. 220-225, Asia, 2015.

47
[13] Piazza d’armi, “A Quick introduction to sliding mode control and its applications,”
http://www.diee.unica.it.html.
[14] S.Lindblom, A.Lundmark, “Modeling and control of a Hexarotor UAV,” MSc thesis,
Linköpings universitet, EE department, Sweden, 2015.
[15] Matteo Vanin, “Modeling, identification and navigation of autonomous air vehicles,” MSc
thesis, university of padova, Information engineering department, 2012-2013.
[16] Tommaso Bresciani. Modeling, identification and control of a quadcopter helicopter, Lund
University, October 2008.
[17] V.Artale, C.Milazzo, A.Ricciardello. Mathematical modeling of Hexacopter, Applied
mathematical sciences, vol. 7, no. 97, pp. 4805-4811, Italy 2013.
[18] Murray L. Ireland, A.Vargas, D.Anderson. A comparison of closed loop performance of
multirotor configurations using nonlinear dynamic inversion control, Aerospace, vol. 2,
pp.325-352, June 2015.

48
Appendix

Simulink Block diagram

A. for x position tracking

B. for y position tracking

49
C. altitude and psi tracking

D. theta and phi tracking

50

You might also like