linear unknown input observer fordigilib.library.usp.ac.fj/gsdl/collect/usplibr1/index/... ·...
TRANSCRIPT
LINEAR UNKNOWN INPUT OBSERVER FOR
QUADCOPTERS
by
Krishneel Kumar
A thesis submitted in fulfillment of the
requirements for the degree of
Master of Science in Electrical and Electronics Engineering
Copyright © 2018 by Krishneel Kumar
School of Engineering and Physics
Faculty of Science, Technology and Environment
The University of the South Pacific
November, 2018
i
Acknowledgement It is a pleasure to thank those who made this thesis possible.
Firstly my supervisors Prof. Maurizio Cirrincione, Dr. Adriano Fagiolini and Mr.
Sheikh Izzal Azid for their endless guidance and support from the initial to the final
stages which enabled me to develop an understanding of the subject and successfully
.
Moreover, my parents Anil and Jainul Kumar, my brother Praneel Kumar and sister
Maureen Kumar for their encouragement and support towards finishing of the thesis
and being my pillar of strength.
Finally, a heartfelt thanks goes out to my friends and colleagues Hiye Mudaliar, Farhad
Ashab, Dhirendran Kumar, Paayal Kumar, Reginald Nath, Siwan Narayan and Shanil
Nand for their continuous help and support throughout the journey for the completion
of the project.
ii
Abstract A quadcopter is an Unmanned Aerial Vehicle (UAV) which changes its position and
orientation by four rotating blades. Due to its size and manoeuvrability, the quadcopter
has several uses. Some of which include natural disaster management, weather
monitoring, forest fire detection, emergency search and rescue, security, surveillance,
agriculture and academic teaching such as control engineering. Moreover, in the recent
decades, the use of quadcopters in various fields have vastly increased. This is due to
the significant advancements in technologies such as microcontrollers, motors and
sensors. Regardless of these uses and benefits of the quadcopter, a major cause of
concern for current researchers is to obtain stability of quadcopters subjected to
external disturbances (unknown inputs) to the system. An Unknown Input Observer
(UIO) is an observer which estimates the state variables of a system with the utility of
mathematical models by calculating the difference between measured and estimated
states in order to obtain residuals. The advantage of using a UIO over typical
Luenberger type observers is that it does not require any prior knowledge of the
unknown input in order to carry out the estimation. This thesis presents the design and
implementation of a linear Unknown Input Observer for quadcopters. The unknown
input or the external disturbance considered for this thesis is the effect of wind acting
on the body of the quadcopter. Both software and hardware tests were carried out in
order to test the robustness of the UIO on the quadcopter. The software
Matlab/Simulink and Gazebo were utilized for the software simulation of the UIO.
Two test cases were chosen to test the designed UIO in Matlab/Simulink. In the first
test case, step winds were applied to the quadcopter model whereas in the second test
case, military grade wind gusts were applied to the model. A further 3 test cases were
used to test the UIO in Gazebo whereby in two of the test cases, wind disturbances
were applied only to the x and y axis while the third case had wind disturbances applied
to the x, y and z axis. For the simulation of the UIO in Gazebo, ROS toolbox in the
Simulink library was utilized. This was used to establish communication between
Matlab/Simulink and Gazebo. From the results obtained from the software and
hardware tests, it could be said that the UIO was able to successfully estimate the wind
disturbance acting on the body of the quadcopter as the quadcopter was able to reach
its desired position regardless of the external disturbances through compensation of
such disturbances.
iii
Abbreviations 2D Two Dimensional
3D Three Dimensional
6DOF Six Degree of Freedom
APM ArduPilot Mega
DC Direct Current
DO Disturbance Observer
DWT Discrete Wavelet Transforms
ESC Electronic Speed Controller
FDIR Fault Detection, Isolation and Recovery
GPS Global Positioning System
IMU Inertial Measurement Unit
LiPo Lithium-ion Polymer
LQR Linear Quadratic Regulator
LTI Linear Time Invariant
MIMO Multiple Input Multiple Output
OS Operating System
PD Proportional Derivative
PI Proportional Integral
PID Proportional Integral Derivative
PWM Pulse Width Modulation
ROS Robot Operating System
SVD Single Value Decomposition
UAV Unmanned Aerial Vehicle
UIO Unknown Input Observer
iv
UNIX Uniplexed Information and Computing Service
Wi-Fi Wireless Fidelity
v
Table of Contents
Abstract ........................................................................................................................ ii
Abbreviations .............................................................................................................. iii
List of Figures ........................................................................................................... viii
List of Tables ................................................................................................................ x
Chapter 1 ...................................................................................................................... 1
Introduction .............................................................................................................. 1
1.1 Objectives of the Thesis ................................................................................ 2
1.2 Thesis Outline ................................................................................................ 3
Chapter 2 ...................................................................................................................... 5
Literature Review ..................................................................................................... 5
2.1 Unmanned Aerial Vehicles (UAVs) .............................................................. 5
2.2 Quadcopter Definition and its Purpose .......................................................... 6
2.3 History and Evolution of Quadcopters .......................................................... 6
2.4 Quadcopter Model and Operation ................................................................. 8
2.5 Methods Implemented to obtain Quadcopter Control and Stability .............. 9
2.6 Unknown Input Observers and its Applications/State of the art ................. 13
Chapter 3 .................................................................................................................... 19
Quadcopter Mathematical Modelling ..................................................................... 19
3.1 The 12 Quadcopter States ............................................................................ 20
3.2 Coordinate system of Quadcopters .............................................................. 20
3.3 Quadcopter Moments Equations ................................................................. 22
3.4 Dynamic Nonlinear Model of the Quadcopter ............................................ 23
3.5 Attitude Controller ....................................................................................... 23
3.6 Position Controller ....................................................................................... 30
3.7 Simulink Quadcopter Model with Attitude and Position Controllers ......... 34
3.8 Chapter Summary ........................................................................................ 35
vi
Chapter 4 .................................................................................................................... 36
Linear Unknown Input Observer for Quadcopters ................................................. 36
4.1 Unknown Input Observer Theory ................................................................ 36
4.2 Need for UIO for Quadcopters .................................................................... 36
4.3 UIO Design Process .................................................................................... 37
4.4 UIO Design for Quadcopter Model ............................................................. 43
4.5 UIO Implementation in Matlab/Simulink ................................................... 44
4.6 Chapter Summary ........................................................................................ 46
Chapter 5 .................................................................................................................... 47
Gazebo Simulation of Erle-copter with UIO .......................................................... 47
5.1 Launching the Erle-copter model in Gazebo ............................................... 48
5.2 Interfacing Matlab/Simulink with Gazebo via ROS ................................... 49
5.3 Simulation of the Erle-copter ...................................................................... 50
5.4 Chapter Summary ........................................................................................ 52
Chapter 6 .................................................................................................................... 53
Hardware Implementation ...................................................................................... 53
6.1 Components of the Erle-copter .................................................................... 53
6.2 Connection of the Erle-copter to an Ubuntu Machine ................................. 56
6.3 Erle-copter Setup and Calibration ............................................................... 57
6.3.1 Erle-copter Parameters ......................................................................... 58
6.4 Automatic Standalone Node Generation ..................................................... 58
6.4.1 Running the Generated ROS node ....................................................... 63
6.5 Experimental Setup ..................................................................................... 64
6.5.1 Wind Measurement .............................................................................. 64
6.5.2 Measured Wind Data Analysis ............................................................. 64
6.5.3 UIO Hardware Test .............................................................................. 65
6.6 Chapter Summary ........................................................................................ 66
vii
Chapter 7 .................................................................................................................... 67
Results - Software and Hardware ........................................................................... 67
7.1 Software Results .......................................................................................... 67
7.1.1 Matlab/Simulink ................................................................................... 67
7.1.2 Gazebo .................................................................................................. 75
7.2 Hardware Results ......................................................................................... 81
7.3 Chapter Summary ........................................................................................ 84
Chapter 8 .................................................................................................................... 86
Conclusion .................................................................................................................. 86
Reference .................................................................................................................... 88
Appendix .................................................................................................................... 94
Appendix A: Design of the UIO for the Derived Quadcopter Model .................... 94
viii
List of Figures Figure 2-1: UAV Classifications.................................................................................. 5
Figure 2- .6
Figure 2-3: Plus Configured Quadcopter ..................................................................... 6
Figure 2- 7
Figure 2-5: Georges de Bothezat ................................................................................. 7
Figure 2- .7
Figure 2-7: Curtiss-Wright ........................................................................................... 7
Figure 2-
Figure 2-9: Movement of the Quad copter ................................................................... 9
Figure 3-1: Inertial and Body Fixed Frame of Quadcopter ........................................ 20
Figure 3-2: Direction of rotation of the rotors of quadcopter with reference frames . 22
Figure 3-3: Linear Quadcopter Model ....................................................................... 34
Figure 3-4: Graph of Quadcopter Path ....................................................................... 35
Figure 4-1: Quadcopter Model with Wind Disturbance............................................. 36
Figure 4-2: Graph of Quadcopter Path Subjected to Wind Disturbance .................... 37
Figure 4-3: UIO Design.............................................................................................. 43
Figure 4-4: UIO Implementation in Matlab/Simulink ............................................... 44
Figure 4-5: Graph of Estimated and Actual Wind Force ........................................... 45
Figure 5-1: Erle-copter spawned in Gazebo Simulator .............................................. 48
Figure 5-2: Simulink Block Diagram for Gazebo Simulation ................................... 50
Figure 5-3: Segment of Simulink for Subscribing Position and Attitude data........... 51
Figure 5-4: ROS Computation Graph ........................................................................ 52
Figure 6-1: Erle-copter ............................................................................................... 53
Figure 6-2: Erle Brain 3 ............................................................................................. 53
Figure 6-3: Electronic Speed Controller (ESC) ......................................................... 54
Figure 6-4: Brushless DC Motors .............................................................................. 54
Figure 6-5: Propellers of the Erle-copter.................................................................... 55
Figure 6-6: Power Module ......................................................................................... 55
Figure 6-7: The Global Positioning System (GPS) + Compass ................................. 56
Figure 6-8: LiPo Battery ............................................................................................ 56
Figure 6-9: Hardware Board Setting .......................................................................... 59
Figure 6-10: Build Options ........................................................................................ 60
ix
Figure 6-11: Connection to ROS Device Dialog Box ................................................ 60
Figure 6-12: ROS Device Connection Test ............................................................... 61
Figure 6-13: Output of the rosdevice Command ........................................................ 61
Figure 6-14: Network Connection Settings in Simulink ............................................ 62
Figure 6-15: rosdevice Command Properties after Node Generation ........................ 63
Figure 6-16: Experimental Setup ............................................................................... 64
Figure 6-17: Simulink Model for Hardware Testing ................................................. 65
Figure 7-1: Graph of Estimated and Actual Wind Force ........................................... 68
Figure 7-2: 3D Plot of Quadcopter Path..................................................................... 68
Figure 7-3: Graph of Wind Estimation Error ............................................................. 69
Figure 7-4: Graph of Estimated and Actual Wind Force ........................................... 70
Figure 7-5: 3D Plot of Path of Quadcopter ................................................................ 70
Figure 7-6: Graph of Wind Estimation Error ............................................................. 71
Figure 7-7: Graph of Estimated and Actual Wind Force ........................................... 72
Figure 7-8: 3D Plot of Path of Quadcopter ................................................................ 72
Figure 7-9: Graph of Wind Estimation Error ............................................................. 73
Figure 7-10: Graph of Estimated and Actual Wind Force ......................................... 74
Figure 7-11: 3D Plot of Path of Quadcopter .............................................................. 74
Figure 7-12: Graph of Wind Estimation Error ........................................................... 75
Figure 7-13: Graph of Estimated and Actual Wind Force ......................................... 76
Figure 7-14: 3D Plot of Path of Quadcopter .............................................................. 76
Figure 7-15: Graph of Wind Estimation Error ........................................................... 77
Figure 7-16: Graph of Estimated and Actual Wind Force ......................................... 78
Figure 7-17: 3D Plot of Path of Quadcopter .............................................................. 78
Figure 7-18: Graph of Wind Estimation Error ........................................................... 79
Figure 7-19: Graph of Estimated and Actual Wind Force ......................................... 80
Figure 7-20: 3D Plot of Path of Quadcopter .............................................................. 80
Figure 7-21: Graph of Wind Estimation Error ........................................................... 81
Figure 7-22: UIO Estimation for Wind Force (x-axis) .............................................. 82
Figure 7-23: UIO Estimation for Wind Force (y-axis) .............................................. 82
Figure 7-24: 3D Plot of Erle-copter Path ................................................................... 83
Figure 7-25: Graph of Wind Estimation Error ........................................................... 83
Figure 7-26: 2D Plot of Erle-copter Path ................................................................... 84
Figure 7-27: Erle-copter Attitude ............................................................................... 84
x
List of Tables Table 3-1: 12 States of the Quadcopter with its Description ..................................... 20
Table 5-1: ROS Blocks used and their Purpose ......................................................... 49
Table 6-1: Erle-copter Parameters.............................................................................. 58
1
Chapter 1 Introduction In the past few decades, the use of quadcopters has vastly increased in all fields. This
is due to significant advancements in technologies such as microcontrollers, motors
and sensors and also because of reduction of prices of these electronic devices [1, 2].
Some of the uses of quadcopters can be used for natural disaster management, weather
monitoring, forest fire detection, traffic control, cargo transport, emergency search and
rescue, communication relaying, security, surveillance, agriculture and academic
teaching such as control engineering [3, 4]. Advantages of quadcopters include high
maneuverability, a relatively cheap price and a simple construction [5]. Regardless of
these uses and advantages of quadcopters, a major challenge for researchers today is
obtaining the stability of these quadcopters in flight when subjected to external forces
unknown to the system.
In any control system, there exist inputs to the system which are not known as they are
not measurable or are acting as an external disturbance on the system. These factors
cause the system to not function optimally and hence a control mechanism needs to be
designed to cater for such unknown inputs. For the purpose of this thesis, the unknown
input or the external disturbance acting on the quadcopter will be classified as wind.
The wind causes the quadcopter to become unstable in its operation and hence unable
to reach its desired location. The significance of this thesis is to present a method of
estimating external disturbances (i.e. wind) acting on the body of the quadcopter and
then compensating them allowing the quadcopter to precisely reach its desired
location.
In order to estimate the wind acting on the quadcopter, an Unknown Input Observer
(UIO) is proposed in the thesis. The UIO will be utilized to reconstruct the wind gusts
which are unknown to the system that affects the behavior of the rotors in order to
obtain stable operations of the quadcopter in its path. The UIO approach estimates the
state variables of the system with the utility of mathematical models and finally
reconstructs the wind by calculating the difference between measured and estimated
states in order to obtain residuals [6, 7].
2
1.1 Objectives of the Thesis
In order to achieve the main aim of the thesis which is to design a linear UIO for
quadcopters, various objectives have been laid out. These objectives include:
1. Deriving the linearized model of the quadcopter.
For this objective, a linearized model of the quadcopter has to be derived. From the
nonlinear equations, a linearized model of the quadcopter will be obtained by assuming
hovering conditions. A cascaded position and attitude controller will be developed
consisting of a PD control.
2. Designing of the Unknown Input Observer for the linearized model of the
quadcopter.
In order to achieve this objective, the UIO will be designed taking into consideration
the model of the quadcopter. It will be ensured that the necessary conditions for the
existence of the UIO are satisfied then the design process for the development of the
UIO will be followed.
3. Software implementation of the UIO on the quadcopter model using
Matlab/Simulink.
For this objective, the quadcopter mathematical linear model will be implemented in
Matlab/Simulink. Then the designed UIO will be implemented in the design scheme
of the quadcopter model in Matlab/Simulink. The output from the model will be fed
into the UIO together with the known inputs (4 rotor speeds) by using which the UIO
outputs the estimated disturbances (wind) applied to the system, thereby allowing the
system to compensate for these disturbances.
4. Testing of the UIO using Gazebo software.
For this, the UIO will be tested with actual parameters of the quadcopter (Erle-copter)
to visualize how the quadcopter would perform in the actual hardware test by utilizing
the available Erle-copter model provided in Gazebo. To achieve this, Matlab/Simulink
has to be interfaced with Gazebo. For this purpose, the Robot Operating System
toolbox in Simulink will be utilized. Publish ROS blocks will be used to send data to
the Erle-copter model in Gazebo through Simulink while the Subscribe ROS blocks
will be used to get data from the Erle-copter model in Gazebo.
3
5. Hardware implementation of the UIO on the quadcopter via ROS and Simulink.
In this part, the UIO will be tested on a real quadcopter (Erle-Copter). Connection to
the quadcopter will be established through its internal Wi-Fi module and ROS will be
used with Matlab/Simulink to build and upload the program inside the brain of the
quadcopter. The quadcopter will then be tested on windy days and the ability of the
UIO implemented to estimate the wind acting on its body will be assessed.
1.2 Thesis Outline
This thesis is divided into 8 chapters. The content of each of these chapters are as
discussed below:
Chapter 2: In this chapter, a review of the past and present work relating to the thesis
is presented. The readers are provided with the background knowledge of the subject
of the thesis. The chapter concludes with indicating what the thesis aims to achieve
by the proposed work.
Chapter 3: In this chapter, a linearized mathematical model of the quadcopter, more
specifically the linear attitude controller and linear position controller is derived. This
mathematical model is then implemented using the software Matlab/Simulink.
Chapter 4: The linear Unknown Input Observer is designed in this chapter for the
linear model of the quadcopter developed in the previous chapter. All necessary and
sufficient conditions required for the existence of the UIO are presented. The UIO is
then implemented with the quadcopter model in Matlab/Simulink.
Chapter 5: In this chapter, the designed UIO for the quadcopter is tested in Gazebo
software where the actual parameters of the real quadcopter (Erle-copter) is used. This
chapter presents as to how Simulink is interfaced to Gazebo via Robot Operating
System (ROS) toolbox. The entire process of simulating the Erle-copter in Gazebo
software is presented in this chapter.
Chapter 6: In this chapter, steps of hardware implementation of the Erle-copter with
the designed UIO are discussed. The hardware setup of the Erle-copter are presented
and the tasks carried out to achieve hardware implementation of the UIO have been
outlined and discussed.
Chapter 7: The software results from Matlab/Simulink and Gazebo as well as the
hardware results of the quadcopter with the UIO subjected to external disturbances
4
(wind) are presented in this chapter and important conclusions about the behavior of
the designed system are made.
Chapter 8: This is the concluding chapter where discussions are made about the results
and recommendations for future work are proposed.
5
Chapter 2 Literature Review
2.1 Unmanned Aerial Vehicles (UAVs)
An Unmanned Aerial Vehicle (UAV) is a powered aircraft that produces either
computer or remote controlled motion utilizing aerodynamic forces and operates
without human carriers [8]. In the past few decades, the popularity of UAVs have
vastly increased due to the improvement in the technological advancements and the
reduction of prices of electronic devices such as microcontrollers [8]. UAVs have
significantly contributed to the recent technological innovations with their capacity to
replace manned aerial vehicles thus, diminishing numerous aerial operational costs [9].
Introduction of the first successful UAV flight was perceived in 1920s whereby a
sophisticated device was built. With developments in electronics engineering, research
introduced devices of increasing power, low weight and decreased complexity [8].
UAVs can move in any direction and are capable of low speed flights. Specified these
characteristics, UAVs play crucial roles in rescue and search missions, meteorology,
medical emergencies and other suited applications in control engineering [10]. UAVs
can be classified according to the categories shown below:
Figure 2-1: UAV Classifications [11]
6
2.2 Quadcopter Definition and its Purpose
A quadcopter is a flying object which changes its attitude and altitude by four rotating
blades [5]. The four rotors of the quadcopter are directed upwards and are placed in a
square formation, each, an equal distance away from the center of mass of the
quadcopter [2, 12]. There are two major configurations of the quadcopter which are
the plus (+) and cross (x) configurations. In the x configuration quadcopter, the two
rotors spinning in the same direction are tilted at an angle of 45 degrees from the x and
y axis, whereas the same spinning motors in the plus configuration are aligned with
the x and y axis. According to [11, 13], an x configured quadcopter is considered to
have more stability when compared to the + configuration which is more suited for
acrobatic maneuvers.
Figure 2-2: Cross Configured Quadcopter [11] Figure 2-3: Plus Configured Quadcopter [11]
In the past, quadcopters were primarily used for military applications [3] where they
were used for dangerous and hostile conditions which could pose threat to the lives of
humans if carried out by them. However, the recent decrease in the price as well as
size of semi-conductor logic and due to significant advancements in technologies such
as microcontrollers, motors and sensors, the application of quadcopters in several other
fields have been achieved such as natural disaster management, weather monitoring,
forest fire detection, traffic control, cargo transport, emergency search and rescue,
communication relaying, security, surveillance, agriculture and academic teaching
such as control engineering [1-5].
2.3 History and Evolution of Quadcopters
The French Scientist Charles Richet built in the 20th century a small unpiloted
helicopter [10]. While his attempt to accomplish was unsuccessful, it inspired one of
his students Jacques Bréguet, together with his brother Louis Bréguet, to the
construction of an aerial unmanned vehicle, the first quadrotor.
7
The quadrotor was built in 1907 and the first unmanned flight was registered by the
Gyroplane No.1 (Figure ). Each propeller of the quadrotor was 8.1 meters in
diameter and weighed 578 kg which was powered by a 50 horse power (37.3kW)
internal combustion engine [14]. This was however a tethered flight. The main reason
for the helicopter not to fly freely was due to the lack of proper control and stability.
More attempts were made after the flight of the Gyroplane No. 1, but these attempts
were more focused on manned quadrotors for example the Flying Octopus in Figure
2-5 by Georges de Bothezat in 1922 and the Oemichen No. 2 in Figure 2-6 by Etienne
Oemichen also in 1922. Apart from these attempts to manned quadrotors, other
attempts had also been made such as the Convertawings Model A by Oemichen and
de Bothezat in 1922, the Curtiss X-19 by Curtiss-Wright Corporation in 1963 which is
shown in Figure 2-7 below, the Bell X-22A in 1966 by Bell Aircraft Corporation and
the fly vehicles of the Moller Company [14].
Figure 2-4: Bréguet Richet Gyroplane No. 1 [14] Figure 2-5: Georges de Bothezat [14]
Figure 2-6: Oehmichen No.2 [14] Figure 2-7: Curtiss-Wright [14]
A quadcopter has a Six Degree of Freedom (6DOF), i.e. it is able to move in both the
translational and rotational directions (translational x, y and z and rotational roll, pitch
and yaw) [2, 11] and [12]. The position and altitude of quadcopters change in space
and its motion is controlled by varying the speed of the individual four rotors. Since
the number of system inputs (4) are less than the number of outputs, this causes the
8
quadcopters to be severely under actuated and dynamically unstable with four input
forces for each rotor, four propulsors and four controllable variables.
A quadcopter can be defined as a helicopter with 4 rotors. It is a dynamic system
which is under-actuated as it has four input forces where one force acts on each of the
rotors and has a six Degree of Freedom (6DOF) [9].
In order to obtain a stable flight, various high accuracy sensors with fast robust control
algorithms are combined [2]. Currently, quadcopters are being intensively developed
in three major technological advances: military, transportation and entertainment [10].
2.4 Quadcopter Model and Operation
The role of each rotor of the quadcopter is to generate a certain amount of thrust and
torque around the quadcop also to generate a drag force
which will be produced in the quadcopters opposite direction of flight [10]. The
propellers of the quadcopters are always divided into two pairs which are the pusher
blades and the puller blades which operate in contra-rotation. Hence, if all of the four
propellers work with the same angular velocity then the resulting net torque is zero and
the quadcopter remains still around its center of gravity [10].
In the 6DOF, the motion of the quadcopter is controlled by individually varying the
speed of each of the four rotors, which in turns manipulates the lift and rotational
forces. In order to define the orientation of the quadcopter around its center of mass,
three dynamic parameters are essentially defined which are the roll, pitch and yaw
angles [10]. Referring to (Figure 2-8), in order to obtain the changes in the pitch angle
the speed of the propellers 1 and 3 are varied which results in the forward and backward
movement of the quadcopter. Likewise, the change in roll angle is produced by
varying the speed of the propellers 2 and 4 and thus will achieve lateral movement of
the quadcopter. Moreover, the change in the yaw angle is achieved by creating a
mismatch of the thrust generated between the counter rotating pairs of blades.
Therefore, a quadcopter can be maneuvered in a desired direction by controlling the
roll, pitch and yaw angles of the quadcopter [10].
9
Figure 2-8: Configuration of a Quad copter [10] Figure 2-9: Movement of the Quad copter [15]
Figure 2-8 demonstrates the direction in which the roll, pitch and yaw angles act on,
causing the actual movement of the quadcopter. The maneuverability of the
quadcopter can be achieved through the variation shown above in Figure 2-9 which
shows the rotor speed variations needed in order to achieve movements in each desired
direction.
2.5 Methods Implemented to obtain Quadcopter Control and Stability
Although quad rotors have witnessed massive evolution, its control system
are highly non-linear due to coupled translational and rotational motion, very little
friction and additional aerodynamic effects generating an intriguing control obstacle
[2]. Thus, a sophisticated control becomes mandatory. To conquer this, continuous
research is being directed towards the introduction of upgraded robust controllers and
modelling techniques to produce comprehensive and precise representations of real life
unmanned aerial vehicles [10].
Due to the need of quadcopters to maintain a stabilized autonomous system, several
linear and non-linear control methods such as PD, PI, PID, LQR and non-
have been implemented. Karwoski (2011) in a study of Quadrocopter Control Design
and Flight Operation compared the PD controller with PI and PID controllers in
obtaining the stability of the quadcopter and meeting system specifications. Only the
phi (roll) axis was used for the purpose of testing the controllers [16]. The PI
controller, was ineffective in controlling of the quadcopter as the integral component
of the controller was unable to counter the oscillations in the system. Moreover, the
study further showed that when using a PID controller, the overshoot of the system
was reduced slightly but on the other hand, increased the steady state error. This
10
however was not evident in the PD controller. Due to this fact, the PID controller was
deemed unnecessary for the system. Similarly, Gibiansky (2012) in his paper on
Quadcopter Dynamics, Simulation, and Control also compared the use of PD and PID
controllers in the application of quadcopters. The PD controller was used in the
quadcopter model to drive the angular velocities and angles to zero [17]. However,
from simulations, it was noted that the angles were not completely driven to zero
together with the steady state error. This was demonstrated as a common error
associated with the use of PD controllers which could be slightly improved by the use
of PID controllers [17]. The advantages of the PD controller lies in its simplicity as
well as the ease of implementation, but falls short in controlling of mechanical systems
especially in the presence of noise and disturbances and often results in producing
higher steady state error [17]. Hence a PID controller was used to compensate for the
shortcomings of the PD controller. As is known, the PID controller includes an extra
term incorporated which is the integral term, hence, contrary to [16], this enables the
controller to reduce the steady state error as it is able to track the path of the quadcopter
and help stabilize it with a much smaller steady state error when compared to the PD
controller. Likewise, [18] compares the robustness of a classical PID with a cascaded
PID control. The merits of a PID control have been emphasized by several authors
such as in [19-21]. PIDs have been widely used in order to achieve stability for the
quadcopters and has been quite effective as well. According to [18], the main
drawback of PIDs is that when the disturbance causes a large error in the system, the
steady state response is compromised hence providing a less robust control system.
Therefore, a cascaded PID has been implemented for the stability of the quadcopter by
lowering the system sensitivity to external disturbances.
Moreover, in [12], a PD controller is implemented in order to achieve stability for the
quadcopter. The PD controller was chosen due to its simplicity and ease of
implementation. However, the accelerations in the x and y directions are not
considered by the PD control method hence giving need for the construction of another
control method that would provide access to all of the positions and angles of the
quadcopter. Therefore, a heuristic method is utilized for the trajectory control of the
quadcopter that enabled the quadcopter to move from the current position to the desired
position by controlling the quadcopter rotor velocities. According to [22], another
method to take into account the possible deviations in the angles, was to integrate a PD
11
controller into the heuristic method. The integrated PD controller was proposed to
reduce the fluctuations in quadcopter behavior under external forces. This proposed
method performed well in the example cases, but performance was dependent on the
parameter values and so if the parameter values were small, the controller would not
respond quickly enough to follow the planned trajectory. A PD control method for the
stabilization of the quadcopter has also been proposed in [23]
observer for fault detection and isolation tasks. From the test results, it was seen that
the accelerometer and inclinometer faults could be detected as well as isolated.
However, disturbance rejection strategy was still under investigation. In addition, [3]
shows that a quadcopter with payload is able to compensate for external disturbances
with a use of a PID controller. According to [3], one of the most popular ways of
controlling a quadcopter is through the use of PID controllers. In order to represent an
external force such as wind acting on the quadcopter, a disturbance was introduced.
From the test results the paper concluded that with the utilization of the PID controller,
the quadcopter was able to compensate the applied disturbances correctly.
Furthermore, [24] proposes the control of a quadcopter with the implementation of a
PID control together with the 1 adaptive control. A PID would be sufficient enough
to control a quadcopter however, in the presence of disturbances and uncertainties, this
control is highly compromised [24]. In order to counter the problem of these
disturbances and uncertainties, the 1 adaptive control is implemented due to its fast
and robust adaptation for the desired performance in the presence of disturbances and
uncertainties. The advantage of 1 adaptive control is that it can be used in a system
with varying parameters and uncertainties [24]. When compared with the PID control,
the 1 adaptive control has a faster adaptation to the present disturbances and
uncertainties due to its high adaptation gain.
Similarly, Balas (2007) in his MSc thesis compared a PID controller, LQR controller
and H infinity controller for the control part of the quadrotor. The PID controller was
implemented on the linearized model for the control of the attitude around the hover
situation [25]. Both software simulation and validation of the simulation on the real
system were carried out and showed efficient results in terms of the steady state error.
However, this situation was only possible if the quadcopter was in hover position and
if strong disturbance was applied on the system, the quadcopter with the PID controller
would not be able to reach the hover position on its own. In addition, two forms of
12
LQR controllers, namely classic and state dependent LQR controllers, were also
discussed by Balas in his thesis. These controllers were used to obtain stable
operations of the quadcopter at hover position. A disadvantage for the classic LQR
controller is that it does not produce satisfactory results at higher thrust levels. Finally,
the H-infinity controller was studied in the thesis for the stabilization of the quadcopter.
The major role of an H-infinity controller was to produce robust stability as well as
good control of the trajectory of the quadcopter [25]. The H-infinity controller
possesses a great advantage of being divided into two loops which are the inner loop,
responsible for the stabilization of roll, pitch and yaw angles as well as the vertical
speed, and the outer loop, responsible for the longitudinal and lateral speed, the height
and the yaw angle of the quadcopter. This configuration enables the controller to
provide satisfactory results when the quadcopter is subjected to various inputs and
disturbances. Domingues (2009) utilized a linear quadratic regulator for the optical
control of the system. The linear quadratic regulator had been utilized since it is able
to control Multiple Input Multiple Output (MIMO) systems since in quadcopters, there
are inputs in terms of motor speed of the four rotors as well as outputs in the form of
sensor readings for which using a classical controller would be quite difficult to
implement [10]. However, after running the tests on the system, it was observed that
when all 12 states of the quadcopter were readable, the linear quadratic regulator was
able to fully control the system but when only 6 of the 12 states of the quadcopter were
readable then the linear quadratic regulator was only able to control the 6 available
states while the other 6 visibly drifted with time [10].
Furthermore, [4] proposes a sliding mode control approach in order to control a
quadcopter in the presence of external disturbances as well as quadcopter actuator
faults. This control method had been specif
insensitivity to the errors of the model, uncertainties in the parameters and external
disturbances. The Sliding Mode control structure has the advantage of rejecting
disturbance in fault free conditions as well as aids in recovery of some control
performances in the situation of a fault. Main disadvantage of this method is that it is
unable to control the system in the presence of a fault. Similarly, for the estimation of
external disturbances acting on the body, [26] presents a nonlinear disturbance
observer where Lyapunov stability theory was used to analyze the stability of the
disturbance observer. From the results, it was concluded that the backstepping
controller with the disturbance observer was able to track the position of the quadcopter
13
despite the presence of external disturbances acting on the body. According to [26], it
should be noted that the control strategies mentioned in [27-32] do not provide
robustness against external disturbances and uncertainties in the value of the
parameters as they assume to have zero external forces acting on the quadcopter. In
[10], a method of using Kalman filter for the control of the quadcopter was proposed.
However, it was observed that when using the Kalman filter, only six (angular speeds
and Euler angles) out of the twelve states of the quadcopter were available for control.
Moreover, it was also found out that none of the system states were reachable.
Following these findings, two LQR controllers were developed, one for an ideal system
where all of the twelve states were available for control and the second one where only
6 states were available from the Kalman filter.
2.6 Unknown Input Observers and its Applications/State of the art
The present study focuses on the use of Unknown Input Observers (UIO) for obtaining
stability in the control of quadcopters being subject to external/unknown disturbance
(wind). The UIO will be utilized to reconstruct the wind gusts which are unknown to
the system that affects the behavior of the rotors in order to obtain stable operations of
the quadcopter in its path. The UIO approach estimates the state variables of the
system with the utility of mathematical models by calculating the difference between
measured and estimated states in order to obtain residuals [6, 7]. Research describes
unknown input observers as linear observers that are entirely independent of the
immeasurable disturbances and principally estimate the error of the state decoupled
from these disturbances (unknown input) [33]. According to [6], an observer can be
classified as an unknown input observer if the error of its state estimation
asymptotically reaches zero regardless of the unknown input present in the system.
Assuming perfect knowledge of the model it exactly decouples the effects of external
disturbances from the state estimation.
A first observer was proposed in early 1960s by Luenberger and further developed.
Afterwards, early literature had focused on observers for purely continuous-time linear
time-invariant systems after which the theory had been modified and developed into
various discrete, stochastic and time-varying systems [10]. According to [34], a
Luenberger type observer cannot be directly designed for systems with unknown
inputs since it requires knowledge of the input for estimation. Linear system with
unknown input is divided into two classes; the full and the reduced order approaches
14
which can be further classified into geometric, algebraic, and generalized inverse
approaches. Full-order designs are simpler and estimate all the states, whereas reduced
order approach are more complex and tend to avoid redundancy caused due to
reconstruction of states [57].
According to [35-39], the problem of designing an observer that is subjected to inputs
which are unknown has been the pole of attraction for many researchers. Since there
are cases which often occur whereby some of the system states are not accessible due
to the unmeasurable disturbances, this problem tends to be of considerable interest
from both the theoretical and practical viewpoint. Since a conventional observer
cannot be utilised in systems subjected to disturbances, this problem gains a greater
significance. According to [34], a Luenberger type observer cannot be directly
designed for systems with unknown inputs. Hence, the reason why several different
approaches to an observer design for unknown inputs have been studied by many
researchers.
As stated in [7], observers add complexity to the system and require computational
resources. Moreover, when the parameters of the plant in operation changes
substantially, the observers become less robust when compared to physical sensors.
However, skillful application of an observer can provide substantial benefits in
performance and is the case in many research papers. Examples of impressive
applications of nonlinear observers to the control of electric machinery can be found
in [40-42]. Two main types of observers are full-order observers and reduced order
observers [43].
Due to the advantage of the reduced order observers being able to avoid redundancy
in the reconstruction of states and saving computational time, many researchers have
based their research on the reduced order observer type. For instance, [37, 39 and 44]
proposes the design of a reduced order observer for the observation of unknown inputs.
In papers [39, 44], the reduced order observer is simplified to a standard observer
through some simple substitutions and coordinate transformations and thus making it
possible to be solved through the famous Luenberger theory. As a result, the design
of the observer is further simplified. Moreover, [37] also presents the design of a
reduced order observer and their approach consists of characterizing the observer with
a delay enabling in the ease of establishment of the necessary conditions of the
existence of the unknown input observer. The results of these papers indicate that the
15
designed observers were successfully able to observe the unknown inputs present in
the system. On the other hand, [38] compares the full order observer with the reduced
order and states that even though the reduced order observer has the advantage of a
faster computational time, it may restrict the rate of convergence of some of the state
estimates. Therefore, due to the simplicity in its design, many researchers have also
preferred utilizing the full order observers for systems with unknown inputs. In [45],
a full order observer is proposed. The full order observer is reduced to a standard
observer in order to simplify the design process by switching from unknown inputs to
inputs which are known. This is similarly seen in [46] where a full order observer is
reduced to standard observer where unknown inputs are converted to inputs which are
known and hence simplifying the overall design.
Unknown input observers (UIOs) have been extensively used in induction motor
applications and it has been investigated by several researchers. Observers with non-
linear decoupling can be used to detect faults in the machines via residual generation,
non-linear approaches can be used for fault diagnosis of the motor. In 2006, Chung-
Wei et al. detected a servomechanism fault by developing a detection procedure
established on the PI controller and discrete wavelet transforms (DWT) method. UIOs
have been useful in fields of studying fault detection, isolation and recovery (FDIR)
systems such as in cases of aircraft elevator redundancy control systems. New
approaches have also introduced UIOs in sensor fault estimation techniques. Spurgeon
in 2008 presented uniqueness in sliding mode observers for its ability to generate
sliding motion between measured and observer outputs [33]. Similarly, Guezmil et al.
in 2015 compared the performance of a High Order Sliding Mode and Unknown Input
Observer which was embedded in the integral sliding mode control scheme for the
drive of an induction machine [47]. The overall stability of the system was achieved
through the theory of Lyapunov. The purpose of the two controllers were to estimate
the machine states. The controllers were compared against each other to determine
how robust each controller was in both high and low speeds under machine resistance
and disturbances in terms of load. The comparisons showed that the High Order
Sliding Mode controller was more robust in achieving better speed and flux tracking
when there were variations in the induction machine parameters [47].
Moreover, UIOs have been constantly associated with fault detection and isolation in
induction motor actuators. UIO is used to compute residuals attained from the
16
difference between the actual and estimated outputs which tend to eliminate the effects
emerging from unknown disturbances on the system. Gaeid et al. deduced a fault
detection and isolation of a multiple input multiple output based system resulting in
the design of several fault banks. These banks generated residuals which are sensitive
to only a specific fault [48]. Actuator faults associated with UIO fault detection was
also studied by Ermeydan et al. which utilized a derived linear model from a nonlinear
model using Jacobian matrix to detect and isolate actuator faults. The technique of
generalized observer scheme based UIO was used. Observer based state estimation is
applied in order to find and isolate the faults in the system so that state estimation error
could be decoupled when there are unknown inputs in the form of disturbances. For
stabilization and control, linear quadratic tracking and linear quadratic regulators are
implemented to compensate for the resulting steady- state errors [6]. Gaddouna et al.
developed a fault detection based UIO for a linear time invariant system subjected to
only random unknown inputs. The method designed utilized a mathematical algorithm
comprising of matrix inverses [49].
In addition, unknown input observers are also used in models associated with control
designs for improving efficiency in motion systems. Hsu et al. (2001) developed an
UIO constructed procedure to decouple the influence of external disturbances which
in real life would impeccably enhance the performance of motion systems. Riccati
equation is applied to diminish the estimation error via the design of an ideal UIO [50].
Liu et al. (2002) proposed a sophisticated scheme to simultaneously approximate
unknown states as well as disturbances of a linear time invariant system employing an
output feedback observer. Researchers applied Luenberger-like observer to estimate
states and inverse dynamics to estimate disturbance signals. The structured design
apparently can be applied to a diverse range of disturbances since the strategy does not
incorporate any disturbance model for estimation [51]. Pillosu et al. (2012) linearized
a nonlinear system and combined a conventional linear UIO with a non-linear
Disturbance Observer (DO) constructed on the sliding mode method to design an
algorithm. The designed scheme efficiently estimated the time varying infiltration and
discharge parameters of an open channel hydraulic arrangement [52].
Other work on the UIO includes in [34] where a novel approach for the design of the
UIO was presented. According to [34], a UIO has a derivation of system inputs which
is not available from the measurement directly. Hence, a Block function differential
17
operations method for the design of the UIO is proposed which would enable the
designed UIO to not need the derivation of the system outputs for the estimation of the
unknown inputs. Moreover, in [53], an output feedback controller is proposed that
would simultaneously estimate both the unknown states and the disturbance of linear
time invariant (LTI) systems. For the estimation of the states, a Luenberger-like
observer is used while an inverse-dynamics motivated algorithm is used for the
disturbance estimation. A major advantage highlighted for this method was that the
proposed method could be applied to any system with different disturbances since no
disturbance model is required for the estimation. In [54], the method of Single Value
Decomposition (SVD) to design a Luenberger observer that could be used in a system
with unknown inputs is presented. The advantage of using the SVD method is that it
provides a practical way of implementing the observer design. In addition, [55]
proposes a method of an algebraic design of UIO that does not satisfy the observer
matching condition for systems which are linear and subjected to unknown input.
According to [55, 56], the decoupling principle of the UIO where the observer is
designed to be insensitive to unknown inputs has been one of the most successful
observer techniques. The method however has a drawback which is that the dimension
of the observer increases considerably.
To sum up, Quadcopters as discussed above have various applications and advantages
but a major cause of concern is the ability to obtain control over the quadcopter in its
trajectory due to unexpected obstacles and external noises. In order to achieve this
desired control and stability of the quadcopters, several researches have been carried
out proposing different approaches to obtain this control and stability. One possible
approach which could be used on the quadcopters for this control and stability is the
use of an Unknown Input Observer. This technique has been previously used in
induction machines for detection of faults and hence this study would like to further
extend this technique by implementing it on quadcopters.
This thesis presents a Linear Unknown Input Observer for quadcopters. The unknown
input observer will be used to reconstruct the wind gusts (external
disturbance/unknown inputs) in order to estimate the unknown input acting on its body
and thus compensate for these external disturbances through some control strategy.
The UIO will be designed for a linear model of the quadcopter. Both software
simulations using Matlab/Simulink and Gazebo and hardware tests will be carried out
18
as part of the project in order to validate the performance of the UIO with the linear
quadcopter model subjected to unknown inputs (wind).
19
Chapter 3 Quadcopter Mathematical Modelling A quadcopter is a flying object which changes its attitude and altitude by four rotating
blades [5]. The four rotors of the quadcopter are directed upwards and are placed in a
square formation, each, an equal distance away from the center of mass of the
quadcopter [2, 12]. This chapter presents the derivation of the mathematical model of
the quadcopter. More specifically, the linear position controller and the linear attitude
controller from the nonlinear model of the quadcopter will be derived. The purpose of
deriving the mathematical model of the quadcopter is to describe the behavior and the
movement of the quadcopter with respect to input and external disturbance values [58].
This enables the simulation of the behavior of the quadcopter in various conditions.
Nomenclature
- Length of the quadcopter
F Force
M Moment
- Inertia in the x-axis
- Inertia in the y-axis
- Inertia in the z-axis
- Force constant
- Moment constant
- Motor speeds
- Hovering speed of Quadcopter
Desired x coordinate
Desired y coordinate
Desired z coordinate
Desired rotation in the z axis
20
3.1 The 12 Quadcopter States Table 3-1: 12 States of the Quadcopter with its Description
Name Description
Describes the linear position of the quadcopter in the x direction
Describes the linear position of the quadcopter in the y direction
Describes the linear position of the quadcopter in the z direction
Describes the angular position (orientation) of the quadcopter in the x
direction
Describes the angular position (orientation) of the quadcopter in the y
direction
Describes the angular position (orientation) of the quadcopter in the z
direction
Describes the linear velocity of the quadcopter in the x direction
Describes the linear velocity of the quadcopter in the y direction
Describes the linear velocity of the quadcopter in the z direction
Describes the angular velocity of the quadcopter in the x direction
Describes the angular velocity of the quadcopter in the y direction
Describes the angular velocity of the quadcopter in the z direction
3.2 Coordinate system of Quadcopters
In order to derive the mathematical model of the 6DOF quadcopter, we must define
two reference frames.
Inertial frame:
Body frame:
Body Frame
Roll
Pitch
Yaw
z
y
x
Inertial Frame
21
The inertial reference frame is defined by the ground in which the gravity points in the
negative direction of the z axis while the orientation of the quadcopter is defined by
the body frame. In this reference frame, the rotor axes are pointing in the positive z
direction while the arms of the quadcopter in the x and y direction [2].
The linear position and the linear velocity of the quadcopter are defined in the inertial
frame as and , respectively, while the body frame is used to
define the angular position and the angular velocity of the quadcopter as
and , respectively.
In order to align the axes of the inertial frame to those of the body frame, we choose
the proper representation of the orientation of the quadcopter. For this thesis, the ZXY
Euler angles are chosen. This means that in order to align the inertial reference frame
with the body frame, we must first apply a rotation of the yaw angle then a rotation
of the roll angle , and then a final rotation of the pitch angle . Hence, the complete
rotation matrix of the quadcopter can be obtained as follows. The elementary rotations
are
Therefore, the total rotation is
CosSin
0 0 1 0 Sin Cos Sin
22
(3.1)
Equation (3.1) above represents the rotation matrix of the quadcopter used in the thesis.
3.3 Quadcopter Moments Equations
In this section, the equation for the quadcopter is derived. According to the
direction of rotation of the rotors with respect to the appropriate axes, the equations of
moments are derived. Figure 3-2 shows the configuration of the quadcopter with the
direction of rotation of each of the rotors as well as the direction of each of the three
axes.
Figure 3-2: Direction of rotation of the rotors of quadcopter with reference frames
From Figure 3-2, it can be seen that rotors 2 and 4 rotate in the positive direction of
the z axis of the body frame while rotors 1 and 3 rotate in the negative direction of the
axis. Moreover, since the produced moment on the quadcopter is in the opposite
direction to the rotation of the propellers, therefore, moments and will act in
the negative direction of the z axis of the body frame of the quadcopter while moments
and will act in the positive direction of the z axis. Furthermore, since the rotors
of the quadcopter are separated from the center of mass with a distance of , therefore
the rotors labelled 2 and 4 will produce moments along the y axis of the body frame in
23
the positive and negative directions respectively. Meanwhile rotors labelled 1 and 3
will produce moments along the x axis of the body frame in the negative and positive
directions respectively. Finally, the moments equation of the quadcopter can be
represented as described in equation (3.2) below:
(3.2)
3.4 Dynamic Nonlinear Model of the Quadcopter
The dynamic nonlinear model of the quadcopter is as follows:
(3.3)
(3.4)
(3.5)
These nonlinear equations of the quadcopter are utilized in deriving the linear attitude
and position controllers discussed in the next two sections of the chapter.
3.5 Attitude Controller
This section of the chapter will discuss the derivation of a linear attitude controller for
the quadcopter. In order to design an attitude controller from the equations discussed
above, we use the dynamic equations (3.4) and (3.5):
24
(3.6)
Dividing both sides of equation (3.6) above with and rearranging the equation,
we obtain:
(3.7)
Moreover, since the quadcopter is assumed to be in hovering condition (i.e. in
equilibrium state), the angles roll and pitch are almost equal to zero i.e. . Due
to this condition and referring to equation (3.4), replacing and angles with 0,
and . Therefore, equation (3.7) can be represented as:
(3.8)
From the above dynamic system, we can obtain an attitude controller by linearising the
system around the hovering condition. It is assumed that at the hovering condition,
(where m is the mass of the quadcopter and g is the gravitational
force). Moreover, the following identities have been used for the linearisation of the
system in equation (3.8); and .
Solving for :
25
Since hovering condition is assumed, Therefore the term is
cancelled out. Hence,
Making use of the identity , we obtain:
and
Hence, by replacing this identity into the above equation, can be rewritten as:
Expanding the above equation we obtain:
Since terms can be cancelled from the above equation:
Morover, it is known that therefore:
and
4 4 o and
Hence, the equation for simplifies to:
26
In addition, since is defined as , we obtain through substitution:
Finally, simplifies to:
Solving for :
Since hovering condition is assumed, Therefore the term is
cancelled out. Hence,
Utilising the identity , we obtain:
3 o 3 and
Hence, through the substitution of this identity in the abobe equation, can be
rewritten as:
Expanding the above equation we obtain:
Cancelling out the terms from the above equation due to the opposite signs:
27
Moreover, since , therefore:
3 3 o and
and
Hence, the above equation simplifies to:
Moreover, since is defined as , by substitution we obtain:
Finally, simplifies to:
F3 1
yy
mgkI
Solving for :
Since hovering condition is assumed, Therefore the term yy xx
zz
I II
is
cancelled out. Hence,
Utilising the identity , we get:
, , and 4 o 4
Hence, through substitution can be rewritten as:
2 2 2 2M1 o 2 o 3 o 4 o
zz
k ((I
28
Expanding the above equation we obtain:
Cancelling out the terms due to opposite signs from the above equation, we
obtain:
Moreover, since , therefore:
and
and 2 ow w
and
and
Therefore, the above equation simplifies to:
Furthermore, since is defined as and we obtain:
Finally, by combining all the derived equations (i.e. , and ), the linearised
model can now be represented as equation (3.9) below:
29
It should be noted that the objective in deriving an attitude controller is to force the
orientation of the quadcopter according to a well-behaving and known dynamics.
Therefore, the derived model is compared with a reference model shown below in
equation (3.10):
(3.10)
The constants in the above equation can be obtained by choosing the location of the
desired eigenvalues appropriately. Moreover, from the above equation, and
where is the commanded roll and is the commanded pitch angles.
Comparing equations (3.9) and (3.10) and equating the equations together, we obtain
the following:
(3.11)
Where,
30
Furthermore, we need to determine the variation laws of the rotor speeds of the
quadcopter. Hence, in the derivation of a linear attitude controller, we introduce a
new quantity and define it as:
Hence, variations for the speed of the rotors of all can be described as:
(3.12)
Then, making the subject of the formula in equation (3.12),
we obtain the following set of equations:
(3.13)
Finally, after putting everything together and expressing all quantities in the original
coordinate frames, the final linear feedback attitude controller can be represented as:
(3.14)
3.6 Position Controller
This section of the chapter will discuss the derivation of a linear position controller for
the quadcopter. Its objective will be to control the position of the center of mass of the
31
quadcopter. The center of mass of the quadcopter is controlled by the total thrust
generated by the propellers as well as the values of the commanded roll and the
commanded pitch. The dynamic equation that describes the position of the quadcopter
described in equation (3.3) is represented as:
In the above equation, the variable f is defined as:
Similar to the attitude controller, a linear feedback position controller will be designed
around the hovering condition. The parameters taken into consideration are
and . Moreover, the variables of the position error are defined as
, , and . Finally, the variables for input
variation are defined as , and .
Solving for :
In order to obtain the linearized position controller, hovering condition was assumed.
Hence
Note: and , likewise, (this is achieved
due to the assumption of hovering condition)
Hence, through substitution of the above in the equation we obtain:
With the use of the variables of the position error defined above and through
simplifications, the following equations are obtained for :
32
Finally, can be represented as:
Solving for :
y Sin
With the use of the variables of the position error defined above and through
simplifications, the following equations are obtained for :
Finally, can be represented as:
c d c dy
Solving for :
Since (due to assumption of hovering condition):
Then, according to the input variation variable , can be represented as:
33
Hence, the linearized model describing the position of the quadcopter can finally be
represented as:
(3.15)
In addition, we can also express the term in terms of the speed of the 4 rotors:
(3.16)
The next step was to compare the derived linearized model with a reference model in
equation (3.17) in order to stabilize the quadcopter in its center of mass. Hence:
(3.17)
Therefore, equating equation (3.17) with the derived linearized model in (3.15):
(3.18)
Hence, the final linearized position controller of the quadcopter can be represented as:
(3.19)
Where:
34
3.7 Simulink Quadcopter Model with Attitude and Position Controllers
Figure 3-3: Linear Quadcopter Model
Figure 3-3 shows the implementation of the linear quadcopter model in Simulink. The
linear attitude and position controllers which have been derived in this chapter have
been utilized in the implementation of the quadcopter model. The reference or desired
coordinates ( are entered by the user from which the appropriate
motor speeds are generated and fed into the linear quadcopter model represented as the
state space block in figure 3-3 above. Finally, the linear quadrotor model outputs the
12 states of the quadcopter as the output of the model. Presented below is a test case
conducted for the linear quadcopter model shown in figure 3-3. The coordinates
entered as reference values were:
35
Figure 3-4: Graph of Quadcopter Path
Figure 3-4 shows the path of the quadcopter for the test case explained above. From
the graph above, it can be concluded that the quadcopter has successfully managed to
reach the desired coordinates which were entered at the start of the program.
3.8 Chapter Summary
The goal of this chapter was to derive a mathematical model of the quadcopter. More
specifically, a linear attitude controller and a linear position controller for the
quadcopter model were derived. Hovering conditions were assumed for the derivation
of the two controllers. The position and attitude controllers were derived in order to
control the translational position and the attitude of the quadcopter respectively.
36
Chapter 4 Linear Unknown Input Observer for Quadcopters
4.1 Unknown Input Observer Theory
An Unknown Input Observer is an observer used to estimate the unknown input or
disturbance acting on a system. A major advantage of the UIO over other observers
is that it does not require knowledge of the unknown input in order for the estimation
unlike the simple Luenberger observers. The UIO approach estimates the state
variables of the system with the utility of mathematical models by calculating the
difference between measured and estimated states in order to obtain residuals [6, 7].
As discussed previously, dynamic systems can often be modelled as a system having
unknown inputs and various methods have been presented in the literature for the
design of observers for these systems. This chapter will discuss the need for an
unknown input observer for quadcopters. Moreover, the design procedure for the
construction of an unknown input observer to be used for with quadcopters will be
discussed. The unknown input/disturbance taken into consideration for this thesis is
the influence of wind acting on the body of the quadcopter.
4.2 Need for UIO for Quadcopters
For the quadcopter model implemented in chapter 3 of the thesis, a step disturbance
(representing the effect of wind) is applied to the quadcopter model, which is unknown
to the system, and is tested if the quadcopter will still be able to reach its target position
regardless of the applied disturbance. This is seen in Figure 4-1.
Figure 4-1: Quadcopter Model with Wind Disturbance
A step disturbance of magnitude 3.5 m/s and 2.5 m/s were applied to the system in the
x and y axis respectively. In addition, the target position for the quadcopter was set as
37
3m, 4m and 5m in the x, y and z axis respectively. The results obtained are discussed
below.
Figure 4-2: Graph of Quadcopter Path Subjected to Wind Disturbance
Figure 4-2 shows the graph of the path of the quadcopter and the reference position
which was the target position of the quadcopter. Since wind disturbance was applied
to the x and y axis of the system, it can be seen that the target positions for the x and y
axis which were 3 and 4 meters respectively has not been reached by the quadcopter
but the quadcopter has ended up drifting away from its target position.
Hence, from this test, it can be concluded that the need for an Unknown Input Observer
is necessary for the quadcopter model when it is subjected to external disturbances
which are unknown to the system in order to allow for the compensation of the
disturbances based on the estimations and enabling the quadcopter to reach its target
position. The advantage of using an UIO for the wind estimation instead of sensors is
that the UIO provides a cheaper alternative of implementation. Moreover, the UIO
caters for delay in its estimation unlike the sensors used for measuring of the
disturbance.
4.3 UIO Design Process
Firstly, a discrete time linear model of a system is considered:
(4.1)
38
With being the state vector, the input vector and being the
output vector. Matrices A, B, C and D are the system matrices. It should be noted that
for the development of the UIO, only the unknown inputs are considered in equation
(4.1) above. It is also assumed that the matrix is a full rank matrix. This
assumption can be achieved by making appropriate transformations.
Furthermore, the response of the above system over a time step of is given as:
(4.2)
In equation (4.2), is the observability matrix, is the invertability matrix and L is
the system delay. The form of the observability matrix and the invertability matrix are
represented below in equations (4.3) and (4.4) respectively:
(4.3)
(4.4)
Therefore, from the definition of the observability and invertability matrices, equation
(4.2) can be rewritten as:
(4.5)
Moreover, if we consider an observer of the form:
(4.6)
39
The observer in equation (4.6) can only be considered as an unknown input observer
with a delay L if, as regardless of the (input) sequence.
For the observer defined in equation (4.6), the observer matrices E and F are
determined by examining the error in the estimation. The estimation error is derived
as follows:
(4.7)
Replacing in the above equation with equation (4.6) we obtain:
(4.8)
In order to simplify this equation, we add extra terms while at the same time
ensuring that it does not affect the original equation in any way. After adding the extra
terms, we get an equation of the estimation error of the following form:
(4.9)
After grouping the like terms together and factorizing equation (4.9), we obtain the
following error function in equation (4.10):
(4.10)
Now, replacing in the above equation with the equation (4.2), we obtain:
(4.11)
Further simplifying equation (4.11) above, gives us the final error estimation
function:
(4.12)
Therefore, if the error of the above error function is to be driven to zero, the matrix E
must be a stable matrix and matrix F must satisfy the following condition in equation
(4.13):
40
(4.13)
(Must be stable) (4.14)
It should be noted that a matrix F will only exist, if and only if the following condition
is satisfied. i.e.
(4.15)
Where m is the number of columns of the disturbance matrix.
For the design of this type of observer, the value of L can be obtained by starting from
zero and moving up until the above condition is satisfied. It should be noted that, the
maximum value for L for which the observer would exist is L = n. If the value of L
increases and becomes greater than n, then asymptotic estimation of the states is not
possible.
Furthermore, from equation (4.13), it can be said that matrix F will lie in the left null
space of the last columns of represented as . From this, we let matrix
be the left null space of the matrix . Hence, the matrix
(4.16)
becomes a matrix whose rows form the basis of the left null space of where W
is an invertible matrix.
In order to find the invertible matrix W, we use the following matrix calculations:
(4.17)
41
From equation (4.17) the bottom half of matrix W is obtained by taking the basis of
the left null space of the product of the matrices while the top
half of matrix W is obtained by taking the left inverse of the product of the above
mentioned matrices. i.e.
(4.18)
Note: The product of matrices is referred to as Matrix 1.
Once matrix W is obtained, matrix N can be calculated using equation (4.16) above.
After obtaining the matrix N, it becomes possible to form the matrix . This matrix
can be calculated as follows:
(4.19)
In the matrix defined in equation (4.19), the last m rows is equal to the matrix Then,
the final equation of the observer matrix E becomes:
(4.20)
Observer matrix F is then calculated as:
(4.21)
Since it was stated that for the error estimation to reach zero, matrix E must be stable,
therefore the eigenvalues for
42
must be stable i.e. eigenvalues .
If the eigenvalues for the above matrix are stable, then the value of matrix is set to
zero. However if the eigenvalues of the above equation are unstable, then in order to
place the eigenvalues at the desired locations, matrix can be found by using the
place command in Matlab. For example, where p is the
vector specifying the desired locations of the eigenvalues.
Once both the observer matrices E and F are successfully obtained, satsifying their
conditions of existence, the final observer can be formulated as:
Finally, in order to find the estimate of the unknown inputs we firstly rewrite the
equation of the original discrete model as in equation (4.24):
For the reconstruction of the input, a matrix G needs to be found satisfying the
condition in equation (4.25):
(4.25)
From equation (4.25), it can be seen that matrix G can be obtained by calculating the
inverse of the matrix .BD
Moreover, once the convergence of the estimate to
is reached, in equation (4.24) can be replaced with and by left
multiplying matrix G, the estimated input can be obtained as:
(4.26)
43
4.4 UIO Design for Quadcopter Model
Based on the steps mentioned in the above section of the chapter, the UIO for the
derived quadcopter model has been designed. The calculations and the steps utilised
to achieve this has been attached in appendix A of the thesis.
Figure 4-3 shows the construction of the Unknown Input Observer in Simulink
designed for the quadcopter model discussed in this chapter. The observer matrices E
and F and the matrix G used for the reconstruction of the input used in the figure below
have all been calculated and attached in appendix A as mentioned above. Note: Matrix
in Figure 4-3 is for the known inputs (i.e. four motor speeds).
Figure 4-3: UIO Design
44
4.5
UIO
Impl
emen
tatio
n in
Mat
lab/
Sim
ulin
k
Figu
re 4
-4: U
IO Im
plem
enta
tion
in M
atla
b/Si
mul
ink
45
In Figure 4-4, the designed UIO in the chapter has been implemented in the Simulink
model with the linear quadcopter. In order to represent the existence of wind
disturbance on the model, a step disturbance or a discrete wind gust model can be
applied which has been implemented in the Simulink block labelled Wind in Figure 4-
4. As it can be seen form Figure 4-4, the inputs to the UIO block are the linear and
angular positions of the quadcopter and its four motor speeds. Based on these input
values, the UIO is then able to estimate the wind disturbance that has been applied to
the system as well as estimate the states of the quadcopter.
Presented below is a test case conducted for the UIO implementation with the linear
quadcopter model shown in Figure 4-4. The wind disturbance values applied were a
step disturbance of:
Figure 4-5: Graph of Estimated and Actual Wind Force
Figure 4-5 shows the output from the UIO implemented with the linear quadcopter
model in Simulink. A step disturbance was applied to each of the axis representing the
effect of wind on the quadcopter and from the results obtained it can be stated that the
UIO has successfully estimated the applied disturbances.
46
4.6 Chapter Summary
The goal of this chapter was to design an Unknown Input Observer for quadcopters.
An Unknown Input Observer is an observer used to estimate the unknown input or
disturbance acting on a system. A major advantage of the UIO over other observers
is that it does not require knowledge of the unknown input in order for the estimation
unlike the simple Luenberger observers. Firstly, in this chapter, the design procedure
for an Unknown Input Observer was discussed. Then, the steps discussed for designing
the Unknown Input Observer was utilized in designing the UIO for the quadcopter
model. The UIO designed for the quadcopter was then implemented with the model
of the quadcopter in Simulink and a test case was used to demonstrate the functionality
of the designed UIO.
47
Chapter 5 Gazebo Simulation of Erle-copter with UIO In this chapter, the designed UIO for the quadcopter is tested in Gazebo software where
the actual parameters of the real quadcopter (Erle-copter) is used. This chapter
presents as to how Simulink is interfaced to Gazebo via Robot Operating System
(ROS) toolbox. The entire process of simulating the Erle-copter in Gazebo software
is presented in this chapter.
Robot Operating System (ROS) is a meta-operating system which is used for robots.
The services ROS provides are similar to any operating system. These services may
include abstraction of hardware, control of low level devices, ability to pass messages
between processes and the management of packages. Moreover, it also provides users
with the resource of libraries and tools which aid in building, writing and running code
across multiple computers. With the use of ROS, users are provided with a variety of
communication styles such as synchronous RPC-style communication over services,
asynchronous streaming of data over topics and storage of data on a parameter server
[59]. The Robot Operating System currently works only on systems based on UNIX
platforms as primary ROS software testing has been carried out on Ubuntu and Mac
OS systems [59].
Gazebo is a robotics simulator, which can be utilized for creating applications for real
robots in a virtual environment. This software can be used to simulate robots with
actual world parameters in order to visualize how the robot would behave in the actual
hardware tests in the real environment. Gazebo-simulated hardware is designed to
reflect the behavior of its equivalent in reality. Because of this, the client software
uses an interface identical to the real robot [60]. This would thus save time and money
in carrying out tests directly on hardware without the knowledge of how it would
actually behave in the physical world scenario. Advantages of using Gazebo software
are firstly, it enables the user to simulate various types of position sensors such as laser
scanning, sonar and Global Positioning System (GPS). Secondly, in its library it
contains robots which are commonly used and finally, it enables realistic simulation of
rigid body physics [60].
48
5.1 Launching the Erle-copter model in Gazebo
Since the Erle-copter would be utilized for the hardware testing of the UIO, the Erle-
copter model which is already available in Gazebo will be utilized. Firstly a workspace
is created and initialized, and inside the workspace, the Erle-copter model and
resources are downloaded. The steps listed in the Erle robotics documentation page
for the configuration of the environment were followed to achieve this. Once the
workspace has been created and initialized with Erle-copter model and resources
downloaded, the Erle-copter can then be launched. In order to launch the Erle-copter
in Gazebo, the following commands are entered into the terminals in an Ubuntu
machine:
In Terminal 1:
In Terminal 2:
This enables the Erle-copter model to be launched in Gazebo. Figure 5-1 shows the
Erle-copter model spawned in Gazebo simulator.
Figure 5-1: Erle-copter spawned in Gazebo Simulator
Once the Erle-copter model has been launched in Gazebo, the next step is to load its
parameters. The parameters of the copter are loaded using the following command:
source ~/simulation/ros_catkin_ws/devel/setup.bash cd ~/simulation/ardupilot/ArduCopter ../Tools/autotest/sim_vehicle.sh -j 4 -f Gazebo
source ~/simulation/ros_catkin_ws/devel/setup.bash roslaunch ardupilot_sitl_gazebo_plugin erlecopter_spawn.launch
49
In Terminal 1
After carrying out the above mentioned steps, one should be able to launch the Erle-
copter model in Gazebo. In the next section of this chapter, the interfacing of
Matlab/Simulink with Gazebo via ROS is explained.
5.2 Interfacing Matlab/Simulink with Gazebo via ROS
In order to simulate the Erle-copter, Matlab/Simulink must be interfaced with Gazebo.
This is achieved through the ROS toolbox in the Simulink library. Two main types of
functions, specifically Publish and Subscribe functions are used in order for
Matlab/Simulink and Gazebo to communicate with each other. This communication
is achieved through choosing appropriate topics and its corresponding message types
of the ROS blocks in the ROS toolbox. The publish ROS block is used to send data
from Matlab/Simulink to Gazebo while the subscribe ROS block is used to receive
information from Gazebo. For the purpose of simulating the Erle-copter in Gazebo to
test the UIO, position data generated in Matlab/Simulink is published to the Erle-copter
model in Gazebo while the path the Erle-copter takes in Gazebo is obtained by
Matlab/Simulink through the use of the subscribe ROS block. These values subscribed
from Gazebo are then fed into the designed UIO as input together with the speed of the
four rotors. Shown below are the Subscribe and Publish ROS blocks used in the
Simulink model of the quadcopter together with the topic names and their
corresponding message types.
Table 5-1: ROS Blocks used and their Purpose
Type of ROS Block
Purpose Topic Name Message Type
Publish Publish position to Gazebo
/mavros/setpoint_position/local geometry_msgs/PoseStamped
Subscribe Subscribe position and orientation data from gazebo
/erlecopter/ground_truth/odometry nav_msgs/Odometry
Subscribe Subscribe Erle-copter motor speeds.
/erlecopter/motor_speed/motor_number std_msgs/Float32
param load /home/simulation/ardupilot/Tools/Frame_params/Erle-Copter.param
50
5.3
Sim
ulat
ion
of th
e E
rle-
copt
er
Figu
re 5
-2: S
imul
ink
Blo
ck D
iagr
am fo
r Gaz
ebo
Sim
ulat
ion
The A
rdup
ilot 3
.5 co
ntro
ller w
hich
is th
e def
ault
cont
rolle
r in
the G
azeb
o si
mul
ator
has
bee
n ut
ilize
d fo
r the
test
ing
of th
e UIO
in G
azeb
o si
mul
atio
n.
This
pro
ves t
hat t
he U
IO a
ppro
ach
is va
lid fo
r any
con
trolle
r whi
ch is
con
trolli
ng th
e dr
one
in it
s flig
ht.
51
Figure 5-2 represents the Simulink model of the quadcopter with the UIO
implementation for simulation in Gazebo simulator. Publish and subscribe blocks used
in Figure 5-2 are from the ROS toolbox in Simulink.
Once the Erle-copter model has been launched and Gazebo and Matlab/Simulink
interfaced, the simulation of the Erle-copter can be carried out. With the Gazebo
simulator running, the Simulink model of the quadcopter is run. The user first selects
the desired coordinates for the Erle-copter to travel (i.e. . These values
are published to the Gazebo simulator via the Publish ROS block. This prompts the
Erle-copter model in gazebo to move to the desired coordinates entered by the user.
The path which the Erle-copter takes to reach its desired position is extracted to
Matlab/Simulink through the Subscribe ROS block. This includes the linear and the
angular positions of the quadcopter. It should be noted that the orientation in Gazebo
are represented in quaternions i.e. w, x, y and z and hence must be converted to Euler
angles roll, pitch and yaw. This step is carried out in the Gazebo Position and
Orientation block in Figure 5-2. In Figure 5-3, it shows how the linear and angular
positions of the Erle-copter are extracted from gazebo using the Subscribe ROS blocks
from the ROS toolbox in Simulink.
Figure 5-3: Segment of Simulink for Subscribing Position and Attitude data Furthermore, the motor speeds of the Erle-copter when moving to the desired
coordinates are also extracted to Matlab/Simulink through the Subscribe ROS block.
Once all the required data (i.e. linear and angular positions and the motor speeds) have
been extracted from Gazebo to Matlab/Simulink, it is fed into the UIO block as input
52
as shown in Figure 5-2. Finally, the UIO block outputs the estimated wind disturbance
which was applied to the Erle-copter model in the gazebo simulation environment.
Figure 5-4: ROS Computation Graph
Figure 5-4 shows the rqt_graph which provides a Graphical User Interface plugin
useful in visualizing the ROS computational graph. The figure illustrates how the
simulation is executed and how each component is linked to the other. In the mavros
block, the two topics used for publishing and subscribing of data are shown. Moreover,
the tf block in Figure 5-4 is a package that allows the user to keep track of multiple
coordinate frames over some time period. Moreover, it also allows users to transform
points and vectors between any two coordinate frames at any desired point in time.
5.4 Chapter Summary
The goal of this chapter was to provide the steps to simulating the quadcopter model
implemented with the UIO in the Gazebo software. Firstly, the model and resources
of the Erle-copter were download into the system. Steps for doing these are well
documented in the Erle robotics documentation page. The next step was to launch the
Erle-copter in Gazebo. For this, specific commands discussed in the chapter are to be
entered. Entering these commands enabled the launching of the Erle-copter in Gazebo.
Once the Erle-copter model was launched, communication between Matlab/Simulink
and Gazebo had to be obtained. This was done through the aid of the ROS toolbox in
Simulink. Once communication between the two had been achieved, the simulation
of the Erle-copter in Gazebo was carried out and the UIO was tested.
53
Chapter 6 Hardware Implementation In order to validate the results obtained through simulations, hardware implementation
of the designed system is very important. In this chapter, steps of hardware
implementation of the Erle-copter with the designed UIO will be discussed. The
hardware setup of the Erle-copter will be presented and the tasks carried out to achieve
hardware implementation of the UIO will be discussed.
Figure 6-1: Erle-copter
Figure 6-1 shows the quadcopter (Erle-copter) which will be utilized for the hardware
testing of the designed UIO. The Erle-copter was the first Linux based smart drone
that utilized robotics frameworks for example the Robot Operating System (ROS) [61].
The Erle-copter comes equipped with the Erle brain 3 which is the latest edition of the
robot brain from Erle robotics.
6.1 Components of the Erle-copter
1. Erle Brain 3
Figure 6-2: Erle Brain 3 [62]
Figure 6-2 shows the third version of Erle Brain which is called the Erle brain 3. This
is the third and latest installment of artificial robot brains based on Linux systems. The
54
main purpose of the brain is to allow support of ROS for drones and robots. The brain
also allows for Wi-Fi connection as it sets an internal Wi-Fi (802.11n, 2.4 GHz) of the
Erle-copter. The Erle brain 3 comes equipped with a variety of sensors namely
gyroscope, temperature and pressure sensor, gravity sensor and a digital compass [62].
The version of the operating system in the Erle brain 3 is Frambuesa 3.5.
2. Electronic Speed Controller (ESC)
Figure 6-3: Electronic Speed Controller (ESC) [63]
The electronic speed controller illustrated in Figure 6-3 is the device responsible for
controlling the speed as well as the direction of rotation of the rotors of the Erle-copter
[64]. An ESC can be considered as the link between the brain and the rotors of the
Erle-copter.
3. Brushless DC Motors
Figure 6-4: Brushless DC Motors [65]
The Erle-copter contains 4 brushless DC motors where two of the motors rotate in the
clockwise direction while the other two rotate in the anticlockwise direction. The main
function of these 4 motors is to convert the electrical energy into mechanical energy
55
(by inducing rotation) which is transmitted to the four propellers of the Erle-copter
[64].
4. The Propellers
Figure 6-5: Propellers of the Erle-copter [63]
In Figure 6-5, the propellers of the Erle-copter are shown. There are two pairs of
propellers utilized in the copter. The first pair tightens itself when rotated in the
clockwise direction whereas the second pair of propellers tighten itself when rotated
in the anticlockwise direction. The propellers are the components of the Erle-copter
that provide propulsion from the rotary motion provided by the brushless DC motors.
5. The Power Module
Figure 6-6: Power Module [63]
Figure 6-6 represents a power module. The power module is an essential component
of the system since it is used to power up the autopilot and other add on accessories as
well as report the current and voltage values of the battery.
56
6. The Global Positioning System (GPS) + Compass
Figure 6-7: The Global Positioning System (GPS) + Compass [63]
The Global Positioning System (GPS) + Compass is represented in Figure 6-7. This
component of the Erle-copter is used to determine its position and orientation at any
particular time. The GPS, in order to avoid any interference and for a better connection
to the satellite, must be placed in the highest part of the vehicle [64].
7. LiPo Battery (4S or 3S)
Figure 6-8: LiPo Battery [63]
Figure 6-8 illustrates the LiPo battery used by the Erle-copter for its flight. Either a 4s
or a 3s LiPo battery can be utilized. With the battery fully charged, the Erle-copter can
obtain a flight time of up to twenty minutes [66].
6.2 Connection of the Erle-copter to an Ubuntu Machine
The machine (laptop with Ubuntu) with which the Erle-copter calibration and testing
is to be done has to be connected to the Erle-copter. In order to achieve this connection,
the internal Wi-Fi provided by the Erle brain 3 is utilized. The Wi-Fi provided by the
Erle brain is activated once the brain is powered up after connecting the LiPo battery.
Shown below is the Wi-Fi hotspot name and password of the Erle-copter.
57
Note: It must be ensured that the IP address of the host computer is set correctly. The
correct addresses are as follows:
Once connected to the Erle copter through its internal Wi-Fi, the brain of the Erle-
copter can be accessed by entering the following command in the terminal of the
Ubuntu machine.
6.3 Erle-copter Setup and Calibration In order to obtain the optimal performance from the Erle-copter, various settings and
calibrations are carried out. In this section of the chapter, the three important
calibrations which were carried out are discussed.
I. ESC Calibration
ESC calibration is carried out so that the ESCs are aware of the maximum and
minimum Pulse Width Modulation (PWM) values the flight controller will send. The
is chosen where all the ESCs are calibrated
together. Calibrating the ESC is important as it ensures that all motors rotate at the
same speed and that correct power is given to the motors.
II. Compass calibration
Compass calibration is one of the most important calibrations in order to ensure a flight
which is safe as well as controlled. The purpose of the compass calibration is to allow
compensation of the magnetic inclination and deviation. If not corrected, these
inclinations and deviations will cause inconsistencies between the compass and the
GPS which could probably result in losing control of the Erle-copter [67]. Live
calibration for calibrating the compass is chosen in the APM software.
Wi-Fi hotspot Username: erle-robotics-frambuesa
Password: holaerle
ROS_MASTER_URI = http:// 10.0.0.1:11311
ROS_HOSTNAME: = 10.0.0.2
58
III. Accelerometer calibration
Accelerometers can be defined as inertial sensors which can sense mechanical motion.
This mechanical motions can then be converted to an electrical quantity which can be
easily measured. The Erle-copter contains three Inertial Measurement Units (IMU)
and each of these have to be calibrated in order to obtain satisfactory flight from the
Erle-copter. The process of the accelerometer calibration will require placing the
copter in various positions. It should be noted that the level position of the Erle-copter
is the most important position to get right since the Erle-copter controller will consider
this attitude as level while in flight [68].
6.3.1 Erle-copter Parameters Table 6-1 below shows the parameters of the Erle-copter used for both software and
hardware tests.
Table 6-1: Erle-copter Parameters
Parameter Name Value
Mass, m 1.30 kg
Gravitation force, g 9.80
Length, 0.18 m
Inertia, 0.03
Inertia, 0.05
Inertia,
Motor constant, 8.55
Moment constant, 1.60
6.4 Automatic Standalone Node Generation
The Simulink model in Figure 5-2 used for the gazebo simulation is also utilized for
the hardware implementation of the UIO on the Erle-copter. In order to run the
program implemented in Simulink, the program must be built into the hardware (i.e.
the brain of the Erle-copter). In order to accomplish this, the following steps in the
automatic generation of a standalone node are followed:
Step 1: Model Configuration for Code Generation
The Model Configuration Parameters option is chosen by first clicking on the
Simulation option in the menu bar in Simulink. In the Model Configuration
59
Parameters dialog box, Hardware Implementation is chosen and under Hardware
Implementation, the Hardware Board is set to Robot Operating System (ROS). Figure
6-9 shows a graphical representation of step 1.
Figure 6-9: Hardware Board Setting
Step 2: Configuration of the connection to the ROS device (Erle-copter)
Simulink has the capability of transferring a generated node to a ROS device, build an
executable as well as run the resulting ROS node as long as the system running
Simulink is connected to the ROS device. Therefore, firstly, connection to the Erle-
copter is obtained through its internal Wi-Fi. Once the system is connected to the Erle-
copter, the Build Options field under Hardware Implementation is modified. Three
options for the type of build action are available which are; None , Build and Load
and Build and Run t setting where the code is only
option generates the code as well as transfers it to the external ROS device and builds
an executable ROS node but does not run the node. In t option, the
executable node at the end of the build process. For the purpose of this thesis, the
Figure 6-10 shows the fields available for
modification under the Build Options.
60
Figure 6-10: Build Options
as well as create a Catkin workspace where the generated node will be built. Apart
from these options, the user is also required to enter the address of the ROS device, its
username as well as its password. The information entered for the fields discussed
above are shown in Figure 6-11.
Figure 6-11: Connection to ROS Device Dialog Box
Once all the information required for the connection to the Erle-copter is updated, the
connection of the PC to the ROS device is tested. Figure 6-12 shows the result of the
connection test which was carried out.
61
Figure 6-12: ROS Device Connection Test
Since the catkin workspace entered above does not exist in the Erle-copter brain as
seen in the fifth point of Figure 6-12, the connection test fails. The folder is then
created and initialized by clicking on the fix button. Upon making these changes, the
ROS device connection test finishes successfully.
Step 3: ROS Node Generation in C++
In this step, a standalone ROS node code is generated. This code is then transferred to
the Erle-copter where it is then built and run. In order to perform code generation, a
valid connection to a ROS master is necessary. A ROS master can be started on a ROS
device by the rosdevice command in Matlab.
Entering the above command in the Matlab command window yields the following
output as shown in Figure 6-13:
Figure 6-13: Output of the rosdevice Command
The output of the rosdevice command as seen in Figure 6-13 shows the address of the
Erle-copter, its username, the ROS folder and the Catkin Workspace which were
d = rosdevice
62
entered in step 2 for obtaining connection to the Erle-copter. It should be noted that
currently there are no available nodes as seen in the figure because the node is yet to
be generated.
After starting the ROS master on the Erle-copter, the ROS master is required to be run.
The command to run the ROS master is:
The next step is to connect Matlab with the ROS master which is running on the ROS
device (i.e. the Erle-copter). For this purpose the following command is entered in the
Matlab command window:
Moreover, the same ROS connection settings which are used in Matlab are also
transferred to Simulink. This is done by selecting the ROS Master and Node
Host network addresses as Default. This setting can be found under Tools menu
in Simulink. Figure 6-14 shows the graphical representation of the connection settings
for Simulink.
Figure 6-14: Network Connection Settings in Simulink
Once the connection settings have been accomplished, the C++ code of the model can
be generated and deployed to the Erle-copter. This is done by selecting ode
menu in Simulink and choosing C/C++ code option and finally selecting the Deploy
to Hardware option. After the successful completion of the generation of the code,
the ROS node gets transferred into the Catkin Workspace which was created initially
runCore(d)
rosinit(d.DeviceAddress)
63
in the Erle-copter brain. Once the node is transferred, it builds itself in the workspace
and finally starts running automatically.
Step 4: Verification of the Generated Node on the ROS Device
This is done by entering the rosdevice command in the Matlab Command window.
The output of the command should show the correct address of the Erle-copter, its
username, the ROS folder, the Catkin Workspace and the name of the generated node.
Figure 6-15 shows the output obtained at the end of the steps for the automatic
generation of a standalone node.
Figure 6-15: rosdevice Command Properties after Node Generation
From Figure 6-15 above, it can be seen that the ROS node of the Simulink model was
successfully created on the ROS device (Erle-copter). The name of the generated ROS
node in the brain of the Erle-
6.4.1 Running the Generated ROS node
To run the ROS node which was generated in the above section, we follow the steps
listed below:
a. Power up the brain
b. Connect to the Erle-copter via its internal Wi-Fi
c. Get access to the brain of the Erle-copter via the following command:
d. Once inside the brain, change the directory to the folder where the Catkin
Workspace was created for the generation of the ROS node. The command to
change the directory in the brain is:
cd /home/erle/catkin_ws_copter
64
e. After entering the catkin workspace, we need to source the folder in order to
add the environment variables to our path for ROS to function. This is done
by the following command:
f. Finally, the generated ROS node in the Catkin Workspace can be run using the
rosrun command. The full command to run the node on the Erle-copter is as
follows:
6.5 Experimental Setup
Figure 6-16: Experimental Setup
Figure 6-16 shows the experimental setup for the hardware test of the UIO. In order
to measure the wind speed and wind direction, an anemometer and a wind vane have
been used respectively. In order to save the wind data during the time of flight of the
Erle-copter, a data logger has been utilized.
6.5.1 Wind Measurement
A pulse output A101M anemometer was utilized for the measuring of the wind speed
during the hardware tests. In addition, the wind direction was measured via the
potentiometer wind vane (W200P). The wind speed and direction data were logged to
the PC with the aid of the CR1000 data logger. Logger Net 4.5 software was utilized
to extract data from the data logger.
6.5.2 Measured Wind Data Analysis
Using the wind speed and wind direction data obtained from the data logger, the wind
speed was converted to wind force as the designed UIO was used to estimate the wind
rosrun experimental experimental_node
source devel/setup.bash
65
force acting on the body of the Erle-copter. For this purpose, wind speed was
converted into wind force using the following formula:
Where: Area = 0.0988
Air Density = 1.225
Once the wind speed had been converted to wind force, it was decoupled into wind
force acting in the x axis and the y axis. This was achieved as follows:
Where: ; ;
6.5.3 UIO Hardware Test
While the Erle-copter was commanded a path to move to, the anemometer and the
wind vane measured the wind speed and direction respectively. This data was logged
using the CR1000 data logger. Upon the completion of the Erle- s
position (linear and angular) as well as its motor speeds which were logged using the
APM (Ardupilot Mega) software were utilized in estimating the amount of wind force
acting on the Erle-
from the UIO was compared against the calculated wind forces in the x and y axis
using the data logged during the time of the flight. Based on this comparison, the
validation of using an Unknown Input Observer for quadcopters was obtained. Figure
6-17 below shows the Simulink model used to command the target position for the
Erle-copter to follow.
Figure 6-17: Simulink Model for Hardware Testing
66
Figure 6-17 shows the Simulink model used for the hardware tests. The x, y and z
coordinates entered are published to the Erle-copter through the Publish ROS block.
The topic and the message type used for the publishing of the position data to the Erle-
copter has been discussed in Table 5-1. Once all the required data i.e. the linear and
angular positons of the Erle-copter as well as its motors speeds during the time of the
flight was obtained, the Simulink scheme of Figure 5-2 was used to test the UIO.
6.6 Chapter Summary
The goal of this chapter was to discuss the hardware setup and provide the steps for
the hardware implementation of the Erle-copter with the designed UIO. Firstly, the
hardware of the Erle-copter was discussed. The importance of each of the components
of the copter were outlined. Secondly, the steps required to connect to the Erle-copter
and its brain were presented. Thirdly, to achieve optimal performance from the Erle-
copter, three important calibrations namely ESC calibration, compass calibration and
accelerometer calibration were discussed. Moreover, the steps required to generate a
standalone ROS node from the Simulink model of the quadcopter into the Erle-copter
and running the ROS node from the brain of the Erle-copter was presented. Finally,
the experimental setup for the hardware test was discussed. The results obtained from
the hardware tests are presented in the next chapter of the thesis.
67
Chapter 7 Results - Software and Hardware The software results from Matlab/Simulink and Gazebo as well as the hardware results
of the quadcopter with the UIO subjected to external disturbances (wind) is presented
in this chapter. Different test cases were used to carry out the test of the UIO both on
software and hardware. The results obtained from each of the test cases are discussed
in this chapter.
7.1 Software ResultsIn this section, the results obtained from software simulations using Matlab/Simulink and Gazebo simulator are presented.
7.1.1 Matlab/Simulink
Test Case 1.1: Step Wind
For the first test case, the quadcopter was commanded the following coordinates as
shown below:
Moreover, disturbance was applied to the system which represented the wind
disturbance acting on the body of the quadcopter. The disturbance applied to the
system was a step input and was applied to all 3 axes. The values for the disturbances
were:
Given the above coordinates and disturbance values, the UIO was tested with the
quadcopter model and results were analyzed to determine if the UIO was able to
estimate the disturbances which were applied to the system and if the system was then
able to compensate for these disturbances based on the estimations accordingly.
68
Figure 7-1: Graph of Estimated and Actual Wind Force
Figure 7-1 shows the graph of the estimated and actual wind force for test case 1. The
solid line in the graph above demonstrates the estimated wind force by the UIO while
the dashed lines represent the actual wind force which was applied to the system. From
the graph it can be said that the UIO was successful in estimating the wind force acting
on the system.
Figure 7-2: 3D Plot of Quadcopter Path
Figure 7-2 shows the 3D plot of the path of the quadcopter for the first test case with a
step disturbance acting on the system. The target position for the quadcopter to reach
was 5m, 6m and 7m in the x, y and z axis respectively as shown by the red marker on
the graph above and it can be clearly stated from the graph that the quadcopter was
able to do that successfully.
69
Figure 7-3: Graph of Wind Estimation Error
Figure 7-3 shows the graph of the error in the estimation of the wind disturbance
applied to the system. It can be seen from the graph that the UIO designed was able
to successfully estimate the applied wind disturbances on each of the axes.
Test Case 1.2: Military Grade Wind Gust
In the second part of the first test case, the quadcopter was again commanded to go to
the coordinates shown below:
However, instead of the step disturbance which was applied in the first part of the test
case, Military grade wind gusts were applied in this part of the test. The values for the
wind gusts in each of the axes were:
The wind gusts were applied at the beginning of the simulation at t = 0 seconds and
took t = 10 seconds to reach its maximum specified magnitude.
70
Figure 7-4: Graph of Estimated and Actual Wind Force
Figure 7-4 represents the graph of the estimated and the actual wind force for the
second part of the first test case where military grade wind gusts were applied to the
system instead of step disturbances. As seen from the graph above, the UIO was
successful in estimating the wind gusts that were applied to the quadcopter model.
Figure 7-5: 3D Plot of Path of Quadcopter
The 3D plot of the path of the quadcopter is shown above in Figure 7-5. The red
marker on the graph represents the target position of the quadcopter which was 5m,
6m and 7m in the x, y and z axis respectively. Hence it can be stated that the
quadcopter was able to reach its target position after successful compensation of the
applied disturbances.
71
Figure 7-6: Graph of Wind Estimation Error
The error in the estimation of the applied disturbance on the quadcopter model is
depicted in Figure 7-6. From the above graph, it can be concluded that the UIO was
able to correctly estimate the wind disturbances acting on the system.
Test Case 2.1: Step Wind
For the second test case, the quadcopter was commanded to move in a circular path.
The parameters used to achieve this task were as follows:
For the first part of the second test case, step disturbance was applied to the system
which would represent the wind disturbance acting on the body of the quadcopter. The
values for the disturbances were:
w = 1
72
Figure 7-7: Graph of Estimated and Actual Wind Force
Figure 7-7 shows the graph of the estimated and actual wind force for the second test
case. The solid lines in the graph represents the estimated wind forces by the UIO and
it can be seen that these values correspond to the actual values of the wind force
represented by dashed lines in the above graph. Hence, it can be concluded that the
UIO was successful in estimating the effect of wind force acting on the system.
Figure 7-8: 3D Plot of Path of Quadcopter
The 3D plot of the circular path taken by the quadcopter is illustrated in Figure 7-8.
As specified in the test condition, the quadcopter was commanded to make a circular
path at a height of 5m and with a radius of 10m. From the above graph, it can be said
that the quadcopter was successful in achieving its target position regardless of the
disturbance which was applied to the system.
73
Figure 7-9: Graph of Wind Estimation Error
Figure 7-9 shows the graph of the error in the estimation of the wind disturbance
applied to the system. It can be seen from the graph that the UIO designed was able
to successfully estimate the applied wind disturbances on each of the axes.
Test Case 2.2: Military Grade Wind Gust
Similar to the first test case, the second part of the second test case will command the
quadcopter to move in a circular path while military grade wind gusts are applied to
the system. The magnitude of the wind gusts are as follows:
The wind gusts were applied at the beginning of the simulation at t = 0 seconds and
took t = 10 seconds to reach its maximum specified magnitude.
74
Figure 7-10: Graph of Estimated and Actual Wind Force
The graph in Figure 7-10 represents the estimated and the actual wind force acting on
the system. The applied disturbances were wind gusts of magnitude 1.5 m/s, 2.5 m/s
and 0 m/s in the x, y and z axis respectively. Moreover, since the solid lines represents
the estimated wind force by the UIO, it can be stated that the designed UIO was
successfully able to estimate the military grade wind gusts which were applied to the
quadcopter model.
Figure 7-11: 3D Plot of Path of Quadcopter
Figure 7-11 represents the circular path taken by the quadcopter subjected to military
grade wind gusts. According to the graph, it can be seen that the quadcopter has been
able to meet the specifications for the second test case i.e. to move in a circular path
with a radius of 10m and at a height of 5m.
75
Figure 7-12: Graph of Wind Estimation Error
The error in the estimation of the wind disturbances applied to the system is shown in
Figure 7-12. From the graph it can be said that the UIO was able to estimate the wind
disturbances correctly with just a slight error.
7.1.2 Gazebo
Test Case 1: Hovering
In the first test case for Gazebo simulation, hovering condition was tested. The Erle-
copter was commanded to travel to a height of 10m and then hover in its position. The
coordinates of this test case were:
Moreover, the magnitude of the wind force applied to the Erle-copter model in the
Gazebo simulation environment were as follows:
76
Figure 7-13: Graph of Estimated and Actual Wind Force
The estimated wind force by the UIO and the actual wind force which were applied to
the system are represented in the graph in Figure 7-13. Wind force of magnitude 1.2,
0.8 and 0 m/s were applied in the x, y and z axis respectively. In the graph above, the
solid lines represents the estimated wind force by the designed UIO and hence it can
be concluded that the UIO has successfully estimated the applied wind force correctly.
Figure 7-14: 3D Plot of Path of Quadcopter
Figure 7-14 illustrates the path the quadcopter took to reach its desired target for the
first test case. The red marker in the figure above represents the target position set by
the user. Hence, it can be said that the quadcopter was able to reach its desired
coordinates.
77
Figure 7-15: Graph of Wind Estimation Error
Figure 7-15 shows the error in the wind estimation of the UIO in Gazebo software.
According to the graph, it can be said that the UIO implemented in the Gazebo software
was able to correctly estimate the wind disturbances present.
Test Case 2: Movement in the x, y and z axis
In the second test case for Gazebo simulation, the Erle-copter was commanded to travel
to the coordinates presented below:
In this test case, the magnitude of the wind force applied to the Erle-copter model were
as follows:
78
Figure 7-16: Graph of Estimated and Actual Wind Force
Figure 7-16 represents the graph of the estimated and actual wind force for the second
test case. The dashed lines in the graph above represents the wind force which was
applied to the system while the solid lines represent the UIO estimation of the applied
wind force. Since it can be seen from the graph above that the solid lines match the
dashed lines, therefore, the UIO has been able to estimate the applied wind force
correctly.
Figure 7-17: 3D Plot of Path of Quadcopter
Figure 7-17 shows the 3D plot of the path of the quadcopter when moving to its target
position for the second test case. It can be seen from the figure above that the
quadcopter was successful in reaching its target position which is represented by the
red marker in the graph above.
79
Figure 7-18: Graph of Wind Estimation Error
Figure 7-18 shows the error in the wind estimation of the UIO implemented in Gazebo
software. According to the graph, it can be said that the UIO had a slightly large
estimation error in the beginning of the simulation but was later able to correctly
estimate the wind disturbances present.
Test Case 3: Movement in the x, y and z axis with vertical wind
In the final test case for Gazebo simulation, the Erle-copter was commanded to travel
to the coordinates presented below:
In this final test case, apart from the wind force being applied to the x and y axis,
vertical wind force acting in the z axis had also been applied. The magnitude of the
wind force applied to the Erle-copter model were as follows:
80
Figure 7-19: Graph of Estimated and Actual Wind Force
The graph in Figure 7-19 represents the estimated wind force by the UIO (solid lines)
and the actual wind force (dashed lines) applied to the system. Wind force were
applied to all three axes with magnitude of 2.5, 1.5 and 0.5 m/s. It can be seen from
the graph that the estimated wind force by the UIO corresponds to the actual wind
force which were applied to the system. Hence, it can be said that the UIO was
successful in estimating the wind force correctly.
Figure 7-20: 3D Plot of Path of Quadcopter
The 3D plot of the quadcopter path for the third test case is represented in Figure 7-20.
The target position for the quadcopter to travel to was set as 7m, 8m and 9m in the x,
y and z axis respectively. This target position is represented by the red marker in the
figure above and it can be said that the quadcopter was successful in reaching its target.
81
Figure 7-21: Graph of Wind Estimation Error
Figure 7-21 shows the error in the wind estimation of the UIO implemented in Gazebo
software. According to the graph, it can be said that the UIO had a slightly large
estimation error in the beginning of the simulation but was later able to correctly
estimate the wind disturbances present.
7.2 Hardware Results
Test Case: Hovering
For the hardware test, the Erle-copter was commanded the following coordinates:
Moreover, during the time of the flight, the wind speed and wind direction were
measured and recorded. After converting the wind speed to wind force, the results
obtained from the UIO estimation were compared. As seen in Figure 7-15 and Figure
7-16, the wind force estimation of the UIO in the x and y axis of the Erle-copter has
the same pattern as the calculated wind force, however, has a bias of about 0.7m. This
is due to the fact that the GPS error of the Erle-copter is about ±5m and requires at
least 6 satellites during its flight to obtain better GPS accuracy.
82
Figure 7-22: UIO Estimation for Wind Force (x-axis)
Figure 7-22 shows the UIO estimation of the wind force acting on the body of the Erle-
copter in the x-axis. From the above graph, it can be said that the UIO was successful
in estimating the correct pattern of the wind force however had a bias of about 0.7m in
its estimation. The reason of this as stated previously was due to the high GPS error
(±5m).
Figure 7-23: UIO Estimation for Wind Force (y-axis)
Figure 7-23 represents the UIO estimation for the wind force acting on the y axis of
the body of the Erle-copter. Upon comparing the calculated and estimated wind force
it can be said that the UIO was able to estimate the pattern of the wind force but also
83
had a bias of about 0.7m similar to the wind force estimation in the x-axis. The reason
for this is again due to the high GPS error (±5m).
Figure 7-24: 3D Plot of Erle-copter Path
Figure 7-24 represents the 3D plot of the path of the Erle-copter for the commanded
coordinates for the hardware test. The red marker in the graph above represents the
desired target position of the Erle-copter. From Figure 7-24, it can be said that the
Erle-copter was able to approximately reach its desired target position.
Figure 7-25: Graph of Wind Estimation Error
Figure 7-25 shows the wind estimation error of the UIO in the hardware test. As
discussed earlier in the chapter, there is a slight bias in the estimation of the wind
84
disturbance by the UIO due to the GPS inaccuracy. Hence the error in the wind
disturbance estimation is slightly larger when compared to the simulation results.
Furthermore, Figure 7-26 shows the 2D path the Erle-copter followed while Figure 7-
27 illustrates the attitude of the Erle-copter during its flight.
Figure 7-26: 2D Plot of Erle-copter Path
Figure 7-27: Erle-copter Attitude
7.3 Chapter Summary
In this chapter, the software and the hardware results have been discussed. For the
software tests of the UIO, Matlab/Simulink and Gazebo have been utilized. In the
software simulations, it had been seen that the UIO was successful in correctly
estimating the applied wind forces in each of the respective test cases. Moreover, for
85
the hardware test, it had been seen that the pattern of the wind force estimated by the
UIO was similar to the calculated wind force during the time of the flight however,
had a bias of approximately 0.7m in its estimation. This was due to the fact of the high
GPS error (±5m) of the Erle-copter and its need to have at least 6 satellites in its range
for a better GPS accuracy.
86
Chapter 8 Conclusion Since quadcopters are subjected to external disturbances (wind) in its flight, a system
for estimating these unknown disturbances in order for the quadcopter to reach its
desired position through compensation of the disturbances is required. Hence, in this
thesis, a linear Unknown Input Observer for quadcopters had been designed and
implemented. As discussed in the thesis, an UIO had been chosen over the simple
Luenberger type observers as it did not require any prior knowledge of the unknown
input for the estimation process.
Firstly, in the thesis, the linear mathematical model of a quadcopter was derived using
Matlab/Simulink. More specifically, the linear position and attitude controllers were
designed under hovering conditions. The position and attitude controllers were
designed to control the translational position and the attitude of the quadcopter
respectively.
Secondly, an Unknown Input Observer was designed for the derived linear model of
the quadcopter. This was done to enable the quadcopter to reach its target position
despite of external disturbances (which are unknown to the system) acting on it. The
designed UIO was implemented with the linear model of the quadcopter in
Matlab/Simulink. Two test cases were used to test the designed UIO in
Matlab/Simulink. In the first test case, step winds were applied to the quadcopter
model whereas in the second test case, military grade wind gusts were applied to the
quadcopter model.
Thirdly, the functionality of the designed linear UIO was further tested using the
Gazebo simulator. In order to do this, Matlab/Simulink was interfaced with Gazebo
via the ROS toolbox in the Simulink library. The Gazebo software was chosen due to
its ability to reflect the behavior of its equivalent in reality. Moreover, the Ardupilot
controller was used in the Gazebo simulation of the UIO which was the default
controller in the Gazebo software. Three test cases were used to test the UIO in Gazebo
whereby in two of the test cases, wind disturbances were applied only to the x and y
axis while the third case had wind disturbances applied to the x, y and z axis.
87
The results obtained from the simulation tests showed that the UIO was able to
correctly estimate the applied disturbances to the quadcopter model as the wind force
estimates of the UIO were similar to the applied disturbances to the quadcopter model.
Moreover, due to the accurate estimation of the wind disturbances, the quadcopter was
able to reach its desired position through proper compensation of the external
disturbances.
Finally, the designed UIO was tested on the actual quadcopter (Erle-copter). ROS
toolbox was again utilized in establishing the link between the Erle-copter and the
laptop running Matlab/Simulink. In order to get the values of the wind speed and
direction during the time of flight for comparison with the UIO estimations an
anemometer and a wind vane were used. These values were logged to the PC using
the CR1000 data logger. It was seen from the results that the UIO was able to correctly
estimate the pattern of the wind force disturbance acting on the Erle-copter however,
had a bias of about 0.7m in its estimation. This was due to the high inaccuracy of the
GPS module of the Erle-copter (±5m) and its need to require at least a coverage of 6
satellites for better GPS resolution.
Therefore, from the results obtained from the software simulations and the hardware
tests, it can be concluded that the designed linear Unknown Input Observer for
quadcopters was able to estimate the wind disturbances acting on the body of the
quadcopter hence allowing compensation of the disturbance on the system enabling
the quadcopter to reach its desired position.
88
Reference 1. N. Michael, D. Mellinger, Q. Lindsey and V. Kumar, "The GRASP Multiple
Micro-UAV Testbed", IEEE Robotics & Automation Magazine, vol. 17, no. 3,
pp. 56-65, 2010.
2. A. Gibiansky, "Quadcopter Dynamics, Simulation, and Control. 2012," URL:
http://andrew.gibiansky.com/blog/physics/quadcopter-dynamics, (12.5.
2016.).
3. G. Ononiwu, O. Onojo, O. Ozioko and O. Nosiri, "Quadcopter Design for
Payload Delivery", Journal of Computer and Communications, vol. 04, no. 10,
pp. 1-12, 2016.
4. F. Sharifi, M. Mirzaei, B. Gordon and Y. Zhang, "Fault Tolerant Control of a
Quadrotor UAV using Sliding Mode Control", Conference on Control and
Fault Tolerant Systems, pp. 239-244, 2010.
5. A. Lebedev, "Design and Implementation of a 6DOF Control System for an
Autonomous Quadrocopter", 2013.
6. K. S. Gaeid and H. W. Ping, "Induction motor fault detection and isolation
through unknown input observer," Scientific Research and Essays, vol. 5, pp.
3152-3159, 2010.
7. S. HUI and S. ZAK, "OBSERVER DESIGN FOR SYSTEMS WITH
UNKNOWN INPUTS", International. Journal of Applied Mathematics
Computer Science, vol. 15, no. 4, pp. 431-446, 2005.
8. ] L. M. Argentim, W. C. Rezende, P. E. Santos, and R. A. Aguiar, "PID, LQR
and LQR-PID on a quadcopter platform," in Informatics, Electronics & Vision
(ICIEV), 2013 International Conference on, 2013, pp. 1-6.
9. Z. Tahir, M. Jamil, S. A. Liaqat, L. Mubarak, W. Tahir, and S. O. Gilani, "State
space system modelling of a quad copter UAV," Indian Journal of Science and
Technology, vol. 9, 2016.
10. J. M. B. Domingues, "Quadrotor prototype," Uneversidade Tecnica deLisboa.
Dissertacio, 2009.
11. S. Ghazbi, Y. Aghli, M. Alimohammadi and A. Akbari, "QUADROTORS
UNMANNED AERIAL VEHICLES: A REVIEW", International Journal on
Smart Sensing and Intelligent Systems, vol. 9, no. 1, pp. 309-333, 2016.
89
12. T. Luukkonen, "Modelling and control of quadcopter", 2011.
13. S. Gupte, P. I. T. Mohandas, and J. M. Conrad, "A Survey Of Quadrotor
Unmanned Aerial Vehicles," in Proceedings of IEEE Southeastcon, pp. 1-6,
Orlando, Florida, March 15-18, 2012.
14. aerial vehicles with four rotors," Interdisciplinary Description of Complex
Systems, vol. 14, pp. 88-100, 2016.
15. "Dasar-dasar Quadcopter dan Setup KKBoard 2.0 pada Quadcopter (Mode
X)", fahmizal_note, 2018. [Online]. Available:
https://fahmizaleeits.wordpress.com/2013/02/15/dasar-dasar-quadcopter-dan-
setup-kkboard-2-0-pada-quadcopter-mode-x/. [Accessed: 01- May- 2018].
16. C. Balas, "Modelling and Linear Control of a Quadrotor," MSc, SCHOOL OF
ENGINEERING, CRANFIELD UNIVERSITY, 2007.
17. K. Karwoski, "Quadrocopter Control Design and Flight Operation", NASA
USRP, 2011.
18. P. Wang, Z. Man, Z. Cao, J. Zheng and Y. Zhao, "Dynamics Modelling and
Linear Control of Quadcopter", International Conference on Advanced
Mechatronic Systems, pp. 498-503, 2016.
19. A. L. Salih, M. Moghavvemi, H. A. Mohamed, and K. S. Gaeid, "Flight PID
controller design for a UAV quadrotor," Scientific Research and Essays, vol.
5, pp. 3660-3667, 2010.
20. R. Garcia, F. Rubio, and M. Ortega, "Robust PID control of the quadrotor
helicopter," IFAC Proceedings Volumes, vol. 45, pp. 229-234, 2012.
21. J. Li and Y. Li, "Dynamic analysis and PID control for a quadrotor," in 2011
IEEE International Conference on Mechatronics and Automation, 2011, pp.
573-578.
22. -filtered
ET Control Theory Appl., vol. 4, no. 11, pp.
2343 2355, 2010.
23. A. Freddi, A. Monteriù and S. Longhi, "A Model-Based Fault Diagnosis
System for a Mini-Quadrotor", 7th Workshop on Advanced Control and
Diagnosis, pp. 1-6, 2009.
90
24. C. Agho, "DYNAMIC MODEL AND CONTROL OF QUADROTOR IN THE
PRESENCE OF UNCERTAINTIES", 2015.
25. E. K. Ahmet Ermeydan, "Active Fault Tolerant Control against Actuator Faults
in a Quadrotor using Unknown Input Observer Approach," Ankara
International Aerospace Conference, September, 2015 2015.
26. V. Tripathi, L. Behera and N. Verma, "Disturbance Observer Based
Backstepping Controller for a Quadcopter", IEEE, pp. 108-113, 2016.
27. Mechatronics and Automation (ICMA), 2011 International Conference on.
IEEE, 2011, pp. 573 578.
28.
Control
Conference (ECC), 2007 European. IEEE, 2007, pp. 4001 4008.
29. X. Hu
Mathematical Problems in
Engineering, vol. 2014, 2014.
30.
air vehicles Control Conference (CCC), 2012 31st Chinese. IEEE, 2012,
pp. 4462 4467.
31.
Decision and Control, 2006 45th IEEE Conference on. IEEE, 2006, pp. 4957
4962.
32. I. Gonz´alez, S. Sal -free sliding mode altitude
control for a quad-rotor aircraft: Real- Journal of Intelligent
& Robotic Systems, vol. 73, no. 1-4, pp. 137 155, 2014.
33. O. Boubaker, "Robust observers for linear systems with unknown inputs: a
review," International Journal on Automatic Control and System Engineering,
vol. 5, pp. 45-51, 2005.
34. P. Ahn, M. Kim and D. Ahn, "A novel approach to unknown input observer
design via block pulse function's differential operation", IFAC Proceedings
Volumes, vol. 32, no. 2, pp. 1826-1831, 1999.
35. V. Syrmos, "Computational observer design techniques for linear systems with
unknown inputs using the concept of transmission zeros", IEEE Transactions
on Automatic Control, vol. 38, no. 5, pp. 790-794, 1993.
91
36. M. Valcher, "State observers for discrete-time linear systems with unknown
inputs", IEEE Transactions on Automatic Control, vol. 44, no. 2, pp. 397-401,
1999.
37. S. Sundaram and C. Hadjicostis, "Delayed Observers for Linear Systems with
Unknown Inputs", IEEE Transactions on Automatic Control, vol. 52, no. 2, pp.
334-339, 2007.
38. F. Yang and R. Wilde, "Observers for linear systems with unknown inputs",
IEEE Transactions on Automatic Control, vol. 33, no. 7, pp. 677-681, 1988.
39. M. Hou and P. Muller, "Design of observers for linear systems with unknown
inputs", IEEE Transactions on Automatic Control, vol. 37, no. 6, pp. 871-875,
1992.
40. Dawson D. M., Hu J., and Burg T. C. (1998): Nonlinear Control of Electric
Machinery. New York: Marcel Dekker.
41. Solsona J. A. and Valla M. I. (2003): Disturbance and nonlinear Luenberger
observers for estimating mechanical variables in permanent magnet
synchronous motors under mechanical parameters uncertainties. IEEE Trans.
Industry. Electron. Vol. 50, No. 4, pp. 717 725.
42. Utkin V., Guldner J., and Shi J. (1999): Sliding Mode Control in
Electromechanical Systems. London: Taylor and Francis.
43. O. Boubaker, "Robust Observers for Linear Systems with Unknown Inputs: a
Review", International Journal on Automatic Control and System.
44. S. Bhattacharyya, "Observer design for linear systems with unknown inputs",
IEEE Transactions on Automatic Control, vol. 23, no. 3, pp. 483-484, 1978.
45. M. Darouach, M. Zasadzinski and S. Xu, "Full-order observers for linear
systems with unknown inputs", IEEE Transactions on Automatic Control, vol.
39, no. 3, pp. 606-609, 1994.
46. M. Darouach, M. Zasadzinski and S. Xu, "Full-order observers for linear
systems with unknown inputs", IEEE Transactions on Automatic Control, vol.
39, no. 3, pp. 606-609, 1994.
47. K. S. Gaeid, H. W. Ping, M. Khalid, and S. M. Herdan, "Fault tolerant control
of induction motor through observer techniques II," Scientific Research and
Essays, vol. 7, pp. 679-692, 2012.
48. B. Gaddouna, D. Maquin, and J. Ragot, "Fault detection observers for systems
with unknown inputs," in IFAC/IMACS Symposium on Fault Detection,
92
Supervision and Safety for Technical Processes, SAFEPROCESS'94, 1994, pp.
69-74.
49. P. L. Hsu, Y. C. Houng, and S. S. Yeh, "Design of an optimal unknown input
observer for load compensation in motion systems," Asian Journal of Control,
vol. 3, pp. 204-215, 2001.
50. C.-S. Liu and H. Peng, "Inverse-dynamics based state and disturbance
observers for linear time-invariant systems," Transactions-American Society
of Mechanical Engineers Journal of Dynamic Systems Measurement and
Control, vol. 124, pp. 375-381, 2002.
51. Pillosu, A. Pisano, and E. Usai, "Unknown-input observation techniques for
infiltration and water flow estimation in open-channel hydraulic systems,"
Control Engineering Practice, vol. 20, pp. 1374-1384, 2012.
52. D. Luenberger, "An introduction to observers," IEEE Transactions on
automatic control, vol. 16, pp. 596-602, 1971.
53. C. Liu and H. Peng, "Inverse-Dynamics Based State and Disturbance
Observers for Linear Time-Invariant Systems", Journal of Dynamic Systems,
Measurement, and Control, vol. 124, no. 3, p. 375, 2002.
54. F. Fairman, S. Mahil and L. Luk, "Disturbance decoupled observer design via
singular value decomposition", IEEE Transactions on Automatic Control, vol.
29, no. 1, pp. 84-86, 1984.
55. T. Park and D. Kim, "Design of unknown input observers for linear systems
with unmatched unknown inputs", Transactions of the Institute of
Measurement and Control, vol. 36, no. 3, pp. 399-410, 2013.
56. M. Angulo, J. Moreno and L. Fridman, "On functional observers for linear
systems with unknown inputs and HOSM differentiators", Journal of the
Franklin Institute, vol. 351, no. 4, pp. 1982-1994, 2014.
57. A. Guezmil, H. Berriri, A. Sakly, and M. F. Mimouni, "High order sliding mode
and an unknown input observers: Comparison with integral sliding mode
control for induction machine drive," in Modelling, Identification and Control
(ICMIC), 2015 7th International Conference on, 2015, pp. 1-6.
58. Z. Benic, P. Piljek and D. Kotarski, "Mathematical Modelling of Unmanned
Aerial Vehicles with Four Rotors", Interdisciplinary Description of Complex
Systems, vol. 14, no. 1, pp. 88-100, 2016.
93
59. "ROS/Introduction - ROS Wiki", Wiki.ros.org, 2018. [Online]. Available:
http://wiki.ros.org/ROS/Introduction. [Accessed: 13- May- 2018].
60. "Service Robotics within the Digital Home", Google Books, 2018. [Online].
Available:
https://books.google.co.in/books?id=fbgVQABxDEQC&pg=PA75&lpg=PA7
5&dq=advantages+of+gazebo+simulator&source=bl&ots=XHGUh1ptV0&si
g=DiSva48lV-dS8Ew93Jtnpu2fv2Y&hl=en&sa=X&ei=GEskUfH5AsuOrgf-
iYDYAw#v=onepage&q=advantages%20of%20gazebo%20simulator&f=fals
e. [Accessed: 13- May- 2018].
61. "Erle-Copter | Erle Robotics Docs", Docs.erlerobotics.com, 2018. [Online].
Available: http://docs.erlerobotics.com/erle_robots/erle_copter. [Accessed:
13- May- 2018].
62. "Erle-Brain 3 | Erle Robotics Docs", Docs.erlerobotics.com, 2018. [Online].
Available: http://docs.erlerobotics.com/brains/erle-brain-3. [Accessed: 13-
May- 2018].
63. "Store | Erle Robotics", Erlerobotics.com, 2018. [Online]. Available:
https://erlerobotics.com/blog/shop-index/. [Accessed: 13- May- 2018].
64. "EN | Erle Robotics Docs", Docs.erlerobotics.com, 2018. [Online]. Available:
http://docs.erlerobotics.com/erle_robots/erle_copter/assembly/erle_brain_2/en
. [Accessed: 13- May- 2018].
65. "MN2213 CW 950KV (edición limitada)", RC Innovations, 2018. [Online].
Available: https://rc-innovations.es/mn2213-950kv-cw-edicion-limitada-
motor-CW-Tmotor-T-motor-recambio. [Accessed: 13- May- 2018].
66. E. kit, "Erle-Copter drone kit | Erle Robotics", Erlerobotics.com, 2018.
[Online]. Available: http://erlerobotics.com/blog/product/erle-copter-diy-kit/.
[Accessed: 13- May- 2018].
67. "Hi, I'm here to help! Compass calibration guide.", Mavic-pro.help, 2018.
[Online]. Available: http://www.mavic-pro.help/text-howto/13/compass-
calibration-guide. [Accessed: 13- May- 2018].
68. E. Robotics, "Calibrate accelerometer | Erle Robotics: Erle-copter",
Erlerobotics.gitbooks.io, 2018. [Online]. Available:
https://erlerobotics.gitbooks.io/erle-robotics-erle-
copter/en/calibrate_accelerometer/index.html. [Accessed: 13- May- 2018].
94
Appendix Appendix A: Design of the UIO for the Derived Quadcopter Model
A discrete model of the quadcopter is firstly obtained as the form discussed in equation
(4.1):
The system matrices namely A, B, C and D are as follows:
;
Where u[k] is the known input and w[k] is the unknown input
95
The first step was to determine the smallest possible value of L for which the system
was invertible. The condition was strictly followed. For
this case, m = 3.
The smallest value of L found satisfying the above condition was L = 2. The proof of
this is shown below:
Therefore, L was chosen to be equal to 2 for the derived quadcopter model.
In the next step, matrix N had to be calculated. In order to find matrix N, matrix
was obtained. The Matrix was obtained by finding the basis of the left nullspace of
the invertability matrix .
This was found by the Matlab command .
Hence, the matrix found in Matlab is shown below:
Once matrix was obtained, the next step was to find an invertible matrix W before
matrix N could be found. The steps followed to finding matrix W are as follows:
96
From the above equation, matrix was defined as Matrix 1 and matrix
was defined as Matrix 2. Moreover, since p = 6 and L = 2, these matrices
simplified to:
97
Then, a third matrix was defined as Matrix 3. By letting Matrix 1 * Matrix 2 = Matrix
3, we obtained:
Finally, the invertible matrix W could be calculated. The configuration of matrix W
was as follows; the bottom half of the matrix was the basis of the left null space of
Matrix 3 while the top half of the matrix was obtained by finding the left inverse of
Matrix 3.
The left null space of Matrix 3 was found by the Matlab command. The left inverse of Matrix 3 was found by the
98
Matlab command . Hence, matrix W was obtained as:
After obtaining the invertible matrix W, it was then possible to find the matrix N by
the equation below:
Simple matrix multiplications led to matrix N as:
Furthermore, after the calculation of matrix N, matrix 1
2
S
Swas obtained. The method
to finding this matrix is as follows:
99
This yielded matrix as:
From the above matrix, was equal to the last m = 3 rows of matrix .
In the third step, the observer matrices E and F were found for the quadcopter model.
In order to find the observer matrix E, the equation was utilized.
Since matrix E had to be stable, the eigenvalues of should be less than
or equal to zero.
The eigenvalues of E were found using the Matlab command Eigen_Value = eig (E)
100
Since not all of the eigenvalues of E were stable, matrix had to be calculated by
placing the poles at zero using the place command in Matlab. i.e.
Hence, matrix was calculated to be:
Then, the observer matrix E was calculated by which produced
the observer matrix E equal to:
Following this, the observer matrix F was obtained using the equation
.
101
Hence, the final observer for the quadcopter model with a delay of 2 was obtained as:
Where the observer matrices E and F are calculated above.
For the reconstruction of the input, a matrix G needed to be found satisfying the
condition:
From the above condition, the matrix G was then found to be:
Finally, the estimated inputed was obtained as: