University of Agder
University of Agder
by
Daniel Salem
Sindre Gjertsen
Supervisors:
Morten Ottestad
Øyvind Magnussen
Development of a new approach to the multicopter segment of the Unmanned Areal Vehicle
(UAV) family is presented. The system is designed on a T-shaped tricopter platform with abil-
ity to tilt all three motors, hereby defined as Tilt Rotor Tricopter (TRT). The highly coupled
nonlinear system is investigated through the mathematical model, and verified by simulations.
Linearization of the system has been achieved around hovering conditions, and represented in the
state-space environment. The Linear Quadratic Regulator (LQR) has been implemented on the
physical system, achieving controllable flight. As the prestudy discovered no identical platforms
to the TRT, we are proud to present a working new segment to the diversity of multicopter
platforms.
i
Acknowledgment
We would like to thank the University for providing us with the opportunity to conduct this
thesis and supplying us with the necessary components. Our supervisors have been available
for questions and help throughout the semester, which is a crucial part of this thesis outcome.
Øyvind Magnussen has been very helpful with coding the flight controller and aiding us in the
testing phase of the thesis. A special thanks to Geir Hovland for investing his time and knowledge
in assisting us with the control design and regulation. Morten Kjeld Ebbesen has spent hours
in our office explaining and helping us understand the world of 3D kinematics. A last thanks to
our friends and loved ones for understanding and supporting us all throughout these 5 years of
education.
ii
Contents
1 Introduction 1
2 System overview 3
2.1 Mechanical structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Signal flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Mathematical model 9
3.1 Reference frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Newton-Euler dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Excluded influences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Control system 22
5.1 Linearized physical system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2 Initial parameter estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3 Linear Quadratic Regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.4 Nullspace of the system matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.5 LQR with integral action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.6 Setpoint control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.7 Altitude control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.8 Controller parameter tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6 Results 32
6.1 Motion by changing the attitude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2 Motion by motor tilt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.3 Altitude controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.4 Practical implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.5 Flight test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7 Conclusion 40
Bibliography 42
List of Figures 43
iii
List of Tables 44
iv
Nomenclature
Notation Denotation
ω Motor angular velocity
F1−3 Force produced by a motor
α1−3 Servo angle
mbody Total body mass
Jbody Inertia of body
Xb , Yb , Zb Body coordinate system
Xn , Yn , Zn Navigation coordinate system
φ, θ, ψ Roll, Pitch, Yaw
Rx , Ry , Rz Rotational matrix
Cbn , Cnb Coordinate transformation matrix
p, q, r Angular velocity of the body
g Gravity
Mthrust Torque induced by thrust
Mmotor Torque induced by rotation of all motors
Mgyro Torque induced by gyroscopic effect
Mtot Total torque acting on the body
Lix , Liy , Liz Length from motor to center of gravity
h(x, u) Nonlinear function of the system
A, B, C System, input, output state-space matrices
x, u, y State, input, output vector
K1 , K2 Feedback gain matrices
SPx , SPu State setpoint, input setpoint
Notation Denotation
TRT Tilt Rotor Tricopter
UAV Unmanned Areal Vehicle
rpm Revolutions per minute
PPM Pulse-position modulation
ESC Electronic Speed Controller
IMU Inertial Measurement Unit
Rx and Tx Radio receiver and transmitter
COG Center Of Gravity
DCM Directional Cosine Matrix
CAD Computer-Aided Design
DOF Degree Of Freedom
LQR Linear Quadratic Regulator
MIMO Multiple Input Multiple Output
v
Chapter 1
Introduction
Unmanned Areal Vehicles (UAV) are establishing a foothold as the next step in the direction of computer
controlled flight. With continuous inputs, such as a directional vector given by user through a radio con-
troller, or a fixed point in space, defined as GPS coordinates, the UAV is capable of semi-autonomous and
autonomous flight. Maintaining stability while airborne requires quick and appropriate adjustments to the
stochastic disturbances. Such adjustments, if made by an operator, would be subject to delays and to the
operators skill level. By introducing the advanced control capabilities of a microprocessor with a range of
sensory inputs, maintaining stability is no longer a concern of the operator.
Recent development in microchip technology, improving size and processing capabilities along with massive
reductions in production and assembly costs, has fueled a new generation of vehicles. Technology previously
only available to heavily funded research departments and often developed for military purposes are now
commonly found in appliances like toys and mobile phones.
Pushing further into the field of unmanned flight, focusing especially on agility and stability at low speeds,
leads to the development of advanced UAV’s. In situations such as a difficult search and rescue, monitoring
the welded structure of an oil platform or the conducting cables of a power grid, having eyes on target is
an essential aid. Being able to record from this perspective appeals to film makers and photographers alike,
and the demand for compact and easy to use units are increasing.
The multicopter, often described as a tricopter or quadcopter depending on its rotor count, was developed
to meet this demand. A multicopter commonly uses 3, 4, 6 or 8 rotors to achieve flight, and while increasing
the number of rotors increases lifting capabilities and stability, it also negatively effects power consumption
and thereby require expensive high capacity batteries. Developing a multicopter with fewer rotors, with
increased agility and maintaining the stability of its bigger brethren, is a new field of rapid progression.
The tricopter, commonly resembling a Y or T shape, uses three motors to achieve flight. To maintain agility
and stability while minimizing attitude alterations, requires introduction of additional degrees of freedom.
By introducing tilt to each motor, the control systems accuracy in disturbance rejection is improved because
the number of solutions to the differential equations controlling flight is increased. In comparison, the addi-
tion of tilt allows for an increased agility as that of a multicopter with fixed rotors.
1
Prestudies revealed no previous attempts at creating a tilt rotor multicopter accessible to the general public,
although the technology has been used in military aircraft such as the Bell Boeing V-22 Osprey [8] and the
IAI Panther UAV [9]. There are several studies and projects focusing on different aspects of multicopter
flight, and the scientific background is well documented.
Previous research conducted at the university by Ø.Magnussen and K.E.Skjønhaug [13] about the dynamics
of the quadrocopter, has led to the desire of gaining additional knowledge in the field of multicopters. The
source of inspiration behind this thesis is the Orca tricopter from the computer game Command & Conquer
and the bicopter Scorpion from the movie Avatar. The main goal of this thesis is to develop a functional
tricopter with capability of tilting all three motors. This platform shall be manufactured using standard RC-
model components and have comparable cost to other multicopters, to be accessible by the general public.
The mathematical equations shall be derived, simulated and verified. A suitable controller shall be designed
and tested on the simulation model, implementing it on the physical system for experimental testing. The
final testing shall contain experimental flight recording and be discussed based on the performance of the
control system.
Figure 1.1 shows the final setup of the functional TRT model. The development of a tricopter with tilt
capability on all three rotors is presented in this thesis from scratch to flight test. In Chapter 2 the system
overview will be discussed. This contains the different components chosen for the physical TRT model and
results after component testing. Chapter 3 will explain the reference geometry and rotational matrixes,
then the differential equations based on the Newton-Euler approach will be derived. Chapter 4 discusses
the construction of the simulation model and the process where the differential equations gets verified
by a SimulationX model. The development of the control system is presented in Chapter 5, both the
linearizing process and parameter estimation for the Linear Quadratic Regulator. Chapter 6 presents the
implementation of the control system to the physical model and the results from flight tests.
2
Chapter 2
System overview
To develop the low cost platform, available to the general public, it was decided that TRT will be constructed
using only prefabricated components. This chapter addresses choice of the components, mechanical structure,
component properties and sensors necessary to complete the project. A complete part list can be found in
appendix D.
Motor
Rotational joint
Pushrod
connection
Servo
3
Platform
The platform is a T-shaped frame, with a motor on the tip of each arm. This platform is based on the
Turnigy Talon Tricopter V1.0 frame, which is a carbonfiber tricopter frame with capability of tilting only its
rear motor. The two front arms are standard 220mm tubes while the rear one has been extended to 380mm.
Two rotational joint has been added to the two front arms, thereby allowing tilting of all three motors. The
rotational joint consists of a servo connected to the motor by a pushrod connection, allowing for ±50◦ tilt.
Detailed view of tilt mechanism is shown in figure 2.1.
Propulsion
The power source of the system is a 3-cell Li-Po battery providing 11.1[V ]. The brushless DC motors that has
been selected for the project are the NTM Prop Drive 28-26, with a Ke = 1E −3 [ rpm
V ], capable of theoretically
reaching 11 100[rpm] with no load. Since the motors will be driving 8x4.5[in] propellers that are experiencing
air resistance, the resulting maximal rotational speed will be reduced. Equation 2.1 describes correlation
between the rotational speed ω and applied torque Tm . Parameters Kt , Ke , R, L are constants dependent on
the motor type, while usup and i are supplied voltage and circuit current correspondingly.
di
usup = R · i + L · dt + Ke · ω
Tm = Kt · i (2.1)
Tm di 1
ω = (usup − Kt ·R−L· dt ) Ke
Figure 2.2 show the experimental data from the motor test. The angular velocity of the motor was increased
at a very low rate during the test, reducing the motor inductance to the minimum. It can be seen that motor
reaches maximum speed of around 8 600[rpm], producing approximately 650[g] of thrust.
700
Thrust Raw
Thrust Filtered
600
500
400
Thrust [g]
300
200
100
−100
1000 2000 3000 4000 5000 6000 7000 8000 9000
RPM
The lift force is produced only by the propellers and it is therefore important to have enough thrust to
overcome the gravity. The total weight and COG placement of the TRT determines the amount of lift each
motor need to produce at the hovering state. The effective lift force of each motor is the function of the
motor tilt angle, which in the worst case results in factor of 0.64[-]. As the TRT is estimated to be 1.2[kg],
the effective lift force is still larger than the total weight.
4
To test the step response of the motors for both falling and rising step, the motor was running at a constant
thrust level then given a step change of 135[g]. As figure 2.3 shows, both rising and falling response behave
close to equal to each other. This validates that the same model can be used for acceleration and deceleration
of the motors.
520
Falling Step
520
Rising Step
500
540
480
560
460
Thrust [g]
Thrust [g]
580
440
600
420
620
400
640
380
660
360
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time [s]
The motors are controlled by the Electronic Speed Controller (ESC), which converts the input Pulse-Position
Modulated (PPM) signal into the output 3-phase motor signal. The input PPM signal has to be created by
the microcontroller. The created signal is designed for the 16[MHz] microcontroller, where 16000 cycles is
equal to 1[ms]. Each PPM signal period starts with a 1[ms] pulse, which initializes the period. Pulse length
past 1 [ms] is the control signal, which varies in length from 0 to 1 [ms]. The maximum combined pulse length
is 2 [ms]. The total period of the PPM signal is 20[ms], where the last 18[ms] is called a synchronization
period, as shown in figure 2.4.
Min Max
value value
HIGH
Control
16000
signal
T-sync
LOW
0 1ms 2ms 20ms
T-period
5
The control signal for the motor is described by the P E function and is build on the rpm to thrust relationship
shown in the figure 2.2. The maximum value of the function is limited to 16000, which corresponds to the
maximal rotational velocity of the motor. The polynomial equation is calculated by the polyfit() function in
Matlab and presented in the equation 2.2.
12000
PE value [−]
10000
8000
6000
4000
2000
0
0 1 2 3 4 5 6 7
Thrust [N]
The servomotors are controlled using the PPM signal as well. The control signal for servomotors is described
by the function SA in the equation 2.3, where α is the desired angle in radians and sr is the operational
range of the servomotor in degrees.
16000
SA = 8000 + α · sr·π/180
(2.3)
When the servomotors are supplied with a voltage of 4.8[V ], the turn rate is 60◦ per 0.07[s] with no load.
kg
These are powerful digital servos with a stall torque equal to 2.4[ cm ]. The high specifications of the servo-
motors led to that no practical tests was conducted, due to low anticipated angle adjustment of the motors
during flight.
6
2.2 Signal flow
On the TRT there are several components that interact with each other. The ATmega 2560 microcontroller
is the centerpiece for the signal flow, as shown in figure 2.6. The ATmega receives accelerations and angle
rates from the IMU and pilot commands from the receiver (Rx), then calculates signals needed to perform
the given commands and sends it to the servos and ESC’s. The ESC’s then sends the converted signal to
the motors.
Barometer
Servos
Flight controller
The TRT is equipped with the MultiWii Mega flight controller. It contains an Inertial Measurement Unit
(IMU) with 3 axes accelerometer, 3 axes gyroscope and additionally it equipped with 3 axes magnetometer
and 1 barometer. The microcontroller used on the Multiwii Mega flight controller is the ATmega 2560. This
is a simple microcontroller that has 16MHz clock frequency and are badly suited to handle floating point
arithmetics. It has limited computational resources which means that the algorithms has to be effetely coded
and as limited as possible.
Sensors
The IMU used on the MultiWii Mega flight controller is a 6 DOF chip of type MPU6050. The accelerometer
measures accelerations which the IMU is exposed to. Accelerometers are known to be affected by white
Gaussian noise, which is a drawback when it comes to sensitive control systems. The Gyroscope measures
the angular velocities of the IMU. It is possible to integrate the gyroscope data to get angle, however the
angle tend to drift due to bias error in the signal [3]. Gyroscope are less affected by noise compared to the
accelerometer.
The magnetometer is of type HMC5883L, that can measure the direction and the strength of the earth mag-
netic field. This gives the relative heading in relation to the earth magnetic field. As all other compasses,
surrounding and the self produced magnetic fields will influence the accuracy of the measurements. This
effect can be compensated for by utilizing sensor fusion technics.
The barometer of type MS5611 measures the atmospheric pressure and can therefore be used to keep track
of the altitude. Since atmospheric pressure is influenced by temperature, wind, air humidity etc, its not an
accurate sensor without being calibrated for the conditions the day of the flight. The optimal use of this
sensor is the altitude hold function, where it only has to detect changes in the atmospheric pressure, rather
then give out an numeric altitude.
7
Communication
A radio controller (RC) is used to send commands to the flight controller. The transmitter (Tx) and receiver
(Rx) uses the 2.4 GHz frequency band, which is the most commonly used hobby RC frequency. The layout
of the controller is shown in figure 2.7. It sends the pilot commands wireless to the onboard receiver, which
is connected to the flight controller.
1 4
2 3
1: Throttle 3: Roll
2: Yaw 4: Pitch
The pilot commands will consist of roll and pitch angles, yaw rate and a throttle gain. As shown in figure
2.7 the left stick controls the throttle and yaw, where the right stick controls the pitch and roll angles. By
choosing to control pitch and roll angle instead of angle rate, allows that zero position on the right stick
equal to a zero degree pitch/roll angle. It is not desirable that TRT will return to the zero yaw angle when
releasing the controller, therefore the angular yaw rate has been selected as proper yaw control.
8
Chapter 3
Mathematical model
The mathematical model describing the physics of the tilt rotor tricopter was derived with the objective of
creating both a simulation model, and an advanced control system based on its dynamics. For an object
in a 3D environment, there are at least two different reference systems, local and global reference system.
With forces acting on the body in different reference system, these need to be transformed to coexist in the
same equations. The transformations matrices and reference systems will be explained in chapter 3.1. The
mathematical model has been build up using the Newton-Euler approach, which describes the translational
and rotational dynamics of a body in a 3D environment. It combines the forces and torques acting on the
COG of the TRT to a nonlinear set of equations.
A perfect replication of a physical system can never be achieved by a mathematical model [5]. There
will always be some simplifications and/or different phenomenon that can not be modeled accurately. By
including what has the most dominant effects on the system, and excluding the peripherals, the mathematical
model can be used to estimate the TRTs behaviour under certain circumstances. In order to reach the
objective, several assumptions were made to avoid making the system unnecessarily complex. An evaluation
of the tricopters behaviour and its physical properties led to the following assumptions:
9
3.1 Reference frames
In order to derive the mathematical model for the TRT, reference frames have to be established. This system
have several moving parts, which affect behavior of the TRT in the air. The figure 3.1 shows the simplified
structure of the tilt rotor tricopter with actuated parts of the system. The main coordinate system for the
TRT is placed in the COG, also referred as body frame and axis are denoted Xb , Yb and Zb . The body frame
describes the forces and moments acting on the TRT. To track the attitude and position of the TRT in the
room, an external coordinate system is used which is referred to as the navigation frame with axes Xn , Yn
and Zn . A local coordinate system is established for each of the motors. Forces F1−3 which are induced due
to the rotating propellers are illustrated with single arrows and corresponding induced torques with double
arrows. Each motor can be actuated separately and tilted in respect to the main body structure with an
angle α1−3 as denoted in the figure.
F 1
F 3
Z b
1
3
F 2
X b
Y b
Z
n
2
X n
Y n
The origin for the body frame in placed in the COG. This gives the opportunity to utilize the Newton-Euler
approach to describe the dynamics of the TRT. Due to the variable orientation of the forces acting on the
COG, transformation of those is needed in order to represent them in the body coordinate system.
10
Coordinate system transformation
To describe the orientation of a coordinate system in relation to the other, rotational angles around each axis
have to be known. Given the initial alignment of coordinate systems show in the figure 3.1, transformation
of a vector from the body frame to the navigation frame is shown in the figure 3.2.
Zn Zn Yn
X-rotation Y-rotation Z-rotation
Zb Zb Yb
Yb Xb
φ Yn Xn ψ Xn
θ
Xb
The applied method of describing the orientation of the rigid body in space is developed by Peter G. Tait and
George H. Bryan [10] and is a variation of the Euler’s rotation theorem. By consequently rotating around
the updated axis in the sequence of X-Y-Z, orientation of the rigid body can be described. The rotational
matrices for each axis are given by equation 3.1. This equation describes transformation of the vector from
the body frame to the navigation frame one axes at the time with angles denoted to be: φ - roll, θ - pitch,
ψ- yaw, which are also referred to as Euler angles. Due to similar orientation of other coordinate frames in
the system, same formula can be applied for transformation between the motor and the body frame.
1 0 0 cos(θ) 0 sin(θ) cos(ψ) − sin(ψ) 0
Rx (φ) = 0 cos(φ) − sin(φ) ; Ry (θ) = 0 1 0 ; Rz (ψ) = sin(ψ) cos(ψ) 0 (3.1)
Total deviation in the attitude between two coordinate systems can be described by equation 3.2. The
matrix Cbn is also referred to as Directional Cosine Matrix (DCM) and in the particular case of this system,
transforms any vector from body frame to navigation frame. Inverse of the DCM matrix, denoted as Cnb
performs the transformation from the navigation frame to the body frame [10].
cos(θ) cos(ψ) − cos(θ) sin(ψ) sin(θ)
Cbn = sin(θ) sin(φ) cos(ψ) + cos(φ) sin(ψ) − sin(θ) sin(φ) sin(ψ) + cos(φ) cos(ψ) − cos(θ) sin(φ)
− sin(θ) cos(φ) cos(ψ) + sin(φ) sin(ψ) sin(θ) cos(φ) sin(ψ) + sin(φ) cos(ψ) cos(θ) cos(φ)
(3.2)
11
Angular rates
Angular rates of the rigid body in the navigation coordinate system can be described using the Euler angles,
which are defined previously. Due to properties of 3D kinematics, the angular rates of the body coordinate
system can not be directly integrated to gain the values of the attitude angles [10]. Equation 3.3 describes
transformation of the angular rates in body frame (p, q, r) to angular rates in the navigation frame (φ̇, θ̇, ψ̇),
also called Euler rates.
p φ̇ 0 0
T T
q = (Rx (φ)Ry (θ)Rz (ψ)) · 0 + (Ry (θ)Rz (ψ)) · θ̇ + 0
r 0 0 ψ̇
(3.3)
p cos(θ) cos(ψ) sin(ψ) 0 φ̇ φ̇
q = − cos(θ) sin(ψ) cos(ψ) 0 · θ̇ = T · θ̇
r sin(θ) 0 1 ψ̇ ψ̇
φ̇ p
−1
θ̇ = T · q (3.4)
ψ̇ r
The Euler rates can be integrated to obtain the attitude of the TRT, however some specific orientation of the
TRT will result in the singular matrix T . The Tait-Bryan formulation dictates the limitation of the workspace
so that the range of the angles are: φ = ±180◦ , θ = ±90◦ and ψ = ±180◦ . This limitation is considered
to be acceptable since TRT will not be able to achieve flight in such orientations due to constructional and
mechanical properties.
Equation 3.5 describes the force equilibrium for the COG of the TRT. The system is affected by both internal
and external forces, which all are transformed to the body frame. The motor thrust can be directly described
in the body frame with a simple rotational matrix, while gravity is defined in the navigational frame and
have to be multiplied by DCM matrix.
12
A fixed-motor multicopter will always have thrust along the Z-axis of the body frame, where on the TRT
motors can be tilted. The tilt angles are accounted for by multiplying the thrust vector with a rotational
matrix, resulting in a force vector acting along multiple axis in the body coordinate system. The force vector
F1 and F2 can rotate around the Y-axis, as shown in figure 3.1, and therefore multiplied with the rotational
matrix Ry , where F3 is multiplied with Rx due to rotation around the X-axis.
Z b
Force vector
Thrust
X b
Some simplifications has been done regarding the propeller thrust in this model. In the physical model, the
thrust produced by the propeller rotates with an arc around the rotational joint of the motor, with a radius
equal to the height of the motor. In the mathematical model, the forces vector rotates around a rotational
joint of the motor without the radius as show in the figure 3.3. This has been considered to reduce the
accuracy of the mathematical model to a minimum due to small displacement of the force origin.
The moment equilibrium is described in the equation 3.6 and is derived in the body coordinate system. The
TRT is affected by several moments, originated by the different sources.
ṗ
Jbody q̇ = Mthrust + Mmotor − Mgyro = Mtot (3.6)
ṙ
Each thrust vector have a displacement from COG, therefore inducing a torque around the different axis
of the body frame. The displacement vectors are measured from the center of the propeller to the COG of
the TRT. The axis, around which Mthrust creates torque, varies as a result of the motor tilt. To be able to
calculate the torque in the body frame, the rotational matrixes have been included to account for this effect.
The torque contribution is shown in equation 3.7.
L1x 0 L2x 0 L3x 0
Mthrust = L1y × Ry (α1 ) · 0 + L2y × Ry (α2 ) · 0 + L3y × Rx (α3 ) · 0 (3.7)
13
The thrust is produced by the propellers which are mounted to brushless DC motors. Spinning motors
induce torque that acts in the opposite direction of the motor rotation, as described in the equation 3.8.
The direction of the torque Mmotor will also be affected by motor tilt, therefore the rotation matrixes has
been included to adjust for it. The torque constant Kt is specific for the given type of motors with propellers.
0 0 0
Mmotor = Kt Ry (α1 ) · 0 + Ry (α2 ) · 0 + Rx (α3 ) · 0 (3.8)
F1 −F2 F3
The TRT will change its direction and attitude in the air, which will cause the angular velocity vector to
change its direction, inducing the torque referred to as Mgyro . This therm is a part of the general form of
moment equilibrium for the rigid body motion. Equation 3.9 describes the induced torque as a function of
the angular rate and the inertial matrix of the body.
p p
Mgyro = q × Jbody · q (3.9)
r r
Dynamics of the TRT can be defined by the nonlinear function h(x,u) shown in equation 3.10. Parameters
describing the pose of the TRT are the attitude angles and position, measured in respect to the navigational
coordinate system. Since the navigational frame is assumed to be the inertial reference frame, the force
equilibrium can be represented in the navigational frame by simple transformation using the Cbn . The
attitude angles can be estimated by using the Euler rates.
Ẍn Ẍb
n ¨
Ÿn Cb · Yb
Z̈n Z̈b
φ̇ p
−1
θ̇ = T · q
h(x, u) = (3.10)
ψ̇ r
ṗ
−1
q̇ Jbody · Mtot
ṙ
Drag
When an object moves through the air, the relative velocity between the object and the air creates a force
in the opposite direction. The force depends on the air density ρ, the velocity relative to the air v, a drag
coefficient C and the reference area A. This has not been implemented in the mathematical model due to
advanced aerodynamics with the turbulence created by the propeller [11].
2
Ax Cx 0 0 vx
1 2
Fdrag = ·ρ· 0 Ay Cy 0 · vy (3.11)
2
0 0 Az C z vz2
14
Atmospheric parameters
Atmospheric influences has not been included in the calculations due to the complexity of the governing
equations required to calculate these data accurately. Parameters such as air temperature, pressure and
humidity actively influence the lift produced by the propeller, but has been considered static for simplicity.
Wind conditions will cause the TRT to drift, but as the TRT has no position feedback, there is no way
to correct this properly. Because the TRT will be tested in an indoor environment, these atmospheric
parameters will have a minimal effect on the system, and are therefore negligible.
When an object rotates, it induces a gyroscopic effect. Since the TRT can tilt its rotors, two different cases
of changing the rotor axis angle are investigated. The equations 3.12 and 3.13 describe the gyroscopic effect
of the rotation of the rotor, where M1 the attitude change of the TRT and M2 is tilt of the motor assembly.
Note that Jm and Jms describes two different inertia moments due to different axis of rotation.
The torque M1 is induced, when TRT rotates with locked motor angle.
Jmx 0 0 0 p Jmx 0 0 0 p
M1 = 0 Jmy 0 × Ry (α1 ) · 0 · q + 0 Jmy 0 × Ry (α2 ) · 0 · q
0 0 Jmz ω1 r 0 0 Jmz ω r
2
Jmx 0 0 0 p
+ 0 Jmy 0 × Rx (α3 ) · 0 · q
0 0 Jmz ω3 r
(3.12)
The torque M2 is induced when changing motor angles at the constant attitude of the TRT.
Jmsx 0 0 0 0Jmsx 0 0 0
M2 = 0 Jmsy 0 × Ry (α1 ) · 0 · α˙1 + 0 Jmsy 0 × Ry (α2 ) · 0 ·
0 0 Jmsz ω1 0 0 0 Jmsz ω
2
0 Jmsx 0 0 0 α˙3
α˙2 + 0 Jmsy 0 × Rx (α3 ) · 0 · 0
0 0 0 Jmsz ω3 0
(3.13)
The change of the motor angle is actuated by the servo, accelerating a mass and inducing the torque M3 .
Jmsx 0 0 α¨1
M3 = 0 Jmsy 0 · α¨2 (3.14)
0 0 Jmsz α¨3
As the TRT is not designed for acrobatic flying, it will not be exposed to quick changes both of servo angles
and attitude. Since M1 , M2 and M3 requires high rates of change to noticeable influence the system, these
have not been included in the simulations and mathematical equations.
15
Chapter 4
Figure 4.1 shows the CAD model of the TRT. The peripheral equipment was removed from the figure, due
to a cleaner illustration of the model.
16
Figure 4.2: SolidWorks 3D CAD model
Figure 4.2 shows a CAD model of the mechanical design for the motor tilt function. The servo is attached
to the motor mount with a pushrod connection. The orientation of the upper connection point limits the
tilt arc to the 50◦ to each side. Such mechanism adds a lot of weight to the tip of each arm, increasing the
inertia of the model, which is a downside of this prefabricated frame.
Table 4.1 shows the physical parameters extracted from the CAD model. The inertial matrix of the system
has been simplified to a diagonal matrix. These parameters are used in the mathematical equations and the
simulation model.
17
4.2 SimulationX model
The SimulationX model has been build using Multi Body System (MBS) components and shown in the
figure 4.3. All of the components are positioned using the dimensions from the SolidWorks model, giving
the simulation model correct geometrical properties. To make the response of the simulation model as close
to the physical model as possible, the inertia and weight of the CAD model was applied. This means that
all components have neglectable mass (1 · 10−11 kg), except the small sphere placed at COG containing the
inertia matrix and weight of the system.
The main goal of the simulation model is the verify the Newton-Euler approach, which has been build up
using force and angles. Presets has been used as servos to drive the rotational joints which have infinite
torque and power. The servo and motor dynamics can be implemented at a later stage if a more complete
mathematical model is desired. The lift is simulated by a force vector and the torque caused by the rotating
propeller is included with a torque vector. The simulation model is based on the same assumptions as the
mathematical model described in Chapter 3.
The challenge of using SimulationX for this method, is that SimulationX does not give out the equations it
uses for simulations. This means that is it difficult to identify all the forces and influences SimulationX take
into consideration under simulations. In the early phase of co-simulation, the difference between the two
models where a major concern. This led to a process where the SimulationX model and the mathematical
model was step by step increased in complexity. By performing this stepwise process, it was possible to
confirm that the mathematical model, contained the same forces and effects as the SimulationX model.
By exposing the SimulationX model to high rates of roll, pitch and yaw, it could be concluded that the
gyroscopic effect of the body plays a major role in the model. It is often seen that in 2D dynamics the
gyroscopic effect is neglected, where in 3D it is a crucial part of the body dynamics.
18
4.3 Verification of the equations
To verify the mathematical equations, the model built in SimulationX has been exported to Matlab Simulink.
By comparing the behavior of each model with the same parameters, it is possible to verify that the equations
are correct. The tests are performed with no control system in place and the input signals are tuned to
provoke motion in all 6 DOF. The flight test begins in hovering state, then increases velocity in the all three
directions. To track the behavior of both models, a 3D visualization has been made, which is shown in the
figure 4.4.
The input parameters was constant throughout the test of 5[s], resulting in the following flight path shown in
figure 4.5. The resulting pose are discussed in more details by reviewing the attitude and position separatly.
Flight Path
|
| COG
|
3
z−translation [m]
0
14
12
10 −45
−40
8
−35
6 −30
−25
4 −20
−15
2
−10
0 −5
0
−2 5 y−translation [m]
x−translation [m]
19
Attitude
The figure 4.6 shows the attitude response of both models from the verification test. It can be seen that
the mathematical equations almost identically reproduce the SimulationX model results. Such similar re-
sults indicates that the mathematical equation correctly describes the torque equilibrium, as derived in the
equation 3.6.
1
Matlab φ
0.5 Matlab θ
Matlab ψ
0 SimX φ
SimX θ
−0.5
SimX ψ
angle [rad]
−1
−1.5
−2
−2.5
−3
−3.5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
−9
x 10
4
error φ
error θ
3 error ψ
2
angle [rad]
−1
−2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
The attitude error between the models, which is shown in the figure 4.7, reaches the maximum value of
3.2E −9 [rad]. This deviation in the results can be caused by numerical approximation. Due to the small
order of the error value, it can safely be neglected.
20
Position
As figure 4.8 shows, the mathematical equations and the model from SimulationX are behaving near identical.
It is worth noticing that monitoring the position is only possible in the simulation, but it can be used to
verify the force equilibrium derived in the equation 3.5.
15
Matlab Xn
10 Matlab Yn
Matlab Zn
5
SimX Xn
0
SimX Yn
position [m]
−5 SimX Zn
−10
−15
−20
−25
−30
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
−7
x 10
1
error Xn
0.8 error Yn
0.6 error Zn
0.4
position [m]
0.2
−0.2
−0.4
−0.6
−0.8
−1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
The positional error between the models is greater than for the attitude, but considering the distance traveled
of 30[m] during the simulation of 5[s], the maximum error of 0.8E −7 [m] is insignificant. Due to the lack of
positional feedback on the physical system, the attitude angles are the parameters which control system will
be based on.
21
Chapter 5
Control system
The goal of this thesis is to design a control system capable of maintaining a hovering state and performing
controllable low speed flight in an indoor environment. The design strategy chosen for the control system is
based on utilizing the dynamic model in a state-space environment. The structure and components of the
system are described in the Chapter 2 and gives necessary information about the mechanical aspect of the
system as well as overview over available sensors. The dynamics of the tilt rotor tricopter are described in
the Chapter 3 provides information about the in air behavior of the system.
However, due to the highly nonlinear nature of the mathematical model, the control system will be de-
signed based on a linearized model [6] around the hovering state of the TRT. A Linear Quadratic Regulator
(LQR)[12] is well suited for a Multi Input Multi Output (MIMO) system, which is the case with the TRT
model. Usage of the LQR guarantees stability of the system, which is achieved by minimizing the quadratic
optimization problem and feedback from the sensors. The control system is developed using Matlab Simulink
software package. The complete control system for the linearized model is also verified by applying it to the
nonlinear system, which ensures adequate behavior of the TRT.
22
5.1 Linearized physical system
Since the TRT will not be used for hight speed aerial maneuvers and limited only to the hovering and low
speed flight, the mathematical model can be simplified accordingly. The linear model of the TRT is modeled
as the state-space structure with multiple input and output signals. At the hovering state, the system have
to maintain the predefined position and orientation in the room. This implies that the model has to be
linearized around the equilibrium point (x0 , u0 ), so that the first derivative of the state variables are equal
to zero.
In order to linearize the general nonlinear function, it is typical to apply the first order Taylor Series expansion
[4], as shown in the equation 5.1. To implement this method on the current system, the initial step is to
identify the input and state variables of the linear system, which are describing the TRT’s behavior around
the equilibrium point.
∂h(x, u) ∂h(x, u)
h(x, u) ≈ h(x0 , u0 ) + (x − x0 ) + (u − u0 ) (5.1)
∂x (x0 ,u0 ) ∂u (x0 ,u0 )
The input to the system is composed of the three forces F1..3 induced by the rotating propeller, followed
by three servo angles α1..3 which control the direction of the force vector. The outcome of the input vector
becomes u = [F1 , F2 , F3 , α1 , α2 , α3 ]T . The state variables of the system are selected to consist of Euler angles
(φ, θ, ψ) and angular rotational rates of the body coordinate system (p, q, r). Such set of output parameters
should be sufficient to stabilize the attitude of the TRT, leaving the positional control to the operator. The
resulting state vector is given in form of : x = [φ, θ, ψ, p, q, r]T , which have available feedback signal.
Linearized physical model of TRT in state-space structure will result in A,B and C matrices, where elements
of the A and B matrices are given by ai,j , bi,j correspondingly, as shown by equation 5.2.
The A,B and C matrices are derived for the chosen variables in the state vector. The detailed description of
nonzero elements of matrices are available in the Appendix A.
0 a1,2 a1,3 a1,4 a1,5 0 0 0 0 0 0 0
0 0 a2,3 a2,4 a2,5 0
0
0 0 0 0 0
0 a3,2 a3,3 a3,4 a3,5 a3,6 0 0 0 0 0 0
A= B=
0 0 0 0 a4,5 a4,6
b4,1
b4,2 b4,3 b4,4 b4,5 b4,6
0 0 0 a5,4 0 a5,6
b
5,1 b5,2 b5,3 b5,4 b5,5 b5,6
0 0 0 a6,4 a6,5 0 b6,1 b6,2 b6,3 b6,4 b6,5 b6,6
(5.3)
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
C=
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
23
Finally, the structure of the linearized state-space system can be described by the equation 5.4
One of the most convenient equilibrium point that can be chosen for hovering, is the zero-attitude point.
This point can be described by the state variable vector as x0 = [0, 0, 0, 0, 0, 0]T , where the Euler angles as
well as angular velocities around the body frame axis are zero. It is worth noticing that in such hovering
state the TRT will remain level at any given position [Xn , Yn , Zn ]T in the room, since it is not bounded by
the state vector. By accurately identifying the input parameters for the equilibrium point, it is possible to
increase the precision and performance of the control system. The correct parameters may also decrease the
positional drifting of the TRT.
Two configurations of the input vector u0 are reviewed to achieve the zero-attitude point. Since both pa-
rameter sets satisfies the criterion for an equilibrium point, the input vector is selected based on the ability
of holding the predefined pose and suitability for the TRT construction. The simulation is conducted in
Matlab Simulink without implemented control system, which also indicates how unstable the TRT model is.
The first one is the classical tricopter configuration, where the two propellers in front are aligned perpendic-
ularly to the body while the rear one is angled to compensate for yaw rotation. The estimated values of the
input vector is u1 = [4.8063, 4.8054, 2.3527, 0, 0, −0.018]T . As it can be seen from the figure 5.1, the TRT is
able to hold its position fairly well, deviating only by 0.53[m] from the predefined point over the period of 5
seconds.
24
0.6
Xn
0.5 Yn
Zn
0.4
0.3
position [m]
0.2
0.1
−0.1
−0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
The second configuration is adapted to the TRT design, exploiting the additional DOF of the actuators.
By holding the rear motor perpendicular to the body and tilting the front motors, the yaw rotation can
be stabilized. The estimated value of the input vector is u2 = [4.8050, 4.8063, 2.3530, −0.0056, 0.0056, 0]T .
Using this set of input parameters, TRT holds predefined position more accurate with deviation of 0.2[m] as
shown in figure 5.2.
0.15
Xn
0.1 Yn
Zn
0.05
position [m]
−0.05
−0.1
−0.15
−0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time [s]
An additional advantage of using input parameters u2 is in transition from hovering to forward flight without
tilting the body of TRT. Such transition can be done simply by tilting the front motors simultaneously
forward, while with the classical setup the angle of all three motors have to be adjusted. Considering the
advantages of the parameter set u2 , it was chosen to be used in the linearized model of the physical system.
The matrices A,B and C can now be numerically estimated, with given values of x0 and u0 . The detailed
description of numerical values for matrices are available in the Appendix B.
25
5.3 Linear Quadratic Regulator
The controller implemented in this thesis is based on modern control theory, which uses a dynamical model
of the systems to compute the optimal gain. The type of controller is a Linear Quadratic Regulator, and
derived from the linearized state-space model of the physical system. This type of a regulator is well suited
for MIMO systems and guaranties stability, while the performance is dependent on the choice of the controller
parameters. To recap the derived state-space model of the TRT, linearized for hovering, parameters are as
follows:
ẋ(t) = A(x(t) − x0 ) + B(u(t) − u0 )
y(t) = C(x(t) − x0 )
where:
x = [φ, θ, ψ, p, q, r]T x0 = [0, 0, 0, 0, 0, 0]T
u = [F1 , F2 , F3 , α1 , α2 , α3 ]T u0 = [4.8050, 4.8063, 2.3530, −0.0056, 0.0056, 0]T
0 0 0 a1,4 0 0 0 0 0 0 0 0
0 0 0 0 a2,5 0
0
0 0 0 0 0
0 0 0 0 0 a3,6 0 0 0 0 0 0
A= ;B = ;
0 0 0 0 0 0 b4,1 b4,2 b4,3 b4,4 b4,5 b4,6
0 0 0 0 0 0 b b5,2 b5,3 b5,4 b5,5 b5,6
5,1
0 0 0 0 0 0 b6,1 b6,2 b6,3 b6,4 b6,5 b6,6
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
C=
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
At this point the linear model is identified and numerically estimated(see Apendix A and B). This gives
the possibility to investigate the dynamical characteristics of the system matrix A, as well as observability
and controllability of the plant. Controllability is a critical property of the plant, which enables the internal
state of the physical system to be changed in its entirety by applying the the external input to the system.
Equation 5.5 describes the criteria for a system to be classified as fully controllable.
Rank(Cm ) =dim(x);
(5.5)
Cm = [B AB A2 B A3 B A4 B A5 B]
The observability of the system is an indication on the determinability of the state vector, based on the
external input to the system. A fully observable plant enables to measure all states, giving the control
system the full state feedback. Equation 5.6 describes the criteria for a system to be classified as fully
observable.
Rank(Om ) =dim(x);
(5.6)
Om = [C CA CA2 CA3 CA4 CA5 ]T
Applied for the current model of the TRT the Rank(Cm )=Rank(Om )=6, which is equivalent to the dimension
of the state vector x. This means that the linear model of the TRT is fully controllable and fully observable.
26
After the process of linearizing the TRT model around the (x0 , u0 ) point, system matrix A has lost a lot of
the elements describing the dynamics at high rotational rate. Considering the boundaries of the intended
flight mode, such limitation is acceptable. However, at high speed maneuvers the control system will no
longer be optimal, resulting in deviation from predicted behavior. The overview of the control strategy is
presented in figure 5.3, where the gain K1 is the contribution from the LQR.
u₀ x₀
B ∫ dt C
-K₁
As it was mentioned earlier, LQR is based on the optimization of the cost function, balancing the change
of the input and state vector. Governing equations for estimating the gain, assuming the infinite-horizon
continuous-time system, K1 are given as such:
x̃ = x − x0 ũ = u − u0
R∞ T
JLQR = 0 (x̃ Qx̃ + ũT Rũ)dt
u = −K1 x̃ (5.7)
−1 T
K1 = R B S
SA + AT S − SBR−1 B T S + Q = 0
The JLQR is the quadratic cost function based on the total energy of the system. The matrix Q penalizes
the change of the energy state of the controlled output, while the matrix R corresponds to the change in the
energy state of the control signal. Minimizing total energy of the system, gain K1 can be obtained resulting
in the optimal input vector u. The constant gain K1 can be found by solving the algebraic Riccati equation
and calculating the positive-semidefinite matrix S.
The first choice of values for the cost function parameters are calculated by using the Bryson’s rule [7]. For
the diagonal matrices Q and R weight of the elements are given by equation 5.8.
1
Qii = maximum acceptable value of x2i
1
(5.8)
Rii = maximum acceptable value of u2j
Although Bryson’s rule do not provide the optimal value of the parameters, it is a good starting point for the
iterative process of tuning the parameters to gain the best performance. One of the effects of the diagonal
layout of Q and R matrices, is a discrete penalization of the state and input vector. Non-diagonal setup will
increase the performance of the system, but is very complicate to estimate.
27
5.4 Nullspace of the system matrix
Earlier in this chapter it was stated that the TRT is able to hover in air with different attitude orientations.
This is caused by the introduction of additional DOF for the system, making it possible to independently
move and rotate in all six DOF of the navigational frame. It was also stated that it is desirable to main-
tain the zero-attitude orientation while hovering, which is given by the state vector x0 = [0, 0, 0, 0, 0, 0]T .
The linear model of TRT does not have an unique input-output relation due to Ax = 0 containing a non-
trivial solution. By investigating the system matrix A it is possible to determined the nullspace of the system.
0 0 0 a1,4 0 0
0 0 0 0 a2,5 0
0 0 0 0 0 a
3,6
Ax = φ · + θ · + ψ · + p · +q· +r· (5.9)
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
The equation 5.9 shows how the value of the three first states (φ, θ, ψ) do not effect the output of the system.
To be able to maintain the desired orientation of the TRT, the control system has to be modified accordingly
and give the necessary constrain to the physical system.
u₀ x₀
B ∫ dt C
-K₁
-K₂ ∫ dt
28
Purpose of the integral action is to track the total deviation of the attitude states (φ, θ, ψ) and force it to
zero. The augmented system [12] becomes:
u₀ SPᵤ SPₓ x₀
B ∫ dt C
-K₁
-K₂ ∫ dt
The value of the SPx modifies the attitude offset, resulting in motion of the TRT by tilting the body. The
SPu controls the total thrust of the system and feedforwards the angle of the motors to achieve motion of
the TRT without tilting it.
29
The figure 5.6 shows how the signal from the transmitter is interacting with the control system parameters
to achieve the desired behavior. The pilot is provided with 6 controls, one for each degree of freedom. The
SPx signal consists of 3 channels; Ctrl.Roll, Ctrl.Pitch and Ctrl.Yaw rate. By subtracting the value of SPx
from the original vector x0 , offset from the initial value will be created, provoking the system to react. The
positive value of the SPx will result in the positive angle change.
SPᵤ SPₓ
Ctrl. Thrust
Ctrl. Pitch
Sideways
Ctrl. Yaw
Ctrl. Roll
Forward
Ctrl.
Ctrl.
rate
u₀ new u₀ x₀ new x₀
F1 F1 φ + - φ
F2 X F2 θ + - θ
F F ψ ψ
3
3
1 1 p p
+ 2
q q
2
3 + 3 r + - r
The SPu signal consists of 3 channels as well; Ctrl.Thrust, Ctrl.Forward and Ctrl.Sideways. The Ctrl.Thrust
controls the total trust produced by the TRT, accelerating in up and down. The Ctrl.Forward and Ctrl.Sideways
manipulates the motor angle, resulting in the longitudinal and transverse translation without change in the
attitude. These two signals rely on the LQR to maintain the attitude values. Alternatively, the inverse
kinematics can be used to improve the feedforward signal.
SPᵤ
Altitude
Ctrl. Thrust ++ PID
-+ setpoint
Barometer
Ctrl. feedback
Forward
1
Ctrl.
Sideways
30
5.8 Controller parameter tuning
The cost function parameters was estimated by means of the simulation model. As a starting point the
Bryson’s rule was applied. In order to improve response of the system, parameters were manually adjusted
to follow a predefined reference signal. Figure 5.8 shows the pitch response of the TRT to the reference
signal, using the final controller parameters. Calibration of the roll response is done in the same manner,
producing very similar results, therefore not included in this paper.
0.15
Response
Reference
0.1
0.05
angle [rad]
−0.05
−0.1
−0.15
−0.2
0 2 4 6 8 10 12 14 16 18
time [s]
The reference signal consists of two periods of the 9-point sampled sinus wave, split by 2 second pause. The
reference signal has an amplitude of 0.1 radians and a period of 4 seconds, which was assumed to be close to
the pilot input in real life situation. For the augmented system with state vector x = [ φ, θ, φ, θ, ψ, p, q, r]T
R R
and input vector u = [F1 , F2 , F3 , α1 , α2 , α3 ]T , the cost function parameters are estimated to be as follows :
10 0 0 0 0 0 0 0 0
0 10 0 0 0 0 0 0 0 0.01 0 0 0 0 0
0 0 0 0.08 0 0 0 0 0 0 0.01 0 0 00
0 0 0 0 0.08 0 0 0 0 0 0 0.01 0 0 0
Q= R=
0
0 0 0 0 0.08 0 0 0 0
0 0 0.5 0 0
0 0 0 0 0 0 0.02 0 0 0
0 0 0 0.5 0
0 0 0 0 0 0 0 0.02 0 0 0 0 0 0 0.5
0 0 0 0 0 0 0 0 0.02
(5.11)
31
Chapter 6
Results
All of the theoretical aspects of this thesis have been reviewed, from the system identification in Chapter 3,
simulation model in Chapter 4 to the control system in Chapter 5. The closing part of this thesis will put the
theoretical research and control system to the test by simulations and implementing it to the physical system.
To verify that the control system is ready for implementation on the physical model, simulation experiments
are conducted on the nonlinear model. Section 6.1 and 6.2 presents the results of simulated translative flight
path, using either change of attitude or motor tilt to realize the motion. The results show that the TRT is
capable of moving in all 6 DOF, thereby the holonomic term can be accurately used to describe the TRT.
The altitude controller is simulated separately, to verify that an altitude can be maintained in both scenarios.
Validation of the controller is conducted in section 6.5, by implementation on the assembled TRT platform.
Because the controller verification is done by means of simulation, validation by the physical model also
confirms the dynamic equations within the simulation environment. The assumptions made during devel-
opment were taken into account, and a deliberate choice of flight test grounds was made to minimize the
effects of the external factors. Two separate flight tests are conducted, testing roll and pitch response.
32
6.1 Motion by changing the attitude
Most multicopters control their translative motion by changing the attitude. The first simulation, shown
in the figure 6.1, provokes motion of the TRT by the classical method. The setpoint for the attitude is
manipulated by the SPx to achieve the sinusoidal change in the attitude. The simulation is split up in the
three sections. Part 1 is from 5[s] to 15[s], contains motion along the Yn axis. Part 2 is from 20[s] to 30[s]
and contains motion along the Xn axis. Part 3 is from 32[s] to 35[s] and contains yaw rotation.
Part 1
The TRT receives a sinusoidal signal, which initializes rotation in the negative roll direction. The roll angle
reaches magnitude of the 0.8◦ , which leads to the movement of 1.8[m] by the TRT in positive y-direction.
The control system initialize the roll maneuver by shifting the force balance between F1 and F2 , leaving the
servomotors unaffected. F1 and F2 are modulated by the control system to make sure that the TRT holds
the given roll setpoint.
Part 2
The pitch signal, received by TRT, is similar to the roll signal but with higher amplitude. This signal controls
the pitch angle to maximum value of 1.4◦ . The TRT moves 3.7[m] during this pitch maneuver, before it
settles. To initialize the pitch angle, the control system gives the F3 a boost and at the same time reducing
both F1 and F2 . All three motors work to keep the TRT stable with the given signal.
Part 3
The TRT receives a signal to change the heading of the body. The TRT rotates nearly 7◦ around the Zn
axis with a small overshoot. The control system tilt all three motors to control the yaw rotation, leaving the
forces nearly unchanged.
33
4
Xn
3.5 Yn
3 Zn
2.5
position [m]
1.5
0.5
−0.5
0 5 10 15 20 25 30 35 40
time [s]
2
φ
1 θ
ψ
0
−1
angle [deg]
−2
−3
−4
−5
−6
−7
−8
0 5 10 15 20 25 30 35 40
time [s]
0.6
α1
0.4 α2
α2
0.2
angle [deg]
−0.2
−0.4
−0.6
−0.8
0 5 10 15 20 25 30 35 40
time [s]
4.81
F1
4.808 F2
Force [N]
4.806
4.804
4.802
0 5 10 15 20 25 30 35 40
time [s]
2.365
F3
2.36
Force [N]
2.355
2.35
0 5 10 15 20 25 30 35 40
time [s]
Figure 6.1: from top to the bottom: 1) Position 2) Attitude 3) Motor angle 4) Motor thrust
34
6.2 Motion by motor tilt
The TRT performs translative motion in the same manner as in section 6.1, but tilting the motors instead
of the body. The figure 6.2 shows the simulation where the additional DOF are utilized. The signal is
feedforwarded to the input setpoint SPu , to control the motor angle instead of attitude angle in SPx . The
simulation is splited into two sections, where part 1 from 5[s] to 15[s], contains motion along the Yn axis.
Part 2 is from 20[s] to 30[s] and contains motion along the Xn axis.
Part 1
The sinusoidal signal is sent to the rear servomotor, which initializes motion of the TRT. This leads to
movement of 1.2[m] in the positive Yn direction, without the need to roll first. The control system prevent
change in the attitude by compensating with both the motors and the motor angles. The two frontal motors
hold the attitude orientation nearly constant, continuously adjusting for the shifting torque, and deviating
only by 0.15◦ in yaw angle.
Part 2
The two frontal servos receives a sinusoidal signal input of the same magnitude. By tilting both motors
forward, the TRT starts moving in the positive Xn direction, covering the distance of 3[m]. As in the first
part of the simulation, the control system prevents attitude change during the movement. While performing
the tilt action, the front motors adjusts the produced thrust, maintaining the constant roll angle. The yaw
angle remains unchanged during the movement. The rear motor adjust only the thrust produced by the
motor, keeping the angle at zero degrees tilt during the forward flight.
35
3
Xn
Yn
2.5
Zn
2
position [m]
1.5
0.5
−0.5
0 5 10 15 20 25 30 35 40
time [s]
0.15
φ
θ
0.1
ψ
0.05
angle [deg]
−0.05
−0.1
−0.15
−0.2
0 5 10 15 20 25 30 35 40
time [s]
2.5
α1
2
α2
1.5 α3
1
angle [deg]
0.5
−0.5
−1
−1.5
−2
−2.5
0 5 10 15 20 25 30 35 40
time [s]
4.81
F1
F2
Force [N]
4.805
4.8
0 5 10 15 20 25 30 35 40
time [s]
2.365
F3
2.36
Force [N]
2.355
2.35
0 5 10 15 20 25 30 35 40
time [s]
Figure 6.2: from top to the bottom: 1) Position 2) Attitude 3) Motor angle 4) Motor thrust
36
6.3 Altitude controller
The altitude controller was implemented in the simulation model to test the ability of keeping the altitude
stable during motion of the TRT. The simulation is based on the motion due to motor tilt, which was
previously described in the section 6.2, with added altitude control loop. The figure 6.3 shows the positional
response of the model from the simulation. The altitude setpoint was initialized in the beginning of the
simulation, which enables the the controller to hold the TRT at the stable height of 2[m].
3
X
n
Yn
2.5
Zn
2
position [m]
1.5
0.5
−0.5
0 5 10 15 20 25 30 35 40
time [s]
37
The control system that is used on the physical model is implemented strait from the simulation model with-
out modifications or further controller parameter tuning. Compared to the simulation model, the nonlinear
function describing the dynamics of the TRT, is substituted with the real physical system. The figure 6.4
shows the overview of the control system implemented on the physical system.
Physical system
-[K₂,K₁]
The program implemented on the flight controller consists of the same principle blocks as the simulation
model. The input is based on the initial vector u0 and the pilot commands, which provokes the movement of
the TRT. The response of the system, caused by the input, is measured and deviation from attitude setpoint
value is calculated. The deviation, also called the error signal, is multiplied with the constant gain producing
the controller correction signal. This signal the added to the system input at the next time step and will
result in smaller deviation from the attitude setpoint.
Two separate tests were conducted to verify the stability and response of the TRT to pilot inputs. To
minimize disturbance to the system caused by wind and propeller reflected turbulence, both tests were done
in an indoor environment at the altitude of approximately 1 meter above the ground. Due to the wired
logging of data, the testing area was limited, requiring the pilot to navigate to a predefined position before
performing the test maneuver. Each test is divided into two parts, where the first part consists of the pilot
controlling the TRT to hold a predefined position and the second part consists of applying the large input in
periodical manner. The collected data from the tests compares the pilot input to the response of the TRT,
measured by internal IMU.
38
The first test is presented in the figure 6.5, describing the roll response. The first 4 seconds in the figure 6.5
shows position holding of the TRT, where after the 4th second the pilot initialized positive and negative roll
input.
20
IMU signal
Reference
15
10
5
Angle [deg]
−5
−10
−15
−20
0 2 4 6 8 10 12
Time [s]
The second test is presented in the figure 6.6, describing the pitch response. The first 6 seconds corresponds
to holding the predefined position, where after the 6th second, pilot initialized the positive and negative
pitch input.
15
IMU signal
Reference
10
5
Angle [deg]
−5
−10
0 5 10 15
Time [s]
By reviewing figure 6.5 and 6.6, it is possible to see that the TRT has a good and stable behavior in the air.
As all flying object without positional feedback it experience drifting, which has to be corrected for by the
pilot. Tests shows that in an indoor environment, drift in the longitudinal direction is greater than in the
transversal direction. Tracking of the reference signal by the TRT is quite good considering the magnitude
of the reference signal. The general shape of the reference signal is reproduced good, but some phase delay
is visible. The control system was tuned to follow the sinusoidal signal of amplitude 0.1 and period of 4
seconds, but it is obvious that in real life TRT have to be able to follow signals with much greater gradient.
To achieve a better performance of the system, the control system parameters should be revised.
39
Chapter 7
Conclusion
A dynamic model of the tilt rotor tricopter has been derived using the Newton-Euler approach. The TRT
consisted of several reference frames, which needed different rotation matrixes to convert the forces to the
main body. The dynamic model was verified using a SimulationX model. A complete 3D CAD model has
been used to get geometrical and inertial data to the simulations. The simulations has been conducted in
Matlab Simulink, where a 3D model was implemented to visualize the behavior of the simulation model.
A state-space representation of the dynamic equations has been presented. This has been linearized around
hovering position to design a control system. The control system that has been developed is based on the
linear quadratic regulator. An integral action has been implemented due to nullspace problems and steady
state error.
By conducting the motor tests, the relationship between the thrust and rpm/PPM signals were recorded.
This relationship was recreated by a third order polynomial equation, which has shown to be an accurate
estimation. The motors and propellers generated enough thrust to hold the TRT in the air and be able to
maneuver around.
To verify that the control system works and keeps the TRT stable, it has been implemented on a real
model. Note that the parameters used on the real model are implemented straight from the simulation
without changes. This shows that by thoroughly identifying the dynamic of the model, one can achieve a
valid controller for a highly nonlinear cupeled system. Longitudinal and transverse translation has not been
implemented on the real model but has been successfully tested in the simulations.
In the current configuration the TRT is a pilot operated UAV. The control system keeps the TRT stable but
it needs a pilot to send attitude commands using a 2.4GHz RC controller. There is a GPS module available
for the selected flight controller, which can allow for outdoor waypoint guidance.
The low cost flight controller Multiwii Mega has proven itself as a descent controller for this project, though
it has some computational limitations. By keeping the online code short and effective, 300Hz of operating
frequency was accomplished.
40
It is worth mentioning that the entire cost of the equipment used on the TRT included shipping and taxes,
has a total of 3500NOK. This proves that further research in the field of multicopter and their control sys-
tems, are no longer only for the heavily founded research departments.
The TRT has conducted several free flight test verifying that the control system designed during this thesis
is functional and is able to handle a highly nonlinear coupled system as the TRT is. As a result of the
successful flights, it can be concluded that the simplifications regarding the dynamic model does not affect
the stability noticeable under the given conditions. As the prestudy discovered no identical platforms to the
TRT, we are proud to present a working new segment to the diversity that is the multicopter platform.
41
Bibliography
[3] Thomas Bräunl. Embedded Robotics. Mobile Robot Design and Applications with Embedded Systems.
Springer, 2006.
[4] Zoran Gajic. Linear dynamic systems and signals. Prentice Hall, 2003.
[5] Finn Haugen. Dynamiske System, model, analyse og simulering. Tapir akademiske forlag, 2007.
[9] Israel Aerospace Industries. Panther, Fixed wing VTOL UAS. Israel Aerospace Industries, 2012.
[10] Parviz E. Nikravesh. Computer-aided Analysis of Mechanical Systems. Prentic-Hall Inc., 1988.
[11] Gareth D. Padfield. Helicopter Flight Dynamics. The Theory and application of Flying Qualities and
Simulation Modelling. Wiley, 2008.
[12] Sigurd Skogestad and Ian Postlethwaite. Multivariable Feedback Control. JOHN WILEY & SONS, 2005.
[13] Kjell Eivind Skjønhaug Øyvind Magnussen. Modeling, Design and Experimental Study for a Quadcopter
System Construction. PhD thesis, University of Agder, 2011.
42
List of Figures
6.1 from top to the bottom: 1) Position 2) Attitude 3) Motor angle 4) Motor thrust . . . . . . . 34
6.2 from top to the bottom: 1) Position 2) Attitude 3) Motor angle 4) Motor thrust . . . . . . . 36
6.3 The altitude controller simulation results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.4 Implementation of control loop on the physical system . . . . . . . . . . . . . . . . . . . . . . 38
6.5 Free flight roll response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.6 Free flight pitch response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
43
List of Tables
44
Appendix A
Linearization
Linearized physical model of TRT in state-space structure will result in A,B and C matrices, where elements
of those matrices are given by ai,j , bi,j , ci,j correspondingly.
0 a1,2 a1,3 a1,4 a1,5 0 0 0 0 0 0 0
0 0 a2,3 a2,4 a2,5 0
0
0 0 0 0 0
0 a3,2 a3,3 a3,4 a3,5 a3,6 0 0 0 0 0 0
A= B =
0 0 0 0 a4,5 a4,6
b4,1
b4,2 b4,3 b4,4 b4,5 b4,6
0 0 0 a5,4 0 a5,6
b
5,1 b5,2 b5,3 b5,4 b5,5 b5,6
0 0 0 a6,4 a6,5 0 b6,1 b6,2 b6,3 b6,4 b6,5 b6,6
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
C=
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
The nonzero elements in matrices A and B are calculated below. The C matrix is an identity matrix due to
direct readout from sensors.
45
∂ φ̇
a1,1 = =0
∂φ
∂ φ̇
a1,2 = = (sin(θ) ∗ (p ∗ (2 ∗ sin(ψ/2)2 − 1) + q ∗ sin(ψ)))/(sin(θ)2 − 1)
∂θ
∂ φ̇
a1,3 = = −(q ∗ cos(ψ) + p ∗ sin(ψ))/cos(θ)
∂ψ
∂ φ̇
a1,4 = = cos(ψ)/cos(θ)
∂p
∂ φ̇
a1,5 = = −sin(ψ)/cos(θ)
∂q
∂ φ̇
a1,6 = =0
∂r
∂ θ̇ ∂ ψ̇
a2,1 = =0 a3,1 = =0
∂φ ∂φ
∂ θ̇ ∂ ψ̇
a2,2 = =0 a3,2 = = −(p ∗ cos(ψ) − q ∗ sin(ψ))/cos(θ)2
∂θ ∂θ
∂ θ̇ ∂ ψ̇
a2,3 = = p ∗ cos(ψ) − q ∗ sin(ψ) a3,3 = = (sin(θ) ∗ (q ∗ cos(ψ) + p ∗ sin(ψ)))/cos(θ)
∂ψ ∂ψ
∂ θ̇ ∂ ψ̇
a2,4 = = sin(ψ) a3,4 = = −cos(ψ) ∗ tan(θ)
∂p ∂p
∂ θ̇ ∂ ψ̇
a2,5 = = cos(ψ) a3,5 = = sin(ψ) ∗ tan(θ)
∂q ∂q
∂ θ̇ ∂ ψ̇
a2,6 = =0 a3,6 = =1
∂r ∂r
∂ ṗ ∂ q̇ ∂ ṙ
a4,1 = =0 a5,1 = =0 a6,1 = =0
∂φ ∂φ ∂φ
∂ ṗ ∂ q̇ ∂ ṙ
a4,2 = =0 a5,2 = =0 a6,2 = =0
∂θ ∂θ ∂θ
∂ ṗ ∂ q̇ ∂ ṙ
a4,3 = =0 a5,3 = =0 a6,3 = =0
∂ψ ∂ψ ∂ψ
∂ ṗ ∂ q̇ ∂ ṙ
a4,4 = =0 a5,4 = = (r ∗ (Jxx − Jzz ))/Jyy a6,4 = = −(q ∗ (Jxx − Jyy ))/Jzz
∂p ∂p ∂p
∂ ṗ ∂ q̇ ∂ ṙ
a4,5 = = −(r ∗ (Jyy − Jzz ))/Jxx a5,5 = =0 a6,5 = = −(p ∗ (Jxx − Jyy ))/Jzz
∂q ∂q ∂q
∂ ṗ ∂ q̇ ∂ ṙ
a4,6 = = −(q ∗ (Jyy − Jzz ))/Jxx a5,6 = = (p ∗ (Jxx − Jzz ))/Jyy a6,6 = =0
∂r ∂r ∂r
46
∂ ṗ
b4,1 = = (L1y ∗ cos(α1 ) + Kt ∗ sin(α1 ))/Jxx
∂F1
∂ ṗ
b4,2 = = (L2y ∗ cos(α2 ) − Kt ∗ sin(α2 ))/Jxx
∂F2
∂ ṗ
b4,3 = = (L3y ∗ cos(α3 ) + L3z ∗ sin(α3 ))/Jxx
∂F3
∂ ṗ
b4,4 = = (F1 ∗ (Kt ∗ cos(α1 ) − L1y ∗ sin(α1 )))/Jxx
∂α1
∂ ṗ
b4,5 = = −(F2 ∗ (Kt ∗ cos(α2 ) + L2y ∗ sin(α2 )))/Jxx
∂α2
∂ ṗ
b4,6 = = (F3 ∗ (L3z ∗ cos(α3 ) − L3y ∗ sin(α3 )))/Jxx
∂α3
∂ q̇
b5,1 = = −(L1x ∗ cos(α1 ) − L1z ∗ sin(α1 ))/Jyy
∂F1
∂ q̇
b5,2 = = −(L2x ∗ cos(α2 ) − L2z ∗ sin(α2 ))/Jyy
∂F2
∂ q̇
b5,3 = = −(L3x ∗ cos(α3 ) + Kt ∗ sin(α3 ))/Jyy
∂F3
∂ q̇
b5,4 = = (F1 ∗ (L1z ∗ cos(α1 ) + L1x ∗ sin(α1 )))/Jyy
∂α1
∂ q̇
b5,5 = = (F2 ∗ (L2z ∗ cos(α2 ) + L2x ∗ sin(α2 )))/Jyy
∂α2
∂ q̇
b5,6 = = −(F3 ∗ (Kt ∗ cos(α3 ) − L3x ∗ sin(α3 )))/Jyy
∂α3
∂ ṙ
b6,1 = = (Kt ∗ cos(α1 ) − L1y ∗ sin(α1 ))/Jzz
∂F1
∂ ṙ
b6,2 = = −(Kt ∗ cos(α2 ) + L2y ∗ sin(α2 ))/Jzz
∂F2
∂ ṙ
b6,3 = = (Kt ∗ cos(α3 ) − L3x ∗ sin(α3 ))/Jzz
∂F3
∂ ṙ
b6,4 = = −(F1 ∗ (L1y ∗ cos(α1 ) + Kt ∗ sin(α1 )))/Jzz
∂α1
∂ ṙ
b6,5 = = −(F2 ∗ (L2y ∗ cos(α2 ) − Kt ∗ sin(α2 )))/Jzz
∂α2
∂ ṙ
b6,6 = = −(F3 ∗ (L3x ∗ cos(α3 ) + Kt ∗ sin(α3 )))/Jzz
∂α3
47
Appendix B
Numeric values for A,B and C matrices, linearized around the following state variable vector x0 = [0, 0, 0, 0, 0, 0]T
and estimated input vector u0 = [4.8050, 4.8063, 2.3530, −0.0056, 0.0056, 0]T .
0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 0 0
A= B =
0 0 0 0 0 0 −10.9787 10.9758 0 0.9155 −1.5067 −0.5313
0 0 0 0 0 0 −3.2695 −3.2719 13.3600 −1.1229 −0.9472 −0.5656
0 0 0 0 0 0 0.0944 −0.1552 0.1248 26.1234 −26.1238 16.3206
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
C=
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
48
Appendix C
The main loop used on the TRT is presented below, containing the implemented control system.
#include "param.h"
#include "uart.h"
#include "twi.h"
#include "MPU6050.h"
#include "Timer.h"
#include "MotorPWM.h"
#include "MS5611.h"
#include "Receiver.h"
#include "AngleCalc.h"
#include <stdio.h>
#include <avr/interrupt.h>
char i ;
char ∗Ptr;
char temp;
char TempBuffer[40];
double k1[] = {−22.3474, −7.3037, 0.4259, −7.9113, −2.6128, 0.1605, −1.3110, −0.4381, 0.0284};
double k2[] = { 22.3450, −7.3162, −0.5557, 7.9106, −2.6175, −0.2067, 1.3109, −0.4390, −0.0361};
double k3[] = { −0.0068, 29.8593, 0.2662, −0.0027, 10.6822, 0.0947, −0.0005, 1.7913, 0.0158};
double k4[] = { 0.1692, −0.3162, 7.2294, 0.0573, −0.1132, 2.5835, 0.0090, −0.0190, 0.4327};
double k5[] = { −0.3195, −0.2621, −7.2279, −0.1105, −0.0936, −2.5829, −0.0178, −0.0157, −0.4326};
double k6[] = { −0.1750, −0.1595, 4.5193, −0.0636, −0.0571, 1.6151, −0.0109, −0.0096, 0.2705};
double p[] = {39.3005, −603.7002, 4758.5445, 34.4823};
double M1, M2, M3 , a1, a2, a3;
double Er_int_roll;
double Er_int_pitch;
double Er_int_yaw;
double Er_roll;
double Er_pitch;
double Er_yaw;
double Er_p;
double Er_q;
double Er_r;
int Tempdd;
#define DebugHz 50
int Debug;
int blink ;
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
MAIN
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
int main(void)
{
// Initialize
I2C_PULLUPS_ENABLE;
//SpektrumBinding();
//DDRK = 0xFF;
ALARMPIN_PINMODE
STABLEPIN_PINMODE;
IMU.Gyro_OffsetX = 0;
IMU.Gyro_OffsetY = 0;
IMU.Gyro_OffsetZ = 0;
Rx.QuatAccGain = 0.005;
Rx._GyroCalibrateSamples = 100;
Rx._LoopTime = 156;
// Transmitter settings
Rx._RecRollGain = 0.3;
Rx._RecPitchGain = 0.3;
Rx._RecYawGain = 0.5;
Rx._RecThrustGain = 1.2;
MotorPWM_Init();
Servo1_pwm = 0;
Servo2_pwm = 0;
Servo3_pwm = 0;
Servo_Update();
ESC_Calibration();
49
twiInit (10) ; _delay_ms(10);
IMU_init(); _delay_ms(100);
Baro_init(); _delay_ms(10);
Timer_Init(TimerTop, TimerPreScale);
uart_init(UART_BAUD_SELECT_DOUBLE_SPEED(UART_BAUD_RATE,F_CPU));
uart1_init(UART_BAUD_SELECT_DOUBLE_SPEED(UART_BAUD_RATE,F_CPU));
_delay_ms(5);
Reciver_Init(1,0);
// Error signal initialization −−−−−−−−−−−−−−−−−−−−−−−−−−−
IMU_Get();
QuatCalc();
Quat2Euler();
Er_int_roll=Euler.roll;
Er_int_pitch=Euler.pitch;
Er_int_yaw=0;
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
TCNT0 = 0;
while(1){
// Read Sensors
IMU_Get(); // Get IMU Data
// Attitude
QuatCalc();
Quat2Euler();
// State error collect −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Er_int_roll=Er_int_roll+Euler.roll∗(1/LoopFreq);
Er_int_pitch=Er_int_pitch+Euler.pitch∗(1/LoopFreq);
//Er_int_yaw=Er_int_yaw+Er_yaw∗(1/LoopFreq); //zeroed signal
Er_roll=Euler.roll−Ctrl.Roll;
Er_pitch=Euler.pitch−Ctrl.Pitch;
Er_yaw=Er_yaw + IMU.d_GyroZ∗(1/LoopFreq);
Er_p=IMU.d_GyroX;
Er_q=IMU.d_GyroY;
Er_r=IMU.d_GyroZ−Ctrl.Yaw;
// Control system−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
M1= 4.8056 − (Er_int_roll∗k1[0]+Er_int_pitch∗k1[1]+Er_int_yaw∗k1[2]+Er_roll∗k1[3]+Er_pitch∗k1[4]
+Er_yaw∗k1[5]+Er_p∗k1[6]+Er_q∗k1[7]+Er_r∗k1[8]);
M2= 4.8056 − (Er_int_roll∗k2[0]+Er_int_pitch∗k2[1]+Er_int_yaw∗k2[2]+Er_roll∗k2[3]+Er_pitch∗k2[4]
+Er_yaw∗k2[5]+Er_p∗k2[6]+Er_q∗k2[7]+Er_r∗k2[8]);
M3= 3.3000 − (Er_int_roll∗k3[0]+Er_int_pitch∗k3[1]+Er_int_yaw∗k3[2]+Er_roll∗k3[3]+Er_pitch∗k3[4]
+Er_yaw∗k3[5]+Er_p∗k3[6]+Er_q∗k3[7]+Er_r∗k3[8]);
a1= −0.0056 − (Er_int_roll∗k4[0]+Er_int_pitch∗k4[1]+Er_int_yaw∗k4[2]+Er_roll∗k4[3]+Er_pitch∗k4[4]
+Er_yaw∗k4[5]+Er_p∗k4[6]+Er_q∗k4[7]+Er_r∗k4[8]);
a2= 0.0056 − (Er_int_roll∗k5[0]+Er_int_pitch∗k5[1]+Er_int_yaw∗k5[2]+Er_roll∗k5[3]+Er_pitch∗k5[4]
+Er_yaw∗k5[5]+Er_p∗k5[6]+Er_q∗k5[7]+Er_r∗k5[8]);
a3= 0 − (Er_int_roll∗k6[0]+Er_int_pitch∗k6[1]+Er_int_yaw∗k6[2]+Er_roll∗k6[3]+Er_pitch∗k6[4]
+Er_yaw∗k6[5]+Er_p∗k6[6]+Er_q∗k6[7]+Er_r∗k6[8]);
50
Appendix D
Part list
All the parts except the controller have been bought at http://www.Hobbyking.com, where the flight con-
troller has been bought at http://www.diymulticopter.com/
51
Appendix E
52
53
54
55
56