You are on page 1of 181

Thorhallur T omas Buchholz

Dagur Gretarsson
Construction of a Four Rotor
Helicopter Control System
Masters Thesis, February 2009
Thorhallur T omas Buchholz
Dagur Gretarsson
Construction of a Four Rotor
Helicopter Control System
Masters Thesis, February 2009
Construction of a Four Rotor Helicopter Control System,
This report was prepared by
Th orhallur T omas Buchholz
Dagur Gretarsson
Supervisors
Elbert Hendricks
Release date: Date published
Category: 1 (public)
Edition: First
Comments: This report is part of the requirements to achieve the Master of
Science in Engineering (M.Sc.Eng.) at the Technical University
of Denmark. This report represents 30 ECTS points.
Rights: c Dagur Gretarsson and Th orhallur T omas Buchholz, 2009
Department of Electrical Engineering
Automation (AU)
Technical University of Denmark
Elektrovej building 326
DK-2800 Kgs. Lyngby
Denmark
www.elektro.dtu.dk/forskning/au
Tel: (+45) 45 25 35 50
Fax: (+45) 45 88 12 95
E-mail: bkp@oersted.dtu.dk
Construction of a Four Rotor
Helicopter Control System
Thorhallur T omas Buchholz
Dagur Gretarsson
Masters Thesis, February 2009
Abstract
This report presents the construction of a four rotor helicopter control sys-
tem.
A nonlinear dynamic model of a custom built four rotor helicopter is pre-
sented. This model is linearized in order to serve as basis for the design of
a LQ regulator. The LQ regulator is realized using a microprocessor based
ight controller mounted on the custom built four rotor helicopter. The
ight controller runs a ight routine designed to work as a stability aug-
mented control system for a pilot.
Flight tests suggest that the stabilizing LQ regulator works properly. The
nonlinear model has also been partly validated, but further improvements
of the code for the ight controller are needed in order to conrm this in
detail.
Dansk Resume
Denne rapport prsenterer konstruktion af et re rotor helikopter kontrol
system.
En uliner dynamisk model, af en specialfremstillet re rotor helikopter,
bliver prsenteret. Denne model bliver lineariseret for at danne grundlag
for designet af en LQ regulator. LQ regulatoren bliver realiseret ved brug
af et mikrokontroller baseret y styresystem monteret pa den specialfrem-
stillede re rotor helikopter. Fly styresystemet eksikverer en y rutine som
er designet til at virke som stabilitets supplerende reguleringssystem for en
pilot.
Fly tests tyder pa at den stabiliserende LQ regulator virker rigtigt. Den
ulinere model er ogsa delvis blevet valideret, men yderligere forbedringer
pa y kontrollerens kode er ndvendige for at konstatere dette.
Acknowledgments
We wish rst and foremost to thank our supervisor Elbert Hendricks for his
patience, guidance and support. We also like to think Bertil Morelli for his
help with the construction of the helicopter and those who supported us in
various ways during the project. We nally wish to thank Free2move for
their generous contribution in form of the Bluetooth module.
Contents
Nomenclature xi
1 Introduction 1
2 Four rotor principles 5
2.1 Single rotor helicopter . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Four rotor helicopter . . . . . . . . . . . . . . . . . . . . . . . 8
3 Four rotor helicopter platform 11
4 Four rotor dynamics 15
4.1 Attitude representation . . . . . . . . . . . . . . . . . . . . . 16
4.2 Nonlinear equations of motion . . . . . . . . . . . . . . . . . . 17
4.2.1 Forces acting on the helicopter . . . . . . . . . . . . . 20
4.2.2 Torques acting on the helicopter . . . . . . . . . . . . 22
4.3 Simulink models . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3.1 Model in reference frame . . . . . . . . . . . . . . . . 25
4.3.2 Model in body frame . . . . . . . . . . . . . . . . . . . 25
4.4 Linearized models . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4.1 Linearized model in reference frame . . . . . . . . . . 27
4.4.2 Linearized model in body frame . . . . . . . . . . . . . 29
4.5 Open loop simulations of model in body frame . . . . . . . . 30
4.6 Motor model . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5 Controller design 35
5.1 Linear Quadratic Regulator . . . . . . . . . . . . . . . . . . . 35
5.2 Designing a continuous LQR for attitude and position stabi-
lization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3 Designing a reduced continuous LQR for attitude stabilization 45
5.4 Discrete Linear Quadratic Regulator . . . . . . . . . . . . . . 48
5.5 Designing a discrete LQR . . . . . . . . . . . . . . . . . . . . 48
6 Hardware 53
6.1 The ight controller . . . . . . . . . . . . . . . . . . . . . . . 53
6.2 The microprocessor . . . . . . . . . . . . . . . . . . . . . . . . 54
6.3 Blutooth module . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.4 Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.5 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.6 Print Circuit Board . . . . . . . . . . . . . . . . . . . . . . . 60
6.7 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7 Software structure 63
7.1 Code ow diagrams . . . . . . . . . . . . . . . . . . . . . . . . 63
7.2 Code performance . . . . . . . . . . . . . . . . . . . . . . . . 70
8 Flight test and model validation 73
9 Conclusion 81
9.1 Conclusion on the helicopter construction . . . . . . . . . . . 81
9.2 Conclusion on the controller design and simulations . . . . . . 82
9.3 Conclusion on the validation of the nonlinear dynamic model 83
References 84
Appendix 88
A Rotating frame of reference 89
B Equations of angular motion 93
B.1 Torque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
B.2 Inertia tensor . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
C Euler angle rotation 99
D Thrust and H-force 101
D.1 Rotor thrust . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
D.2 H-force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
E The inertia of the helicopter 103
F Rotor inertia 107
G Helicopter frame construction 111
G.1 Frame materials . . . . . . . . . . . . . . . . . . . . . . . . . . 111
G.2 Frame design . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
G.2.1 Frame arms . . . . . . . . . . . . . . . . . . . . . . . . 113
G.2.2 Center cross . . . . . . . . . . . . . . . . . . . . . . . . 116
G.2.3 Center plates . . . . . . . . . . . . . . . . . . . . . . . 117
G.2.4 Rotor mountings . . . . . . . . . . . . . . . . . . . . . 118
G.2.5 Frame extra supports . . . . . . . . . . . . . . . . . . 118
G.3 Landing frame . . . . . . . . . . . . . . . . . . . . . . . . . . 119
G.4 The helicopter frame . . . . . . . . . . . . . . . . . . . . . . . 119
G.5 Frame drag . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
H The single chip yaw rate gyro ADXRS150 121
I Rotor measurements 127
x
I.1 Measurement setup . . . . . . . . . . . . . . . . . . . . . . . . 127
I.2 Applied rotor blades . . . . . . . . . . . . . . . . . . . . . . . 130
I.2.1 Duty cycle and angular velocity . . . . . . . . . . . . . 130
I.2.2 Angular velocity and thrust . . . . . . . . . . . . . . . 130
I.2.3 Angular velocity and torque . . . . . . . . . . . . . . . 132
I.3 Other rotor blades . . . . . . . . . . . . . . . . . . . . . . . . 133
I.3.1 Duty cycle versus angular velocity . . . . . . . . . . . 133
I.3.2 Angular velocity and thrust . . . . . . . . . . . . . . . 133
I.4 Figure of merit . . . . . . . . . . . . . . . . . . . . . . . . . . 134
J Momentum theory 137
K Level shifter simulation 145
L Schematics and PCB layouts 147
M Functions used in control loop 153
Nomenclature
x State derivatives vector 12x1, page 25

a
Torque acceleration, page 24 Nm

f
Torque ight, page 23 Nm

g
Rotors gyro torque, page 23 Nm

r
Torque rotor, page 23 Nm

x
Torque about the x-a xis, page 23 Nm

x
Torque about the x-axis, page 22 Nm

y
Torque about the y-axis, page 22 Nm
Torque in body frame = [
x
,
y
,
z
]

, page 18 Nm
Euler angular velocity in body frame = [p, q, r]

, page 18
rad
s
a

Acceleration in body frame a

= [ u, v, w]

, page 18
m
s
2
A

Attitude matrix, page 17


F
d
Drag force, page 21 N
F
g
Gravitation force, page 17 N
F
H
H-force, page 21 N
F
r
Total rotor thrust, page 20 N
F Force in body frame F = [F
x
, F
y
, F
z
]

, page 18 N
I

Inertia tensor, page 19 kgm


2
xii
L
0
Angular momentum in body frame L
0
= [L, M, N]

, page 18
kgm
2
s
T
1
, T
2
, T
3
, T
4
Thrust of the rotors, page 22 N
T Thrust vector, page 20 N
u Input vector 4x1, page 25 dutycycle
v Velocity in body frame v = [u, v, w]

, page 18
m
s
x State vector 12x1, page 25
y Output vector 6x1, page 25
Rotor angular velocity, page 23
rad
s
Air density, page 21
kg
m
3
A
f
Frontal area of the helicopter body, page 21 m
2
C
f
Drag coecient, page 21
Ns
2
kg
I
a
Armature current, page 31 A
I
r
Rotor moment of inertia, page 23 kgm
2
I
xx
Inertia about the bodys x-axis, page 19 kgm
2
I
yy
Inertia about the bodys y-axis, page 19 kgm
2
I
zz
Inertia about the bodys z-axis, page 19 kgm
2
J
m
Motor moment of inertia, page 31 kgm
2
K
e
Back emf constant, page 31
V s
rad
K
t
Motor moment constant, page 31
Nm
A
L
a
Armature windings inductance, page 31 H
m Mass, page 18 kg
M
b
Motor external load, page 31 Nm
M
f
Motor friction, page 31 Nm
M
p
Overshoot, page 41 %
M
u
Motor torque, page 31 Nm
R
a
Armature windings impedance, page 31
t
r
Rise time, page 41 s
xiii
t
s
Settling time, page 41 s
V
a
Armature voltage, page 31 V
V
e
Back emf voltage, page 31 V
xiv
Chapter 1
Introduction
With the rapid development in microprocessor and sensor technology in the
resent years, the interest for small four rotor helicopters has increased. Four
rotor helicopters have moved on from being an unattainable idea to become
popular research objects within the realms of control theory, autonomous
robot theory, electronics and mechanics.
The particular interest of the research community in four rotor helicopters
as Unmanned Aerial Vehicles (UAV), can be explained by their advantages
over other equivalent vertical take of an landing UAVs, such as single rotor
helicopters. In its simplicity, the four rotor helicopter does not need any
complex mechanical controls of its rotors for vehicle control. Instead it uses
rotor blades with xed pitch and changes the angular velocity with the same
results.
Its advantages become even more clear when it is used for indoor ight.
As it uses four rotors to produce thrust, each rotor can be kept smaller in
diameter relative to a single rotor helicopter, producing the same thrust.
The moment of each rotor is subsequently much smaller and they are there-
fore less harmful should they accidentally bumps into any objects.
This groups particular interest lies in the four rotor helicopter as a con-
trol object. As such, it is a marginally stable multiple input multiple output
(MIMO) system that has small time constants as a result of its small size.
It is therefore considered to be a challenging project to design a controller
that is able to stabilize the attitude of the helicopter while it is being own
2 Introduction
by a pilot.
Many of the technical problems that limited earlier ight experiments with
four rotor helicopters are still valid in the present. In this report, this group
will assess some of these problems and will seek to solve them in an accept-
able manor. These are the following.
The helicopter frame should be as sti and strong as possible.
The helicopters weight should be as low as possible for a prolonged
ight time.
The group has to understand and explain the basic aerodynamics that
are needed to make a stabilizing control system for the helicopter.
The group has to provide stability and proper control to the helicopter
for an easy pilot augmented hover and forward ight.
To solve these problems, the group will design and custom build a four rotor
helicopter. This includes choosing suitable materials that will keep the he-
licopter as strong and sti as possible while being light weight at the same
time. Control electronics, rotors and batteries will also be chosen bearing
the weight in mind.
A linearized model of the helicopter will be made to serve as the basis for a
linear controller design.
The stability control will be done with an on-board microprocessor running
a Linear Quadratic Regulator (LQR) as a attitude stabilizing augmentation
for a pilot controlled ight. The pilot will control the movements and posi-
tion of the helicopter with a remote control.
A data link will be implemented on the helicopter in order to be able at-
tain real time ight data for possible monitoring of the ight and analytical
purposes.
Prior work on the subject
Many research groups are working on four rotor helicopters as Unmanned
Aerial Vehicle (UAV) testbeds for stabilizing control algorithms and sensing.
Numerous UAVs have seen success using Linearized Quad Regulator (LQR)
derived from linearized dynamic models for attitude control.
3
The Stanford Testbed of Autonomous Rotorcraft for Multi-Agent Control
(STARMAC) is an ongoing project that acts as a testbed for UAVs. LQR
controllers have been used successfully in providing attitude stabilization in
that project. During their work on this project, Homann et al. (19) re-
alized that by stiening the helicopter frame greatly improved the attitude
measurements of the inertial measuring unit (IMU). The frame was stiened
by cross braces between the motors.
Nice (29) constructed a Autonomous Flying Vehicle (AFV). This four ro-
tor helicopter project was based on a custom made airframe with brushless
motors, for improved rotor eciency, controlled by custom made electronics
to improve resolution. The attitude stabilization was done with a on-board
LQR controller based on a linearized model of the helicopter. A very stable
hover ight was achieved with the aid of a human pilot correcting gyroscopic
drift.
Bertelsen et al. (4) constructed in the work on their masters thesis, a atti-
tude stabilizing LQR on the bases of a proposed linearized model of a four
rotor helicopter. This controller was realized using a the frame including
rotors from a commercially available four rotor helicopter, the Draganyer
(11), and a xPC real time kernel to running the controller derived from
Matlab/Simulink. The measurements of angular velocity were provided by
three gyroscopes measuring Eulers angular velocities. The validation of the
model was made by comparing ight data with simulation data.
4 Introduction
Chapter 2
Four rotor principles
The principle of using four rotors to lift a helicopter from the ground is the
topic of this chapter. In order to emphasize the simplicity of the four rotor
concept and to familiarize the reader with helicopter principles in general,
an introduction to a conventional single rotor helicopter will be presented
rst.
2.1 Single rotor helicopter
All the lifting thrust of the single rotor helicopter is produced by the main
rotor, see gure 2.1. When the main rotor is rotating it has to overcome
the air resistance (drag) of the rotor blades. The torque that is applied to
the rotor shaft in order to overcome the drag is directly transmitted to the
helicopter body to which the rotor is attached.
It is customary to treat the rotor as if it had an innite number of blades
which form a disc. This imaginary rotor disk, lies in the plane of the blades
with the radius equal to the length of the blades. The thrust that the rotor
produces is always perpendicular to the rotor disc plane. When the heli-
copter is in axial ight, that is ying up, down or hovering, the lift of the
rotor is symmetrical around the rotors axis.
One of the characteristic features of the single rotor helicopter is the tail
rotor. The tail rotors thrust generates a torque which cancels out the
torque deriving from the main rotor as result of the blade drag. The pi-
6 Four rotor principles
lot also exploits the tail rotor to turn the helicopter body around the rotor
axis. This is done by changing the angular velocity of the tail rotor, and
thereby its thrust. The tail rotor reacts immediately in a predened way to
the pilots controls so that the pilot does not have to think about it when he
is maneuvering the helicopter.
Figure 2.1: Single rotor helicopter. The tail rotor is used to produce anti-torque
to cancel out the torque generated by the main rotor when it is over-
coming the rotor blade drag.(25, p. 57). The gure also shows the
basic rotational movements of the helicopter, roll, pitch and yaw.
Besides producing the lifting thrust, the main rotor is also the primary source
of propulsion and control (25, p. 171). In forward ight, the main rotor disk
is eectively tilted so that the otherwise vertical thrust in axial ight is now
tilted as well, see gure 2.2. The thrust in the gure is represented by two
force components, the lifting force and the propulsion force. To maintain
altitude, the lifting force has to overcome the gravity force. The thrust must
therefore be increased when going from axial ight into forward ight in or-
der to maintain the same altitude.
Tilting the rotor disk in the direction of choice is done by adjusting the
rotor blades. A rotor blade is generally attached to its hub by the means of
hinges located at the root of the blade, see gure 2.3. The hinges allow the
2.1 Single rotor helicopter 7
Figure 2.2: The two force components of the thrust when the rotor disk is tilted.
rotor blade to ap with respect to its hub plane (25, p. 172). Flapping is
the rotational motion of the blade about its apping axis as shown in gure
2.3. The possibility of pitching the rotor blades is also incorporated into
the blade design. Pitching is the rotation of the blade about its longitudinal
axis. Pitching the rotor blades collectively, that is all with the same angle,
while maintaining constant rotor angular velocity changes the lift of the ro-
tor. Changing the pitch of the rotor blades independently while they are
rotating is called cyclic pitch. Cyclic pitch, which changes the distribution
of forces over the rotor disk, is the key feature in tilting the rotor disk eec-
tively in order to move the helicopter in axial ight.
Figure 2.3: Schematics of a rotor blade showing the basic movements of the rotor
blade, apping and pitch.
The mechanical complexity of controlling the blade movements mentioned
above causes stress on the rotor construction. This demands frequent main-
tenance and component replacement in order to avoid rotor failure. It also
8 Four rotor principles
adds weight to the helicopter.
2.2 Four rotor helicopter
The four rotor helicopter concept is not new. In the year 1907 the rst
reported successful helicopter ights with a helicopter, said to have lifted a
man from the ground, were done by Paul Cornu of France (25, p. 11). The
same year Breguet brothers made a quadrotor helicopter called Gyroplane
No. 1. This four rotor helicopter is said to have briey lifted a man from the
ground into free ight. Leishman (25, p. 12) speculates that this ight was
even closer to being a real ight than that of Paul Cornu. The four rotor
concept does not seem to have been a success though, probably because it is
beyond the skills of even a trained pilot to y the helicopter by controlling
the four rotors simultaneously.
The four rotor helicopter is built as a square where rotors are mounted
on each corner, see gure 2.4. All the rotors are xed in the helicopters
xy plane see gure 2.4. Each rotor has thrust that is perpendicular to the
rotor disk plane. As all the rotors are xed in the helicopters x y plane,
the total lifting thrust is perpendicular to the helicopters x y plane at all
times.
Rotors on the opposite side of the square center rotate in the same direction.
These are considered to be a pair. In gure 2.4 the two pairs are R
1
and
R
2
, R
3
and R
4
. The two pairs of rotors spin in opposite directions. Ideally
the torque that each rotor causes on the body is cancelled out since one pair
rotates in the opposite direction of the other. The function of the tail rotor
on a conventional helicopter is therefore redundant in the four rotor con-
cept. This, in fact, holds for all helicopters that incorporate rotors spinning
in opposite directions, for example in the familiar Boeing CH-47 Chinook.
Figure 2.4 illustrates how the transition from axial ight into horizontal
ight is invoked. Starting with a hover state of the helicopter, the attitude
is changed by increasing the relative angular velocity of some of the rotors
and simultaneously decreasing the relative angular velocity of the others, see
gure 2.4 (a) and (b). As this is done the total thrust vector angle is shifted
from vertical of the body frame in the direction of the two faster spinning
rotors. This will tilt the helicopter and thus have the same eect as shown in
gure 2.2 for the total thrust, that is it will thereby be composed of lift force
and propulsion force as discussed for the single rotor helicopter. The total
thrust has to be adjusted concurrently in order to maintain the helicopter
altitude.
2.2 Four rotor helicopter 9
Figure 2.4: Four rotor helicopter seen from above. The blue arrows indicate the
direction and the angular velocity of the rotors, as does the grey color.
The red arrows show the helicopters motion change in the x-y plane
in each case. Figure (a) shows how the helicopter begins to move
along the x axis because the angular velocity of R4 and R2 is greater
than R1 and R3. In gure (b) R4 and R1 are rotating faster than R2
and R3, and the helicopter begins to move along the y axis. It should
be noted that gures (a) and (b) only show the transition from axial
ight to horizontal ight. Figures (c) and (d) show how the helicopter
rotates around its center. The direction depends on which rotor pair
is rotating faster.
10 Four rotor principles
An alternative to the xed blades where only the adjustment of the an-
gular velocity of the rotors is used, the pitch of the rotor blades can be
changed to get the same eect. In this report however, the rotor blades are
considered to be xed with no means of pitch, lag-lead or apping.
Starting in a hover state of the helicopter again, in order to make the he-
licopter revolve around its center, the angular velocity of one of the rotor
pairs is increased while it is decreased for the other, see gures 2.4 (c) and
(d). The resulting dierence in torque applied to the body frame by each
rotor pair causes the helicopter to rotate around its center. It is easy to see
that with increased dierence in the angular velocities of the two rotor pairs
the helicopter will rotate faster.
The discussion above shows that all movement of the four rotor helicopter,
both rotational and translational, is done by simply changing the relative
angular velocity of the four rotors. There is no need to tilt the rotor disks.
This makes it possible to use xed blades on the rotors. Consequently, all
the complex mechanical manipulations of the conventional helicopter ro-
tor blades are not needed. This saves both weight and energy and makes
the four rotor less susceptible to mechanical failure than conventional heli-
copters. Theoretically this makes the xed rotor blades more ecient than
conventional helicopter rotor blades.
This simplicity comes at a cost. The four rotor helicopter has to be sta-
bilized by the means of electrical control devices, so that a pilot can y it.
However, unlike the situation in 1907, this is not a big issue nowadays, as
sensors, actuators, processing units etc. are easily accessible and are avail-
able in all price categories. One downside to this setup is that the four rotors
need four engines/motors. These contribute to the overall weight of the he-
licopter. The helicopter frame design and its overall weight are discussed in
chapter 3.
Chapter 3
Four rotor helicopter platform
The design and construction of a physical four rotor helicopter platform is
the topic of this chapter. The main emphasis in the design are that the
helicopter is small enough for indoor ight, lightweight for prolonged ight
and payload exibility, strong and sti. Chapter 6 describes all the electrical
hardware in more detail and the detailed frame construction can be seen in
appendix G.
When designing a control system for a physical object, there are most often
some unwanted dynamics that have to be considered. These can be tedious
to model and if their overall eect is considered to be trivial, they are often
excluded from the model.
In the four rotor helicopter case, the body frame will be considered to be
sti and its dynamics are not considered in the modeling. To justify this
assumption, it was decided to build a helicopter frame rather then buy some
o the shelf four rotor hobby helicopter of unknown quality.
The body frame
The body frame, seen in gure 3.1, is constructed as a horizontal cross with
equally long arms. A detailed description of the construction can be seen
in appendix G. In order to make it as sti as possible, square carbon ber
tubes were chosen for the arms. These are lightweight and strong. They are
joined in the center of the frame with a cross made of nylon. The rotors are
attached of the frame by rotor mountings made of aluminum. Some carbon
12 Four rotor helicopter platform
ber structural reinforcements in the form of center plates and strips were
added to the frame. The weight of the frame is about 0.075[kg] which is
about 10% of the helicopter total weight.
Figure 3.1: The carbon ber body frame, shown here without the landing frame.
Helicopter rotors
The motors used on the helicopter are Robbe Roxxy Bl outrunner 2824-34,
(32). These brushless motors were already available in-house and their spec-
ications were considered to t this helicopter project well.
The availability of contra rotating blades is limited. In appendix I, three
types of blades are tested. The chosen blades for the helicopter are Maxxprod
EPP1045, (27), which are a pair of counter rotating blades. These are
10[inch] long and have 4.5[inch] pitch which means that for each circle the
blade rotates the vertical movement is 4.5[inch].
With the combined Robbe motor and Maxxprod rotor blade the rotor can
give about 5[N] of thrust. Their relative rotor eectiveness is measured in
gure of merit (FM) which is a scale from 0 1, 1 being ideal rotor. In ap-
pendix I FM was measured for the chosen motors with three types of rotors
blades. FM was measured 0.34 for the chosen rotor blade while the others
blades had 0.27 and 0.22.
Motor controllers
To control the brushless motors, special motor controllers are needed. There
is a wide variety of hobby brushless motor controllers available, but most of
them have some build in time constants, which could make all responses of
the rotors slower than required in this project. Mikrokopter (28) produces
13
brushless motor controllers specially designed for four rotor helicopters.
They have a time constant < 0.0005[s] and were therefore chosen for this
project.
Flight controller
The ight controller is placed at the center of the frame, see gure 3.2.
This is done in order to maintain the symmetry of the construction. Fur-
thermore it does not interfere directly with the rotor wake as it is neither
placed above nor under the rotor directly. The ight controller electronics
are discussed in more detail in chapter 6 and will not be treated further here.
The landing frame
The landing frame is made of ash strips, see gure 3.3. These are lightweight
and exible enough to be bend into shape. Furthermore they can absorb a
relatively big amount of energy without breaking.
Energy source
Lithium polymer batteries were available in house. These are Graupner
2[Ah], 11.1[V ] batteries (17). They were considered ecient enough for the
helicopter to y for several minutes. The battery is attached under the cen-
ter of the helicopter with velcro straps. Theses are lightweight, strong and
exible, see gure 3.3.
The four rotor helicopter
Figures 3.2 and 3.3 show the completed helicopter used in this project. The
gures explain themselves.
With the physical platform in place, the next thing is to make a mathe-
matical model of the four rotor helicopter. That is the topic of chapter 4.
14 Four rotor helicopter platform
Figure 3.2: Top view of the helicopter. The motor controllers are placed symmet-
rically about the center.
Figure 3.3: Bottom view of the helicopter. It shows how velcro holds the battery
in place.
Chapter 4
Four rotor dynamics
When designing a control system to stabilize a physical system, generally
the rst step is to derive a mathematical model of the physical system.
This is not always an option as some systems can be extremely dicult to
model correctly. In practice when the mathematical modeling is possible,
the mathematical models of the systems are generally nonlinear (22, p. 29)
The topic of this chapter is to derive a linearized state space model, de-
scribing the dynamics of the four rotor helicopter about a chosen operating
point. The linearized state space model will then be used in chapter 5 as
the basis for the design of a linear quadratic regulator (LQR).
In order to derive the linearized state space model, some preliminary steps
have to be taken. First, a way to describe the movements of the helicopter
in an inertial Cartesian coordinate system, i.e. the xed reference frame, has
to be derived. This is necessary in order to track the movements of the heli-
copter in the xed reference frame. Second, a nonlinear mathematical model
of the system has to be constructed. Then a nonlinear state space model
is derived. Finally the nonlinear state space model will be linearized about
a chosen operating point of the system. For this purpose Matlab/Simulink
will be used (1).
16 Four rotor dynamics
4.1 Attitude representation
The nonlinear dynamic model that will be represented in section 4.2 is valid
in the helicopter body frame. This means that if the helicopter was con-
trolled by a pilot sitting in it, this model would describe the forces and
torques the pilot would be experiencing.
As this helicopter is remotely controlled, the pilot is standing in a dier-
ent frame of reference than that of the helicopter. This frame of reference
is called the reference here, see gure 4.1. In order to be able to track the
movements of the helicopter it is necessary to be able to project coordinates
back and forth from the reference frame to the helicopter body frame. That
is the topic of this section.
Figure 4.1: Four rotor helicopter sketch showing its orientation relative to its
body frame. The big arrows above the rotor disks show the rotation
of the rotors producing thrust in e
zb
direction. The arrows around
the axes show the direction of positive body rotation. The reference
frame is also shown in the gure.
Figure 4.1 shows the two frames of reference. These are two right hand
Cartesian coordinate systems. The reference frame is xed in space and is
dened with z
r
axes lying in the Earths gravitation vector, pointing down-
wards. The x
r
y
r
plane lies horizontally with the y
r
axis to the right
relative to the positive x
r
direction. The body frame has the same internal
axes orientation as the reference frame with the z
b
dened positive in the
opposite direction of the thrust vector which is orthogonal to the x
b
y
b
4.2 Nonlinear equations of motion 17
plane.
The projection from the reference frame to the body frame is done by mul-
tiplying the coordinates with an attitude matrix. The Euler zyx rotational
sequence is used to derive the attitude matrix, see appendix C. The rota-
tion about z, y, x is conventionally represented as the Euler angles , ,
respectively, see gure 4.1. The attitude matrix is shown in equation (4.1).
_
A

c()c() c()s() s()


c()s() +s()s()c() c()c() +s()s()s() s()c()
s()s() +c()s()c() s()c() +c()s()s() c()c()

(4.1)
For convenience c(...) = cos(...) in equation (4.1) and s(...) = sin(...).
The projection from the body frame coordinates into the reference frame
coordinates is done with the transposed matrix [A

]
T
. The transposed
matrix can be seen in equation (4.2).
_
A

T
=

c()c() c()s() +s()s()c() s()s() +c()s()c()


c()s() c()c() +s()s()s() s()c() +c()s()s()
s() s()c() c()c()

(4.2)
The use of the attitude matrix can be demonstrated for the representation
of the Earths gravitation vector in the helicopter body frame as seen above.
This is done by multiplying the gravitational vector by the attitude matrix
as in equation (4.3).
F
g
= Ae
zr
mg = A

0
0
1

mg =

s()mg
s()c()mg
c()c()mg

(4.3)
If e
zb
would have the same orientation as e
zr
for an example, F
g
acting on
the helicopter would be presented like in equation (4.4) in its body frame.
F
g
=

0
0
mg

(4.4)
4.2 Nonlinear equations of motion
In this section the dynamics of the four rotor helicopter are represented in the
form of two general nonlinear mathematical equations of motion, Newtons
18 Four rotor dynamics
second law of motion and its analog for rotating system, Eulers moment
equation.
As discussed in chapter 3, eorts were made to make the frame of the four
rotor helicopter as sti as possible. By doing that, the modeling of the
internal dynamics of the helicopter construction could be avoided. Treat-
ing the helicopter as a sti body simplies the modeling considerably and
the resulting modeling error is considered to be trivial. The helicopter is
therefore treated as a sti body, moving with six degrees of freedom, three
translational and three rotational. In addition to that, the helicopter rotors
are considered to be sti.
Two general equations of motion are used to describe the dynamics of the
helicopter (6, p. 13). Newtons second law of motion, see equation (4.5)
describes the relation between the total forces acting on the helicopter and its
relative acceleration
dv
dt
. Its analog for rotating systems is Eulers moment
equation, see equation (4.6). It describes the relation between the total
torques acting on the helicopter and its relative angular acceleration
dh
dt
.
F = m
dv
dt
(4.5)
=
dL
0
dt
(4.6)
Equation (4.5) applied to the four rotor helicopter, can be represented as
equation (4.7), see appendix A about rotating frame of reference.
F = m
dv
dt
= m(a

+v) (4.7)
In equation (4.7), is the Euler relative angular velocity vector in body
frame [p, q, r]

, a

is the relative Euler angular acceleration vector in body


frame [ p, q, r]

and v is the relative velocity vector in body frame [u, v, w]

,
see (6, p. 14).
The cross product from equation (4.7) can be seen in (4.8).
v =

p
q
r

u
v
w

qw rv
ru pw
pv qu

(4.8)
The right matrix is called the Coriolis eect. It is the acceleration that is
caused by the ctive forces that arise when Newtons second law of motion
is transformed into a moving frame of reference, see appendix A.
4.2 Nonlinear equations of motion 19
Equation (4.7) can now be written as (4.9).
F =

F
x
F
y
F
z

= m

u
v
w

qw rv
ru pw
pv qu

m( u +qw rv)
m( v +ru pw)
m( w +pv qu)

(4.9)
Equation (4.9) describes the forces causing the translational acceleration of
the four rotor helicopter.
Equation (4.6) can be written like (4.10), see appendix B concerning the
angular momentum.
=
dL
0
dt
=

+L
0
(4.10)
The rst term on the right in (4.10) is shown in (4.11),

= I
d
dt
(4.11)
where
d
dt
is the Euler angular acceleration [ p, q, r]

and I is the inertia ten-


sor, see appendix B. The values of the inertia tensor have been measured
for the four rotor helicopter, see appendix E, and are used in the simulations.
The angular momentum of the helicopter L
0
is given in (4.12),
L
0
= I (4.12)
and the inertia tensor for the four rotor helicopter can be seen in (4.13).
I =

I
xx
0 0
0 I
yy
0
0 0 I
zz

(4.13)
The cross product term in (4.10) thus becomes (4.14).
L
0
=

p
q
r

I
xx
p
I
yy
q
I
zz
r

(I
zz
I
yy
)qr
(I
xx
I
zz
)pr
(I
yy
I
xx
)pq

(4.14)
Equation (4.10) can be written as (4.15).
=

I
xx
p + (I
zz
I
yy
)qr
I
yy
q + (I
xx
I
zz
)pr
I
zz
r + (I
yy
I
xx
)pq

(4.15)
20 Four rotor dynamics
Equation (4.15) describes the torques causing the angular acceleration of
the helicopter in its body frame.
Equations (4.9) and (4.15) are the complete set of nonlinear equations de-
scribing the dynamics of the four rotor helicopter, assuming that the heli-
copter is a sti body. The three axes of its coordinate system are its principal
axes and center of gravity of the helicopter is situated at the origin of the
body axes (6, p. 12).
In equations (4.9) and (4.15), [m u, m v, m w]

and [I
xx
p, I
yy
q, I
zz
r]

repre-
sent the external forces and torques respectively acting on the helicopter.
These are the sum of several dierent forces and torques discussed below.
4.2.1 Forces acting on the helicopter
In order to discuss the forces and torques acting on the helicopter, the body
frame of the helicopter is dened as shown in gure 4.1.
The force that the rotors produce is called the rotor thrust T. As the position
and orientation of the rotor disc for each rotor relative to the body frame
is invariant, the direction of their thrust vector is always e
zb
. Equation
(4.16) shows the cumulative thrust of the four rotors.
F
r
= e
zb

T
i
; i I : [1, 4] (4.16)
The individual thrust measurements as functions of the rotors angular ve-
locity can be seen in appendix I. A theoretical basis, called the momentum
theory (25, p. 59), for simple analysis of the rotor performance can be seen
in appendix J.
The gravity acting on the helicopter is F
g
. This force vector has the positive
direction of z
r
in the reference frame, see gure 4.1. As the gravity force is
xed in the reference frame, its inuence on the helicopter depends on the
helicopters attitude, see chapter 4.1. Relating F
g
to the helicopters body
frame is done with the attitude matrix, see section 4.1 for validation. It can
be seen in equation (4.17).
F
g
= Ae
zr
mg =

s()mg
s()c()mg
c()c()mg

(4.17)
In (4.17) s(...) = sin(...) and c(...) = cos(...).
4.2 Nonlinear equations of motion 21
In ight, the drag of a rotor F
H
is conventionally called the H-force. The
derivation of the H-force can be seen in appendix D. It works opposite the
ight direction in the x y plane of the helicopter body frame. Equation
(4.18) shows the cumulative force from the four rotors.
F
H
=

u
|v|

v
|v|
0

H
i
; i I : [1, 4] (4.18)
In (4.18)
u
|v|
and
v
|v|
are the unit velocity vectors relative to the body
frames x y plan. These unit vectors decide the orientation of the H-force
in the x y plane.
The air resistance in the helicopter body frame causes a drag force F
d
. This
force is in the opposite direction of the unit velocity vector in the helicopter
body frame
v
|v|
. The equation for a drag force in a uid environment can be
seen in (4.19), (7, p. 13-20).
F
d
=
1
2
C
f
A
f
v
2
v
|v|
(4.19)
The drag coecient C
f
is a function of velocity (16, p.397). As the appli-
cation of this project is strictly indoors it can be assumed that its velocity
is limited to 0 2[
m
s
]. The resulting drag coecient is roughly estimated to
be C
f
= 0.5.
Assuming that the drag coecient is constant, then equation (4.19) shows
that F
d
is proportional to the squared uid velocity. In this case the uid
(air) velocity is the helicopter velocity. In (4.19) the air density is . The
frontal area of the helicopter body is A
f
. To simplify this expression the
frontal area is assumed to be the same for all ight directions. The largest
frontal area of the helicopter was measured and is used in the simulations,
see appendix G.
Combining all the forces discussed above gives equation (4.20).
F = F
r
+F
g
+F
H
+F
d
=

m( u +qw rv)
m( v +ru pw)
m( w +pv qu)

(4.20)
Dening

F
i
= F
r
+F
g
+F
H
+F
d
22 Four rotor dynamics
and isolating the acceleration vector [ u v w]

in equation (4.20) gives (4.21).

u
v
w

=
1
m

F
i

qw rv
ru pw
pv qu

(4.21)
Equation (4.21) describes the complete set of forces causing translational
acceleration in the nonlinear dynamic model of the helicopter.
4.2.2 Torques acting on the helicopter
The torques acting about the x and the y axes of the reference frame are
caused by the thrust vectors induced by the four rotors. In these cases
the thrust vectors are situated in the center of a straight line between the
two rotors in the rotor pairs causing the rotation. The thrust vector pairs
causing a rotation about the x axes are T
1
+ T
4
and T
2
+ T
3
, see gure
4.1. Similarly the pairs causing a rotation about the y axes are T
1
+T
3
and
T
2
+T
4
. Equations (4.22) and (4.23) describe these two torques.

x
= e
xb
_
((T
1
+T
4
) (T
2
+T
3
))
l
x
2
_
(4.22)

y
= e
yb
_
((T
1
+T
3
) (T
2
+T
4
))
l
y
2
_
(4.23)
In (4.23) l
x
= l
y
is the distance between any two of the rotors in a rotor
pair. Dividing it by two gives the radius from the center of the frame to the
point on which the force is acting.
As discussed in chapter 2, the spinning rotors have to overcome air resis-
tance when rotating. This results in torque
r
acting on the body that the
rotor is attached to. The orientation of the force component of this torque
is in the opposite direction of the rotation. The torque is a cross product
of the radius from center of rotation and the force acting perpendicular on
it see appendix B and the torque vector is oriented according to the right
hand rule (2, p. 50).
Figure 4.1 shows the rotational direction of the rotors that gives negative
thrust relative to e
zb
. The torque caused by the drag of the rotors can be
seen in equation (4.24).

r
= e
zb
(
M1

M2
+
M3
+
M4
) (4.24)
4.2 Nonlinear equations of motion 23
The drag of the rotors is a second order eect that depends on the shape of
the rotor blades. In order to nd the second order equation describing the
torque as a function of the rotor angular velocity, the torque of each rotor
was measured at dierent angular velocities and the results were tted using
Matlab, see appendix I.
Yet another torque that the rotors cause on the body, to which they are
attached, is the gyroscopic torque
g
, (4, p. 14). When the rotor is spinning
and its body frame is moving with angular velocity the body experiences
a torque from the rotors. The orientation of the torque depends on the
rotational direction of both the body frame and the rotor. Equation (4.25)
shows the cumulative torque for the four rotors acting about the center of
mass of the helicopter.

g
= I
r
[(e
zb

1
)+(e
zb

2
)+(e
zb

3
)+(e
zb

4
)] (4.25)
In equation (4.25) the inertia of the rotors I
r
is assumed to be the same.
The calculation of the inertia can be seen in appendix F.
When the helicopter is moving with a velocity v = 0 in the x y plane of
the reference frame the air velocity is higher for the advancing rotor blades
than the receding. This causes the thrust vectors point of attack on the
rotor disk to move from the center. (4, p. 14) which causes apping of the
rotor blades. This eect depends on the angular velocity of the rotor blades
and the velocity of the helicopter. As the rotor is considered to be rigid, the
resulting torque is transferred directly to the helicopter frame. The equation
for this torque is (4.26).

f
= [v

(e
zb
(
M1

M2
+
M3
+
M4
))] (4.26)
It has been suggested that in the case of the four rotor helicopter, the torque
contributions in (4.26) cancel each other out and thus do not aect the dy-
namics of the system, see (31, p. 148). It is intuitive to see that this is an
acceptable assumption because the torque on the frame is symmetrical about
the velocity vector in the x
b
y
b
plane. It should though be noted that these
torques stress the helicopter frame nevertheless, see appendix G.2.5 where
this problem is discussed briey.
As
f
is a function of both the rotor angular velocity and the helicopters
velocity, the contribution of
f
to the overall dynamics at low velocities is
trivial. When the four rotor helicopter in this project is in hover, the wind
velocity about the blade at half of the rotor radius is approximately 22[
m
s
]
24 Four rotor dynamics
while the maximum helicopter velocity is about 2[
m
s
]. The overall wind ve-
locity about the rotor blade is thus dominated by the angular velocity of the
rotor.
The constant in equation (4.26) depends on the design of the rotor blade.
No attempts have been done to derive through rotor measurements as
f
is considered to be trivial as explained before.
Whenever there is a change in the velocity of the rotors, torque is applied
to the body frame. This is due to the law of conservation of angular mo-
mentum (4, p. 15). This can be seen in equation (4.27)

a
= I
r
e
zb
(
M1

M2
+ M3 +
M4
) (4.27)
Equation (4.15) can now be written as (4.28).
=
x
+
y
+
r
+
g
+
f
+
a
=

I
xx
p + (I
zz
I
yy
)qr
I
yy
q + (I
xx
I
zz
)pr
I
zz
r + (I
yy
I
xx
)pq

(4.28)
By dening

i
=
x
+
y
+
r
+
g
+
f
+
a
and isolating the angular acceleration vector [ p q r]

in (4.28), equation
(4.29) is derived.

p
q
r

1
Ixx
0 0
0
1
Iyy
0
0 0
1
Izz

(I
zz
I
yy
)qr
(I
xx
I
zz
)pr
(I
yy
I
xx
)pq

(4.29)
Equation (4.29) describes the complete set of torques causing the rotational
acceleration on the nonlinear dynamical model of the helicopter.
Equations (4.21) and (4.29) are the complete nonlinear dynamic model of
the helicopter in the helicopter body frame. The next step is to derive a
linear state space model of the helicopter dynamics.
4.3 Simulink models
In order to linearize the nonlinear dynamical model of the helicopter using
Matlab and Simulink, an open loop model of the helicopter is constructed in
4.3 Simulink models 25
Simulink. Two models are made, one in the reference frame and the other
in the body frame. The open loop model in the reference frame makes it
possible to simulate the helicopter going from one point to another. The
open loop model in the body frame is a reduced model which is the correct
model of the physical four rotor helicopter in the sense that it has no ac-
celerometer measurements and can therefore only measure attitude changes
like the real helicopter.
4.3.1 Model in reference frame
The model in the reference frame is made by setting up the complete nonlin-
ear equations (4.21) and (4.29), derived in section 4.2, as a block diagram.
The block diagram of the open loop helicopter model in reference frame
can be seen in gure 4.2. The input is a vector containing the duty cycles,
which are described in appendix I, for each rotor. The output is a vector
containing the Euler angles and the helicopters position in reference frame
coordinates.
The states, the state derivatives, inputs and outputs of the system can be
seen in 4.30.
x =

p
q
r
x
y
z
p
q
r
x
y
z

x =

p
q
r
x
y
z

x
y
z

u =

u
1
u
2
u
3
u
4

y =

x
y
z

(4.30)
4.3.2 Model in body frame
The model in the body frame is made by setting up the nonlinear equation
(4.29), derived in section 4.2, as a block diagram. The block diagram of the
open loop helicopter model in body frame can be seen in gure 4.2.
As for the model in reference frame the input is an array containing the duty
cycles of the rotor driving motors. The output vector contains the angular
26 Four rotor dynamics
x y z
4
roll pitch yaw
3
dx dy dz
2
p q r
1
Transposed attitude matrix
Angles
du dv dw
Acceleration
Torque gyro
w
p q r
tg
Torque drag
Torque td
Torque acc
w ta
Torque Y
Thrust ty
Torque X
Thrust tx
Integrator 3
1
s
Integrator 2
1
s
Integrator 1
1
s
Integrator
1
s
Force rotors
Thrust Ft
Force gravity
Angles Fg
Force drag
Velocity Fd
Force H
Velocity Fh
Duty cycle to Angular velocity
Duty cycle w
Coriollis effect
u v w
p q r
Acceleration
Attitude matrix
dx dy dz
Angles
u v w
Angular velocity to Torque
w Torque
Angular velocity to Thrust
w Thrust
Add1
Add
1/m
K
1/I
K*u
p q r
Duty cycle
1
Figure 4.2: Simulink model of the open loop nonlinear dynamic model in the
reference frame.
velocities and Euler angles of the helicopter in the body frame coordinates.
The states, the state derivatives, inputs and outputs of the system can be
seen in equation (4.31).
x =

p
q
r
p
q
r

x =

p
q
r

u =

u
1
u
2
u
3
u
4

y =

p
q
r

(4.31)
4.4 Linearized models
The two models, reference frame and body frame, of the helicopter is lin-
earized with the purpose of making an LQ regulator . This is done with help
of Matlab, which is used to nd a linearization point and then linearize the
model around this point.
The linear approximation to the nonlinear system is described by equation
4.4 Linearized models 27
roll pitch yaw
2
p q r
1
Torque gyro
w
p q r
tg
Torque drag
Torque td
Torque acc
w ta
Torque Y
Thrust ty
Torque X
Thrust tx
Integrator 1
1
s
Integrator
1
s
Duty cycle to Angular velocity
Duty cycle w
Angular velocity to Torque
w Torque
Angular velocity to Thrust
w Thrust
Add1
1/I
K*u
p q r
In1
1
Figure 4.3: Simulink model of the open loop nonlinear dynamic model in body
frame. The Angular velocity to thrust and Angular velocity to torque
blocs are discussed in appendix I
(4.32), (18, p. 40).
x(t) = Ax(t) +Bu(t) (4.32)
Where the s denote the deviation from the linearization point. Matrices
A and B are:
A =
f(x
0
, u
0
)
x
, B =
f(x
0
, u
0
)
u
(4.33)
In equation (4.33), x
0
and u
0
are the stationary values, in this case the
values corresponding to hover.
The initial guess of a linearization point is done on the basis of measurements
for thrust and duty cycle which are shown in appendix I. The duty cycle is
the control signal for the rotors of the helicopter and the thrust is the lift of
each rotor. Hover state is when the trust from the rotors is just enough to
overcome the gravitational force and the helicopter is still in the air.
By using the trim function in Matlab the linearization point is generated
applying the initial guess for the input signal.
4.4.1 Linearized model in reference frame
The linearized model in reference frame is found in this section. The trim
function generates the following initial input signal values:
u
0
(1) = 0.4013
u
0
(2) = 0.3864
u
0
(3) = 0.3871
u
0
(4) = 0.3705
(4.34)
28 Four rotor dynamics
The input signals are are presented in duty cycle from 0 (0%) to 1 (100%).
Now that the input signals for hover are found, the linearizion of the he-
licopter model can take place. The linearization is done with the Matlab
function linmod, which takes the initial/stationary values for the states and
control signals. The stationary values for the states are equal to zero. The
linear state space model is on the form:
x(t) = Ax(t) +Bu(t), y(t) = Cx(t) +Du(t) (4.35)
Where the state space matrices A and B are as follows:
A =

0 6.3613 0 0 0 0 0 0 0 0 0 0
6.4007 0 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 9.82 0 0 0 0
0 0 0 0 1 0 9.82 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 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 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 0 0 0 0 0 0 1

B =

181.7491 183.0452 181.5290 176.7712


182.8752 184.1794 182.6537 177.8664
58.5946 58.9435 57.3055 53.9644
0 0 0 0
0 0 0 0
12.1935 12.2805 12.1787 11.8595
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

The C matrix is the output matrix. The outputs are, angles [, , ] and
the position [x, y, z]. These output are used to generate a reference matrix
used for simulations. The C matrix is:
4.4 Linearized models 29
C =

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 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 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1

And the D matrix:


D =

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

The helicopter model in reference frame has a complex conjugate pole pair in
06.381i and ten poles in 0. Since all the poles are placed on the imaginary
axis the helicopter is marginally stable.
To verify that the model is controllable, the controllability matrix is found
by using following equation:
M
c
= [B AB A
2
B ... A
n1
B] (4.36)
The controllability matrix has full rank and the system is therefore control-
lable.
4.4.2 Linearized model in body frame
The procedure of nding the linearized model in body frame is the same as
for the model in reference frame. The trimmed values are:
u
0
(1) = 0.3956
u
0
(2) = 0.3807
u
0
(3) = 0.3812
u
0
(4) = 0.3644
(4.37)
The trimmed values for the reference frame model, see equation (4.34) are
not the same as the trimmed values for the body frame model, see equation
(4.37). This happens because the trim function only considers the attitude
and not the altitude of the helicopter when used with the body frame model.
This means that the helicopter is not necessarily stable with respect to
30 Four rotor dynamics
altitude using the trimmed values seen in equation (4.37). The state space
matrices A and B are as follows:
A =

0 6.2723 0 0 0 0
6.3111 0 0 0 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0

B =

180.8002 182.0131 181.0361 176.1681


181.9204 183.1409 182.1577 177.2596
58.4693 58.6113 57.2476 53.9213
0 0 0 0
0 0 0 0
0 0 0 0

The output matrix C includes all the states, angular velocities [p q r]

and
angles [ ]

.
C =

1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1

D =

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

The helicopter model in body frame has a complex conjugated pole pair in
0 6.29i and ten poles in 0. As for the helicopter model in the reference
frame the system is marginally stable. The controllability matrix, equation
4.36, has full rank and therefore the model is controllable.
4.5 Open loop simulations of model in body frame
In this section the nonlinear and linear models in body frame are simulated
and compared. If gure 4.4 the six states are shown, angular velocities
[p q r]

and angles [ ]

.
The two models are given initial values for the angular velocity around the
y-axis, q. The imaginary pole pairs natural frequencies 6.29[
rad
s
] can be
4.6 Motor model 31
seen on the plots of the angular velocities p and q for both models. These
oscillations are naturally transferred to the angles. The angular velocities
p and q for both models seem to be identical, while the angular velocity r
for the linear model drifts away from the nonlinear model with 0.0017[
rad
s
].
Angles roll, , and yaw, for the linear model also drift away from the
nonlinear model.
These deviations between the linear and the nonlinear model are due to the
initial values for the states and input signals, the slightest deviation can
cause the linear model to drift away from the nonlinear model.
4.6 Motor model
The motors of the helicopter are brushless DC motors which drive the pro-
pellers of the heilcopter. Brushless DC motors dynamics can by linearly
modeled with the same principles as a brushed DC motor, though the con-
trol is dierent, see chapter 6.4 for description of brushless motors and the
control. In gure 4.5 a block diagram of a DC motor is shown, see (26, Ch.
2).
The input signal to the model is the armature voltage V
a
[V ], which is the
voltage over the armature windings. The the back electromotive force (back
emf) voltage, V
e
[V ], counteracts the armature voltage and is therefore sub-
tracted from the armature voltage V
a
[V ]. The back emf voltage is induced
in the armature of the rotor proportionally to the angular velocity of the
motor determined by K
e
[
V s
rad
] where K
e
is the back emf constant.
The electrical part of the motor is described by the block
1
Ra+sLa
, where
R
a
[] is the impedance and L
a
[H] the inductance of the armature windings.
The moment M
u
[Nm] produced by the armature is proportional to armature
current I
a
[A] multiplied by the moment constant of the motor K
t
[
Nm
A
].
This moment is aected by the friction of the motor M
f
[Nm], which is
proportional to the angular velocity of the motor, and the external load
M
b
[Nm] (in this case the propellers of the helicopter). J
m
[kgm
2
] is the
moment of inertia of the motor giving the acceleration of the motor and
by integrating the acceleration of the motor the angular velocity
m
[
rad
s
] is
found.
There are numerous constants that have to be measured for the model of
the motor. The measurements can lead to great uncertainties for the model.
Therefore a dierent approach was taken in modeling the motor with the
propellers, the combination of the motor and propeller is called a rotor.
In order to make the model measurements of the rotor, angular velocity
32 Four rotor dynamics
0 2 4 6 8 10 12 14 16 18 20
0.2
0
0.2
p
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Nonlinear
Linear
0 2 4 6 8 10 12 14 16 18 20
0.2
0
0.2
q
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Nonlinear
Linear
0 2 4 6 8 10 12 14 16 18 20
0.02
0
0.02
0.04
r
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Nonlinear
Linear
0 2 4 6 8 10 12 14 16 18 20
0.1
0
0.1
Roll
A
n
g
l
e
s

[
r
a
d
]


Nonlinear
Linear
0 2 4 6 8 10 12 14 16 18 20
0.02
0
0.02
Pitch
A
n
g
l
e
s

[
r
a
d
]


Nonlinear
Linear
0 2 4 6 8 10 12 14 16 18 20
0.2
0
0.2
0.4
Yaw
A
n
g
l
e
s

[
r
a
d
]
Time [s]


Nonlinear
Linear
Figure 4.4: Open loop response for the body frame model, with initial angular
velocity q = 0.1[
rad
s
].
4.6 Motor model 33
Figure 4.5: Motor model.
measurements were done around hover. By giving the rotors a step on the
input signal (duty cycle) while measuring the angular acceleration time, the
rotors time constant can be derived. The time constant is the time it takes
the output (angular velocity of rotor) to reach 63.2% its nal value, from
the step start. Assuming that inductance of the motor is very small the
rotor can be modeled as a rst order system with time constant
r
. The
time constant was measured
r
= 0.05[s] and is considered to be the same
for all rotors. The transfer function is:

r
D
r
=
1

r
s + 1
Where D
r
is the duty cycle,
r
the angular velocity of the rotor and
r
the
time constant for the rotor.
The input to the rotor is the duty cycle and its output is the angular ve-
locity. Therefore a function describing the relations between duty cycle and
angular velocity is made from measurements, see appendix I. In gure 4.6
the Matlab/Simulink model of the rotor is shown.
w
1
Integrator
1
s
Gain 1
K
Gain
K
Duty cycle to Angular velocity
f(u)
Duty cycle
1
Figure 4.6: Simulink model of helicopter rotor. The gains are equal to
1
r
.
34 Four rotor dynamics
Chapter 5
Controller design
In this chapter a controller for the four rotor helicopter is designed. Be-
cause the mathematical model of the helicopter presented in chapter 4 is
marginally stable, a controller is designed with the goal to make the heli-
copter stable.
The controller specications for a pilot augmented system have been sug-
gested in (31). There the rise time is t
r
< 1[s], settling time t
s
< 5[s] and
damping ratio 0.4 1.3. The controller will be designed using these
specications.
The model of the helicopter is a MIMO system (Multiple Input Multiple
Output system) and therefore a traditional controller, such as PID con-
troller (Proportional Integral Derivative), would require quite a lot of time
for hand tuning. Therefore a Linear Quadratic Regulator (LQR), which
is a MIMO linear closed loop controller, is chosen . The LQ regulator is
described in next section, using theory from (18, ch.5).
5.1 Linear Quadratic Regulator
The helicopter model described in chapter 4 is an nonlinear model, therefore
the model needs to be linearized to apply the LQ regulator. The linearization
point is when the helicopter is in a hovering state, see chapter 4.
The LQ regulator is an optimal controller with the goal of minimizing or
36 Controller design
maximizing the performance index to achieve a qualied controller. The
performance index is a measure of the quality of the controller.
Figure 5.1: A sample of a regulator time response where the object for the regu-
lator is to make the output signal y(t) reach the stationary point r
0
,
(18, Figure 5.2).
In gure 5.1 a typical regulator problem is shown. The object for the regula-
tor is to make the output signal y(t) reach the stationary point r
0
, as fast as
possible without too much overshoot. The grey area on the plot illustrates
the error in the system where the best controller is the one that minimizes
this area. Equation 5.1 is the performance index of the illustrated gure 5.1.
The performance index is equal to 0 when there is no error in the system,
this is achieved when the output signal y(t) is equal to the stationary point
r
0
for t = 0 . The control signal does not have limitations in equation
5.1 which is not the case in the four rotor helicopter construction.
_

0
| y(t) r
0
| dt (5.1)
The control signal has physical restrictions and therefore the cost function
has to take the limitations of control signal into account. Since the system
is linearized around an operating point, hover in the helicopter case, the
deviations from that point should be added to the cost function.
Equation 5.2 is the performance index for the LQ regulator. R
1
is the
weight matrix for the states and R
2
is the weight matrix for the control
signals, where x(t) = x(t) x
0
and u(t) = u(t) u
0
are the incremental
5.1 Linear Quadratic Regulator 37
states and control signals.
J =
_
t
1
t
0
[x
T
(t)R
1
x(t) + u
T
(t)R
2
u(t)]dt (5.2)
These weight matrices will determine how much deviation of x(t) and u(t),
respectively, from the stationary points will be added to the cost function.
The combination of these two parts of the cost function will set the speed
of the control system.
The objective is to make a steady state LQ regulator where the helicopter
model is linearized around the hover state. The linearized model is on the
state space form:
x(t) = Ax(t) +Bu(t) (5.3)
Equations 5.4 and 5.5 are used to select the weights of the weight matrices
for the states, R
1
, and the control signals, R
2
, respectively.
[R
1
]
ii
=
1
max([x
i
(t)]
2
)
(5.4)
[R
2
]
jj
=
1
max([u
j
(t)]
2
)
(5.5)
To determine the optimal control matrix, K, for the time invariant system
the Algebraic Riccati Equation (ARE) has to be solved:
0 = A
T
P +PA+R
1
PBR
1
2
B
T
P (5.6)
By solving the Riccati equation, the feedback gain K can be obtained by
using equation 5.7.
K = R
1
2
B
T
P (5.7)
Thereby the optimal gain matrix K can be used to close the loop from the
states of the system, x(t), to the control signals, u(t).
In gure 5.2 the state space model is illustrated with the LQ regulator.
38 Controller design
Figure 5.2: LQ regulator in a closed loop system with full state feedback, (18,
Figure 4.4).
5.2 Designing a continuous LQR for attitude and
position stabilization
In this section the method described in section 5.1 is used to design a contin-
uous LQ regulator for the helicopter. The controller designed is a full state
feedback controller. This is done for simulation purpose, making it possible
to y the helicopter model to desired position in the reference frame.
The object is to design a controller that makes it possible for a human
pilot to y the helicopter. The closed loop response time must therefore be
adjusted to t within the range of human pilot perception.
The rst step is to choose the restrictions for the weights of the weight
matrices for the states R
1
and the control signals R
2
by using equations 5.4
and 5.5 respectively. The maximum-values for R
1
are:
[p, q, r] = 2.62[rad/s]
[ x, y, z] = 1.9[m/s]
[, , ] = 0.262[rad]
[x, y, z] = 0.2[m]
The maximum-values for R
2
are:
[u
1
, u
2
, u
3
, u
4
] = 0.1
The state weight matrix R
1
is diagonal with elements inversely proportional
to the square of the max-values of the state variable, and is as follows:
R
1
=
5.2 Designing a continuous LQR for attitude and position stabilization39

1
2.62
2
0 0 0 0 0 0 0 0 0 0 0
0
1
2.62
2
0 0 0 0 0 0 0 0 0 0
0 0
1
2.62
2
0 0 0 0 0 0 0 0 0
0 0 0
1
1.9
2
0 0 0 0 0 0 0 0
0 0 0 0
1
1.9
2
0 0 0 0 0 0 0
0 0 0 0 0
1
1.9
2
0 0 0 0 0 0
0 0 0 0 0 0
1
0.262
2
0 0 0 0 0
0 0 0 0 0 0 0
1
0.262
2
0 0 0 0
0 0 0 0 0 0 0 0
1
0.262
2
0 0 0
0 0 0 0 0 0 0 0 0
1
0.2
2
0 0
0 0 0 0 0 0 0 0 0 0
1
0.2
2
0
0 0 0 0 0 0 0 0 0 0 0
1
0.2
2

The input weight matrix is:


R
2
=

1
0.1
2
0 0 0
0
1
0.1
2
0 0
0 0
1
0.1
2
0
0 0 0
1
0.1
2

The max-values for the states are chosen considering the helicopter to be
own indoors. The angular velocity values are the dynamic range values
given for the gyroscope sensor used to measure the angular velocity for the
physical four rotor helicopter, see data sheet for gyroscopes (10). The nal
values for the restriction presented above were found by simulating the step
response in gure 5.4 and adjusting the values until a desired response was
achieved.
The optimal gain matrix K is then found by using the lqr function in
Matlab, and is:
K =
_
0.0361 0.0365 0.0459 0.1714 0.0930 0.1026 0.2474 0.4471 0.1959 0.3093 0.1681 0.2456
0.0365 0.0362 0.0453 0.1720 0.0951 0.1020 0.2533 0.4479 0.1935 0.3109 0.1715 0.2445
0.0367 0.0367 0.0441 0.0954 0.1732 0.1060 0.4512 0.2540 0.1860 0.1721 0.3128 0.2515
0.0364 0.0365 0.0451 0.0929 0.1707 0.1089 0.4463 0.2475 0.1884 0.1675 0.3074 0.2581
_
To be able to simulate the closed loop system of the helicopter with a ref-
erence input in the reference frame, a reference transformation gain matrix
is implemented. The inputs to the matrix are the position and angles of
the helicopter, and the outputs are the control signals, see gure 5.3 of the
Matlab/Simulink model.
The reference transformation gain matrix is found by using equations (5.8)
and (5.9), from (21, p. 5.40).
M = C(ABK)
1
B (5.8)
40 Controller design
StepZ
StepY
StepX
Step Yaw
Step Roll
Step Pitch
Saturation of
control signal
Referance
gain matrix F
K*u
LQR gain matrix K
K*u
Control signal
for hover
u0
4rotor helicopter
Ud
p q r
dotx doty dotz
roll pitch yaw
x y z
Figure 5.3: Matlab/Simulink model of the four rotor helicopter model and the
continuous LQ regulator.
F = (M
T
M)
1
M
T
(5.9)
To nd out whether the closed loop system is stable, the poles for the system
are found. The eigenvalues for the poles in the system are complex conju-
gated which means that the poles are in a second order system. A second
order system can be described with the transfer function:
Y (s)
U(s)
=

2
n
s
2
+ 2
n
s +
2
n
(5.10)
Where
n
is the natural frequency and the damping factor. The second
order system shows the connection between the states of the system, how
each angle is dependent on corresponding angular velocity and how each
position is dependent on corresponding velocity.
In nding eigenvalues, damping factors, natural frequencies and time con-
stants, the closed loop matrix A
c
is found. That is done using the following
equation:
x(t) = A
c
x(t) = (ABK)x(t)
A
c
= ABK
The eigenvalues, damping, natural frequencies and time constants of the
closed loop system, A
c
are shown in table 5.1. All the poles lie in the left
half-plane of the s-plane, and therefore the closed loop system is stable.
Equations 5.11, 5.12 and 5.13 can be used to nd the natural frequencies,
damping ratios and time constants for the system poles.

n
=
_

2
+
2
(5.11)
5.2 Designing a continuous LQR for attitude and position stabilization41
Poles States
A

n
[
rad
s
] [s]
1, 2: y, y 2.52 2.58i 0.7 3.61 0.277
3, 4: x, x 2.53 2.52i 0.709 3.57 0.280
5, 6: z, z 2.54 2.38i 0.730 3.48 0.287
7, 8: r, 5.16 4.13i 0.781 6.61 0.151
9, 10: q, 8.26 2.62i 0.953 8.67 0.114
11, 12: p, 13.1 9.05i 0.823 15.9 0.063
Table 5.1: Eigenvalues (
A
), damping factors (), natural frequencies (
n
) and
time constants () for the closed loop system, A
c
.
=

_

2
+
2
(5.12)
=
1

n
(5.13)
Simulation of model in reference frame
By using the Matlab/Simulink model in gure 5.3, a negative 0.2[m] step
was made in the z direction at Time = 1[s], this means that the helicopter
should go 0.2[m] upwards. Upper gure 5.4 shows the step response of the
position in x, y and z direction and in lower gure 5.4 the control signals
for the helicopter are shown.
To analyze the step response in upper gure 5.4, following statements are
used, (22, p.120):
Rise time t
r
, is the time for the response to reach form 10% to 90% of
the stationary value.
Settling time t
s
, is the time it takes for the response to get within 2
% of the stationary value.
Overshoot M
p
, is the dierence between the biggest value of the re-
sponse and the stationary value.
The rise time, settling time and overshoot of the step response in gure 5.4
are:
Rise time t
r
is 0.56 seconds.
Settling time t
s
is 1.49 seconds.
42 Controller design
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.25
0.2
0.15
0.1
0.05
0
0.05
0.1
Position
P
o
s
i
t
i
o
n

[
m
]


x
y
z
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.34
0.36
0.38
0.4
0.42
0.44
0.46
Control signals
D
u
t
y

c
y
c
l
e
Time [s]


U1
U2
U3
U4
Figure 5.4: Step response of the helicopter model with LQR. The position is
shown on the upper plot and the control signals below.
Overshoot M
p
is 3.5%.
The settling time and rise time are reasonable and the overshoot of 0.007[m]
is considered to be trivial. The control signals are shown in gure 5.4, pre-
sented as the duty cycle. The control signals do not saturate so the LQ
regulator is working within the limits of the control signal. These responses
give an show that the model of the helicopter behaves correctly at the lin-
earization point.
The LQ regulator was also tested by setting the initial value for the velocity
in the x-direction ( x) equal to 0.5[m/s]. The reference signals are zero
throughout the simulation. The results of the simulations are illustrated in
gure 5.5.
The controller starts to react immediately and gives rotors 1 and 3 a boost, to
correct this pitch and change of position. This forces the helicopter to pitch
backwards, increasing the pitch angle to 0.24[rad]. This initial velocity also
has inuence on the position of the helicopter, causing it to move 0.11[m]
in the x-direction and losing height to 0.02[m]. These changes in control
5.2 Designing a continuous LQR for attitude and position stabilization43
signal shifts the velocity in the x-direction backwards causing the helicopter
to move towards zero. The controller brings the helicopter to the trimmed
control values, in 2.5 seconds. As in the test before the controller and the
model response correctly, this time to the initial value of the velocity in the
x-direction.
The swings in the angular velocity, p, around the x-axis from 0 seconds to
1 second are due to the time constants of the rotor interacting with time
constants of the helicopter rotors causing these swings. The lower the time
constants are the smaller the swings become. The rotors time constants also
inuence the angular velocity, q, around the y-axis which leads to the angles
roll () and pitch ().
The oscillations on the angular velocity p and roll angle are slightly faster
than their corresponding natural frequencies. The frequency on the plot for
the angular velocity is 22
rad
s
(3.5Hz) while the natural frequency in table
5.1 is 15.9
rad
s
(2.5Hz). This dierence is due to the time constants of the
rotors. If the time constants of the rotors are made smaller the frequency
of the oscillations gets closer 15.9
rad
s
. This is also the case for the angular
velocity q and pitch angle . The natural frequency for the velocity x is
3.57[
rad
s
] (0.57Hz) which can be seen on the response for the velocity x.
44 Controller design
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.35
0.4
0.45
0.5
Control signals
D
u
t
y

c
y
c
l
e


U1
U2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.35
0.4
0.45
0.5
D
u
t
y

c
y
c
l
e


U3
U4
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
2
0
2
States
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


p
q
r
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.5
0
0.5
V
e
l
o
c
i
t
y

[
m
/
s
]


dx
dy
dz
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.5
0
0.5
A
n
g
l
e
s

[
r
a
d
]


roll
pitch
yaw
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.2
0
0.2
Time [s]
P
o
s
i
t
i
o
n

[
m
]


x
y
z
Figure 5.5: Results of simulation of the continuous LQR with an initial state value
of 1[m/s] for velocity x. The control signals are plotted on the rst
two gures and the states are on the next four gures. The simulation
time is 5 seconds.
5.3 Designing a reduced continuous LQR for attitude stabilization 45
5.3 Designing a reduced continuous LQR for atti-
tude stabilization
The physical helicopter has gyroscopic sensors which measure the angular ve-
locities [p, q, r] and, by integrating the angular velocities, the angles [, , ]
of the helicopter. This means that a full state feedback controller is not an
option. Therefore an LQ regulator is designed for the four rotor helicopter
in body frame, using the method presented in section 5.1.
As in section 5.3 the object is to design a controller that has a closed loop
response time that ts within the range of human pilot perception.
The weights for the state weight matrix R
1
and the input weight matrix are
the same as for the controller designed in section 5.2 without the acceleration
[ x, y, z] and position [x, y, z]. The state weight matrix max-values are:
[p, q, r] = 2.62[rad/s]
[, , ] = 0.262[rad]
The maximum-values for R
2
are:
[u
1
, u
2
, u
3
, u
4
] = 0.1
The control matrix for the model in body frame is:
K
2
=

0.0291 0.0297 0.0466 0.1270 0.2368 0.1972


0.0297 0.0293 0.0460 0.1312 0.2376 0.1946
0.0298 0.0297 0.0437 0.2388 0.1305 0.1857
0.0293 0.0295 0.0442 0.2356 0.1277 0.1862

The closed loop eigenvalues, damping factors, natural frequencies and time
constants for the body frame model are shown in table 5.2.
Poles States
A

n
[
rad
s
] [s]
1, 2: r, 5.15 4.13i 0.780 6.60 0.152
3, 4: q, 8.27 2.71i 0.950 8.70 0.115
5, 6: p, 13.1 9.0i 0.824 15.9 0.063
Table 5.2: Eigenvalues (
A
), damping factors (), natural frequencies (
n
) and
time constants () for the closed loop body frame system, A
c
.
To see how the closed loop system behaves, it is simulated with initial con-
ditions on the angular velocity q of /2[
rad
s
] around the y-axis. Figure 5.6
shows the results of the simulation.
46 Controller design
The initial angular velocity causes the helicopter to pitch backwards to
0.09[rad] and roll to the left to 0.03[
rad
s
]. The controller reacts to the
initial state value and gives rotors 1 and 3 higher control signal to bring the
helicopter to steady state, which takes about 1[s].
As in the simulation for the full state feedback controller, the swings in an-
gular velocity, p, around the x-axis, are due to the rotors time constants in-
tervening with time constants of the helicopter. The swings become smaller
as the time constants of the rotor are lower.
5.3 Designing a reduced continuous LQR for attitude stabilization 47
0 0.5 1 1.5 2 2.5 3
0.35
0.4
0.45
Control signals
D
u
t
y

c
y
c
l
e


U1
U2
0 0.5 1 1.5 2 2.5 3
0.35
0.4
0.45
D
u
t
y

c
y
c
l
e


U3
U4
0 0.5 1 1.5 2 2.5 3
1
0
1
2
States
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


p
q
r
0 0.5 1 1.5 2 2.5 3
0.05
0
0.05
0.1
0.15
A
n
g
l
e
s

[
r
a
d
]
Time [s]


roll
pitch
yaw
Figure 5.6: Results of simulation of the model in body frame using LQR with an
initial state value of /2 for angular velocity q. The control signals
are plotted on the rst two gures and the states on the next two.
48 Controller design
5.4 Discrete Linear Quadratic Regulator
The physical four rotor helicopter has a microprocessor where the control
system is implemented, see chapter 6. This means that the controlling of
the helicopter takes place on a digital platform. In this section it is shown
how the LQ regulator is discretized.
The linearized state space model of the helicopter needs to be discretized,
as shown in equation 5.14.
x(k + 1) = Fx(k) +Gu(k) (5.14)
To determine the optimal control matrix, K, the Riccati dierential equation
5.15 has to be solved.
P
d
= R
1d
+F
T
[P
d
P
d
G(R
2d
+G
T
P
d
G)
1
G
T
P
d
]F (5.15)
Where the weight matrices are transformed from continuous time to discrete
time by using equations:
R
1d
= R
1
T
s
(5.16)
R
2d
= R
2
T
s
By solving the discrete Riccati equation the feedback gain K can be obtained
by using the following equation:
K
d
= [R
2d
+G
T
P
d
G]
1
G
T
P
d
F (5.17)
5.5 Designing a discrete LQR
The method described in section 5.4 is used in this section to design a dis-
crete LQ regulator. A linearized state space model is found with sample time
of 0.01[s] and a discrete LQ regulator found from that model. The contin-
uous LQ regulator from section 5.3 is then compared with two discrete LQ
regulators, one with 0.01[s] sample time and the other with 0.02[s] sample
time. This is done to see if the performance of the regulator is reduced when
changing from continuous LQ regulator to a discrete LQ regulator and to
see if a dierent sample time has much eect on the discrete LQ regulators
performance.
5.5 Designing a discrete LQR 49
The rst step is to make the linearized state space model of the helicopter
discrete. The sample time used for the discretization is T
s
= 0.01[s]. The A
and the B matrices and the sample time are put into the Matlab function
c2d which generates the F and G matrices. Equations 5.18 and 5.19 show
how the discrete matrices are calculated.
F = e
ATs
(5.18)
G =
_
Ts
0
e
At
Bdt (5.19)
The discrete system matrices are:
F =

0.9980 0.0627 0 0 0 0
0.0631 0.9980 0 0 0 0
0 0 1 0 0 0
0.01 0.0003 0 1 0 0
0.0003 0.01 0 0 1 0
0 0 0.01 0 0 1

G =

1.7498 1.7615 1.8663 1.8161


1.8750 1.8876 1.7633 1.7159
0.5847 0.5861 0.5725 0.5392
0.0088 0.0089 0.0092 0.0090
0.0093 0.0093 0.0089 0.0087
0.0029 0.0029 0.0029 0.0027

The system is reachable since the reachability matrix M


c
matrix has full
rank. This means that the states can be controlled by the control inputs.
The M
c
for a discrete system is:
M
c
= [G FG F
2
G ... F
n1
G] (5.20)
The discrete weight matrices for the LQ regulator are found by using equa-
tion 5.4 and are:
G =

1
26.2
2
0 0 0 0 0
0
1
26.2
2
0 0 0 0
0 0
1
26.2
2
0 0 0
0 0 0
1
2.62
2
0 0
0 0 0 0
1
2.62
2
0
0 0 0 0 0
1
2.62
2

50 Controller design
R
2d
=

1
1
2
0 0 0
0
1
1
2
0 0
0 0
1
1
2
0
0 0 0
1
1
2

The discrete LQ regulator gain matrix is now found by using dlqr function
in Matlab. The gain matrix is:
K
d
=

0.0276 0.0270 0.0452 0.1138 0.2128 0.1872


0.0282 0.0265 0.0446 0.1179 0.2135 0.1849
0.0270 0.0282 0.0423 0.2149 0.1171 0.1762
0.0266 0.0280 0.0429 0.2122 0.1146 0.1770

To nd the eigenvalues for the discrete closed loop system the closed loop
system matrix needs to be found. The closed loop matrix is found by using
equation 5.21.
F
c
= F GK (5.21)
The discrete eigenvalues,
F
, are shown in table 5.3. The damping factors,
natural frequencies and time constants are the same as for the continuous
closed loop system shown in table 5.2.
Poles
F

A

n
[
rad
s
] [s]
1: 0.949 + 0.0392i 5.15 + 4.13i 0.780 6.60 0.152
2: 0.949 0.0392i 5.15 4.13i 0.780 6.60 0.152
3: 0.920 + 0.0249i 8.27 + 2.71i 0.950 8.70 0.115
4: 0.920 0.0249i 8.27 2.71i 0.950 8.70 0.115
5: 0.874 + 0.0789i 13.1 + 9.0i 0.824 15.9 0.063
6: 0.874 + 0.0789i 13.1 9.0i 0.824 15.9 0.063
Table 5.3: The discrete eigenvalues corresponding to the continuous eigenvalues,
damping factors, natural frequencies and time constants shown in table
5.2.
The relations between the continuous eigenvalues,
A
, and the discrete
eigenvalues,
A
, are shown in the following equation:

F
= e

A
Ts
(5.22)
All the discrete poles lie inside the unit circle and are therefore stable. This
is to be expected since the continuous poles are stable.
5.5 Designing a discrete LQR 51
Two discrete LQ regulators, with 0.01[s] and 0.02[s] sample time, are com-
pared with the continuous LQ regulator designed in section 5.3. They are
simulated with the initial values for the angular velocity around the y-axis,
q. Figure 5.7 shows the results of the simulation. The angular velocities, p
and q are plotted on the top two plots and the angles roll () and pitch ()
the bottom two.
The response for the discrete controller and the continuous controller are
similar. This was expected since the discrete controller is based on the
continuous controller. The simulations show that the smaller the sampling
time is the more the discrete response looks like the continuous response,
which is as to be expected.
Even though the discrete LQ regulators are similar to the continuous one,
they do not settle the states to steady state as quickly and have more over-
shoot. The discrete LQ regulator with sample time of 0.02[s] takes more
time to settle the states to steady state than the regulator with 0.01[s] and
has more overshoot. The dierence between the two discrete regulators is
small, showing that both regulators should be able to control the four rotor
helicopter. Sample times bigger than 0.02[s] have been tested (not reported).
These give a longer settling time and higher overshoot, and are therefore not
considered good candidates for controlling the four rotor helicopter.
52 Controller design
0 0.5 1 1.5 2 2.5 3
0.5
0
0.5
1
p
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Continuous
Discrete Ts=0.01
Discrete Ts=0.02
0 0.5 1 1.5 2 2.5 3
1
0
1
2
q
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Continuous
Discrete Ts=0.01
Discrete Ts=0.02
0 0.5 1 1.5 2 2.5 3
0.04
0.02
0
0.02
0.04
Roll
A
n
g
l
e
s

[
r
a
d
]


Continuous
Discrete Ts=0.01
Discrete Ts=0.02
0 0.5 1 1.5 2 2.5 3
0.05
0
0.05
0.1
0.15
Pitch
A
n
g
l
e
s

[
r
a
d
]
Time [s]


Continuous
Discrete Ts=0.01
Discrete Ts=0.02
Figure 5.7: Comparing continuous LQR with discrete LQR with 0.01 and 0.02
second sampling time.
Chapter 6
Hardware
The topic of this chapter is the electrical hardware used in the project.
Figure 6.1 illustrates a block diagram of the hardware structure.
The ight controller board is connected to a 3 cell Lithium-ion polymer
battery (LIPO battery), which powers all of the devices including the motors.
The microprocessor is the main control unit. It has an input that reads from
a receiver, an input for measurements from gyroscopes, a serial connection
to a Bluetooth device and a two wire serial connection to motor controllers.
In the following section, the hardware is described in more detail.
6.1 The ight controller
The ight controller board is developed by the SACS project (3). The board
is designed to be a ready-to-use ight controller for an indoor hobby sized
four rotor helicopter. This is done by mounting a microprocessor and gyro-
scopes on the board and ensure that there are enough input/output ports
available so that a minimum amount of necessary peripherals can be con-
nected to it. These include a remote control, wireless LAN, motor controllers
(PWM out), etc. The standard software implements a LQ regulator to ensure
attitude stability. The developers work from the idea, that the dierence in
the dynamics of small four rotor helicopters is so small that no software or
hardware changes are necessary in order to implement the ight controller
on several dierent helicopters. To ensure this, the possibility of adjusting
some key control parameters with the remote control is embedded in the
54 Hardware
Figure 6.1: A gure of the ight controllers layout in the SACS project (3).
ight controller.
At the same time, the cost of the ight controller is held as low as possible.
This is mainly done with the careful choice of gyroscopes and microprocessor
while keeping the design as simple as possible.
6.2 The microprocessor
When choosing the microprocessor for the ight controller, two main perfor-
mance specications were made. The microprocessor has to be able to run
the ight routine so that both measurement values and control signals can be
updated within 20[ms] and it has to have minimum 12 bit analog to digital
(adc) converter for the measured gyroscope signals. The Texas Instruments
MSP430f169 microprocessor was chosen for SACS because it fullls these
specications and has very accurate timers as well. By choosing a micropro-
cessor that has a 12 bit adc converter eliminates the need for an external
adc converter on the ight control board.
6.3 Blutooth module 55
The MSP430F169 microprocessor incorporates a 16 bit RISC CPU running
at 8[MHz] system clock. It has a high-performance 12 bit adc converter,
two timers with several capture/compare registers and analog voltage com-
parator. It has two hardware USART peripheral interfaces that are capable
of running in UART mode, SPI mode and I
2
C mode. Many of these possi-
bilities and others are used in this project.
6.3 Blutooth module
Getting data from the helicopter is very important. It can help with code
debugging which otherwise can be tedious and it can be used to monitor
the states of the helicopter for analytical purposes. In order to establish a
data link between the helicopter and the ground while in ight, a wireless
communication standard had to be chosen. The microprocessor is set up to
support two way communication, therefore a two way communication stan-
dard was required.
Tables 6.1 and 6.2 show some of the communication standards available.
Terminal Embeddet
GPRS 3G EGPRS GPRS 3G EGPRS
Delay ca. 1500[ms] ca. 350[ms] ca. 900[ms] ca. 1500[ms] ca. 350[ms] ca. 900[ms]
Bandwidth 40/400[
kbit
s
] <1[
Mbit
s
] <384[
kbit
s
] 40/400[
kbit
s
] <1[
Mbit
s
] <384[
kbit
s
]
Implement time ca. 3 days ca. 21 days
Line of sight Very good Very good
Price 1500[dkr] 1000[dkr]
Weight 150[g] 15[g]
Covered area Very good Very good
Table 6.1: Table over possible downlink methods using the GSM system. It should
be noted that most of the values are ca. values. More on the subject
can be found at (12), (14) and (36)
In tables 6.1 and 6.2 the values for implementation time (implement time)
are rough estimations on how long it would take to get them to work prop-
erly. Line of sight does not give exact values, but are considered relative to
each other. The covered area is the circle area which a sender covers. An
exception to this are the standards using the GSM system. These cover all
the area that their respective network covers.
The two candidates that stand out are Wlan and Bluetooth version 2. The
Wlan has very high bandwidth, is lightweight, is relatively cheap and is easy
to implement. Its downside is that its delay depends on how many users are
56 Hardware
RF(ZigBee) Bluetooth Wlan Infrared
2.4GHz version 1 version 2 802.11 g IrDA
Class 1 Class 2 Ext.
Delay <100[ms] <20[ms] <20[ms] <20[ms] variable <20[ms]
Bandwidth 250[
kbit
s
] 1[
Mbit
s
] 1[
Mbit
s
] 4[
Mbit
s
] <54[
Mbit
s
] <4[
Mbit
s
]
Implement time 21 days 10 days 10 days 2 days 2 days 2 days
Line of sight bad bad very bad good good very bad
Price 1000[dkr] 500[dkr] 500[dkr] 500[dkr] 750[dkr] 100[dkr]
Weight 20[g] 15[g] 15[g] 2[g] 11[g] <1[g]
Covered area <600[m
2
] <600[m
2
] <60[m
2
] <6000[m
2
] <600[m
2
] <120[m
2
]
Table 6.2: Table over other possible downlink methods, it should be noted that
most of the values are ca. values. More on the subject can be found
at (34), (13), (20) and (35)
on the Wlan at any given time. The Bluetooth version 2 standard was cho-
sen because it fullls the most important specications for the helicopter.
It can easily be used as a point to point transceiver, it has very little delay,
relatively high bandwidth, it is lightweight, cheap and it is easy to imple-
ment.
The Bluetooth module is used as a serial interface. As most modern day
computers come with a built in Bluetooth communication device which can
act as a serial port, the Bluetooth connection thus replaces a serial cable
connection. This makes it easy to use the selected Bluetooth module, the
Free2move F2M03GXA (15). This module comes with a easy-to-use wireless
universal asynchronous receiver/transmitter (UART) rmware which imple-
ments its serial port prole. The data that the microprocessor sends to it
is transmitted transparently through the Bluetooth to the remote device.
The module is equipped with an omni directional antenna. When the Blue-
tooth module had been mounted on the PCB board, it was only a matter of
choosing the same baud rate for the microprocessor in order to start sending.
In this project, the data retrieved real time through the Bluetooth module
are angular velocity, angle, all the receiver values and the control signals.
During programming and testing of the helicopter debugging data was also
retrieved.
By making two way data communication possible with high bandwidth and
relatively low delay, the Bluetooth module can be used to send a broad range
of commands to the helicopter from the computer. This extends future ap-
plication possibilities of the helicopter considerably. It should be noted that
the Bluetooth module sends data directly without any means of error de-
tection. Some sort of a data packing with error detection should therefore
be done before using the module in order to get reliable data. This was not
6.4 Motors 57
possible in this project as there were already more than enough problems
getting the microprocessor to act as a ight controller.
6.4 Motors
Brushless DC motors are considered more suitable for the job at hand than
brushed DC motors. The brushed DC motor have the eld windings on the
stator and armature windings on the rotor and using brushes for switching.
A brushless DC motor has a permanent magnet rotor and a wound eld
stator and controlled by a switching electronic circuit. By omitting the
brushes of the DC motor, which wear down and can lead to bad electrical
connection, the eciency and the reliability is increased.
As mentioned in chapter 3 the motor chosen for the four rotor helicopter is
a brushless DC motor, Robbe Roxxy 2824-34 (32). The operating voltage
for the motor is 7.4[V ] 11.1[V ], with a operating current of 4[A] 8[A] and
a maximum current of 9[A].
To drive the motor, a motor controller, BL-Ctrl V1.2 by MikroKopter, was
chosen (28). The controller has a Pulse Width Modulation (PWM) input
for throttle values. This PWM signal has to be of a servo control standard,
which is used to control servo motors and often called Pulse Position Mod-
ulation (PPM). Servo control uses 1 2[ms] long pulses running at 50[Hz].
Each pulse is modulated with a value ranging from 0 100%. When the
pulse is modulated with 0% value the pulse width is 1[ms]. If the modulation
value is increased to 100% the pulse width becomes 2[ms]. The minimum
pulse width is thus 1[ms] and the maximum pulse width is 2[ms]. Figure
6.2 shows the servo control principles.
Figure 6.2: Servo control. The pulse width of the signal varies from 1[ms] and up
to 2[ms]. This range represents a value of 0 100%.
The motor controller is set up to run the I
2
C (Inter-Integrated Circuit)
communication protocol as well. This standard is a two way serial com-
puter bus protocol that supports 128 devices on a single two wire bus. For
further reading see (30).
58 Hardware
The I
2
C protocol can be chosen in stead of PPM to send throttle values
to the motor controller. When the initial thrust measurements on the ro-
tors were done, the stability of the rotor angular velocity using the PPM
standard was poor. The I
2
C standard, however, performed awlessly and
was therefore chosen as the communication protocol to deliver the throttle
values to the motor controllers. The reason for the poor stability using the
PPM is not that it is unreliable, but rather that the motor controllers are
optimized to run on the I
2
C standard.
Another advantage of the I
2
C protocol is that it can run much faster than
the PPM standard, or up to 400[KHz]. Sending one throttle value is done
by sending 18 data bits. At a typical sending frequency of 100[KHz] it
would therefore take about 720[s] to send data to all motors. The I
2
C can
send and receive data regardless of the microprocessors other duties so it
takes very limited time from the processor.
The motor controllers operate on 5[V ] voltage level while the MSP430 mi-
croprocessor operates on 3.3[V ]. In order to communicate with the motor
controllers using the I
2
C standard, a level shifter had to be implemented.
The level shifter is simulated and explained in appendix K.
The motor has three phases and the controller uses three-phase full-bridge
circuit to control it, see (24, p. 2-27).
Figure 6.3: Three phase bridge control.
In gure 6.3 the diagram of a three phase bridge control is shown along with
its switching sequence. When the motor is running, current ows through
two phases at a time. The current control is done by two switches, an upper
switch and a lower switch. The upper switch is controlled by a switching
6.5 Sensors 59
control signal with a period of 66[s], 15.15[kHz], and a various duty cycle.
By doing this the current through the phases is chopped, causing the current
to be within a certain level, or hysteresis.
Figure 6.4: Current hysteresis and duty cycle.
Figure 6.4 shows the actual current ows through the phases of the motor.
When the switches are turned on, with period of T
s
and duty cycle D, the
current through the phase rises to the top of the hysteresis band and then
they are turned o causing the current to fall down to the lower limit of the
hysteresis band. The higher the duty cycle becomes the higher current runs
through the phases.
6.5 Sensors
To be able to control the four rotor helicopter it is necessary to monitor
its behavior. This is done by using three single chip yaw rate gyroscopes,
ADXRS150 from Analog Devices (10). Each gyroscope measures the angular
velocity around one axis, x, y and z. Figure 6.5 shows how the gyros are
mounted on the ight controller board with an illustration of corresponding
axis for each gyroscope.
The ADXRS150 gyroscope full range sensitivity is 150[

s
], which corresponds
to 2.62[
rad
s
]. A clockwise rotation, looking at the device from above, gives
positive going output voltage. In other words, the output voltage increases
with clockwise rotation. This means that the gyroscope measuring the an-
gular velocity, r, around the z-axis rotates correctly with regards to the
denition of the four rotor helicopter while the gyroscopes measuring the
angular velocities around the x-axis, p, and y-axis, q, have to be inverted.
The ADXRS150 gyroscope is powered by a 5[V ] supply, while the micro-
60 Hardware
Figure 6.5: Gyroscopes are used to measure the angular velocity of the four rotor
helicopter.
processor runs on 3.3[V ]. This means that the measured signal has to be
scaled down, which is done by using two resistors, 15k and 10k, scaling
the voltage from the gyroscope by a factor of
2
5
. This has to be taken into
account when calculating from voltages to angular velocities.
The sensitivity of the gyroscope for one degree is 12.5[mV ] and the analog
to digital converter is 12 bit. The conversion from [V ] to [
rad
s
/bit] is done
by using the following equation:
g
s
_
rad
s
/bit
_
=
2.048[V ]
2
12
bit

5
2

1
12.5[mV/

/s]


180

(6.1)
The measured angular velocity is integrated to get the angle of the helicopter.
The result show that there is a drift in the gyroscope, see appendix H. This
means that the four rotor helicopter will drift somewhat which the pilot will
have to compensate for.
6.6 Print Circuit Board
A PCB board (Print Circuit Board) is designed for several components. The
modules used in this project include a Bluetooth device, level shifter and two
6.7 Receiver 61
power sources, 3.3[V ] and 5[V ]. Space in the PCB board was reserved for
an IMU (Inertial Measuring Unit) sensor from Analog Devices, ADIS16350
(9), and a pressure sensor from Bosch, BMP085 (5) for a possible future
implementation. These two devices were not implemented in this project.
The schematics and PCB layouts are shown in appendix L.
6.7 Receiver
The remote receiver used in the project is a Graupner C17 FM 35S receiver.
It has the 8 channels were only 7 were used.
With the electronics discussed above the four rotor helicopter is able to y
with the aid of a pilot. Before this can be achieved, the microprocessor has
to be programmed with a ight routine and attitude stabilizing controller.
That is the topic of chapter 7.
62 Hardware
Chapter 7
Software structure
Realizing the controller derived in chapter 5 for the four rotor helicopter
is done by programming the TI MSP430f169 microprocessor discussed in
chapter 6. The realization of the LQ regulator for the attitude control on
the microprocessor is basically a simple process, it reads measurements, in-
tegrates them, runs them through the K matrix, subtracts the results from
the reference and sends them out to the servos. However, as each of these
steps have to include additional functionalities in order to solve their task,
this relatively simple process can get rather complicated in practice. Fur-
thermore, as the control systems reliability relies highly on an invariant
sample time the system has to programmed as a real time system, in the
sense that is has to be able to execute all the necessary control tasks within
a predened time period. In order to do that, the system structure has to
be carefully designed to make use of all the aids that the microprocessors
has to oer. The topic of this chapter is to give an insight into the most
relevant functionality of the code controlling the helicopter.
7.1 Code ow diagrams
The discussion in the following will be focused on the ight state of the heli-
copter with a short description of the main function as well. In order to give
a good overview of the overall functionality of the code, it will be presented
in ow diagrams and all detailed description and code examples are omitted.
64 Software structure
The functions that will be presented are the main function, adc convert
function, receiver convert function and the controllerdynamicthrust
function. The state machine used in the program will be presented and the
state Flight augmented which is basically the simple control loop discussed
above.
The main function
The main functions ow diagram can be seen in gure 7.1. It starts by dis-
abling the watchdog timer, which is a hardware timing device that is able
to reset the system if it does not get service pulses regularly. Then it sets
the master clock at maximum frequency 8[MHz]. Next the initialization of
all the system modules is performed.
The timers used, all run in 10[ms] cycles. There are three timers, two timing
the capture of receiver data and one timing the servo outputs. The state
machine is then initiated. It is discussed in more detail below. Analog to
digital conversion (adc) is then initiated. That is also discussed below. Serial
input/output (sio) is initiated and nally the data transfer protocol, I
2
C,
used to write data to the motor controllers, is initiated.
When the system setup is done, the main function loops forever, sending
data if required and running the state machine in each loop. The possibility
to choose which data the helicopter sends to the ground computer with the
bluetooth module, is controlled by a switch on the remote control. In the
programming phase this was mostly used to get debugging data. The data
down/up link can though be used to send any relevant data.
The state machine
A ow diagram of the state machine can be seen in 7.2. The state machine
is the main ight control of the helicopter. It is programmed as a switch-
case structure. The state machine runs a system check before allowing the
helicopter to take o. If the state machine encounters a problem, it can get
stuck in the state where the problem was discovered. State time is a counter
that is restarted at zero at the beginning of each state. The state time is
used as control argument for each state.
There are two diodes, red and green, on the ight controller board as shown
in chapter 6. These are used by the pilot to monitor the helicopter states at
all times. In the diagram these are marked r and g. The diagram shows the
logical steps that have to be taken before the helicopter is ready to y. It
mostly explains itself, but the two states Calibrate and Flight augmented
troubled need further explanation.
7.1 Code ow diagrams 65
Figure 7.1: The main function runs initiating routines and than loops forever,
sending data to the pilot and running the state machine in the loop.
66 Software structure
Figure 7.2: The state machine is implemented as a switch-case structure.
7.1 Code ow diagrams 67
When the helicopter is in Calibrate state samples from the gyros are taken
in order to calculate their mean oset before takeo. The gyro values can
thereby be corrected by the oset in order to give zero mean angular ve-
locity before takeo. It should be noted that the gyro measurement noise
that is used to derive the oset is taken before the rotors are started. The
noise characteristic therefore change considerably when the rotors are run-
ning and the state noise adds to the measurement noise. The receiver is also
calibrated in the Calibrate state.
The helicopter can go from the state Flight augmented to the state Flight
augmented troubled if it loses the connection to the remote control. If this
connection is established again within 5[s], it will go into Flight augmented
again. The helicopter can also go into Flight augmented troubled state
if the thrust is too low. This is typically when the helicopter has landed. If
the state time exceeds 5[s] the state machine will go into Boot wait state
and the pilot cannot y the helicopter before calibrating it again.
In state Flight augmented the helicopter is ready to y or is ying. The
loop that the program runs in this state can be seen in gure 7.3.
The gure shows that after entering Flight augmented the program starts
taking new raw data from the gyros to convert them into [
rad
s
] This con-
version was discussed in chapter 6. Thereafter new receiver raw values are
converted into the appropriate units. If there are neither new adc values
nor receiver values, relevant data are sent to the pilot and the loop starts
again. Both functions adc convert and receiver convert can be seen in
appendix M.
If there are new adc and receiver data, the controller routine controller-
dynamicthrust, see appendix M, is initiated. This routine calculates the
new servo values using the gain matrix K derived in chapter 5. The servo
values are subsequently sent to the motor controllers. Thereafter relevant
data is sent to the pilot and the loop starts again.
The raw gyro values available to the adc convert function are updated
every 10[ms]. As soon as there are new data available, an adc ag is raised,
see appendix M. The adc ag allows the adc convert function to run and
return the converted data. Otherwise it will not return any data and the
code takes a short loop and tries again. As the whole control loop is exe-
cuted within 10[ms] the adc ag ensures that the control loop time is 10[ms]
by preventing the loop to proceed before it gets new adc data.
Figure 7.4 shows a ow diagram of how the pilot can inuence the atti-
68 Software structure
Figure 7.3: The control loops period time is controlled by the acd ag. This ag
is raised when there is new data available to be processed.
7.1 Code ow diagrams 69
tude of the helicopter as well as its total thrust. Some of the areas have
been highlighted by color for clarication. The red area marks the sensors
(gyro) signals after they have been converted to [
rad
s
] , the green area marks
the receiver signals after conversion and the blue area marks the integration
of the angular velocity into angles.
Figure 7.4: This gure shows how the control loop works when the helicopter
is ying. The signals are either single signals (thin lines) or vector
signals (thick lines).
As mentioned before, the mean angular velocity oset is calculated before
ight. The oset subtracted from the measured values can be seen besides
the red area. The gure shows how the roll, pitch and yaw receiver signals
inuence both angular velocity and angle in a dierent way. The X blocks
are dierent gain values that have been found by trial and error approach.
The pitch, roll and yaw signals are multiplied by x1 and are then added
to the angular velocities respectively before they are integrated into angles.
This is done so that the pilot is able to y the helicopter around and com-
pensate for the drift in the angle as a result of drift in the gyros. This is
70 Software structure
the pilots helicopter control. If the pilot wishes to change the yaw angle,
he will do that by putting the yaw stick to the left or right. Integrating
the following yaw value will make the controller react because its input is
dierent from zero. The helicopter will thus start rotating about its z axis
until it has reached the desired yaw angle. In a sense the controller is fooled
to turn the helicopter into a new yaw angle.
The same signals are multiplied by x2 and are added to the angle there-
after. This is done so that the pilots controls work immediately to some
extent while being integrated at the same time. This signal works with full
eect instantly while the signal that is integrated is multiplied with the sam-
ple time.
The same is done with the angular speed. The signals are multiplied by
x3 and the results are added to the angular speed before the results of the
addition is fed to the controller. The eect is the same on angular velocity
as described for the angle before. However the eect that this manipulation
has on the angular speed signal is kept very small as is much harder if not
impossible for the pilot to control the helicopter by inuencing the angular
velocity directly.
There are always some dynamics that are left out of the mathematical model
as discussed before. It is therefore necessary in many cases to ne tune the
control system by adjusting some of its parameters when it has been imple-
mented on the physical system. That is the purpose of the gain blocks that
are placed after the control matrix. These are marked with green and can
be seen in gure 7.4. The gains on the angles, angular speeds and the total
gain can be individually adjusted by sliders on the remote control. When an
optimal gain has been found, it can be preserved by writing it as constant
gain in the helicopter code.
When the control signals have been manipulated by the three gain values,
they are subtracted from the receiver thrust signals. The resulting servo
signal is then sent directly to the motor controllers.
7.2 Code performance
In order to make the initial written code work on the helicopter, two major
changes had to made to it. One of the problems was that the routine was
running to slow. The period time of the controller was about 40[ms] which
was not fast enough. This messed up the routine so that the sample time
used in the integration was much to small. A relatively stable ight was
7.2 Code performance 71
possible however. The eect of this was that the controller did not react to
the attitude changes of the helicopter in a proper way. This resulted in a
considerable drift of the helicopter with respect to pitch, roll and yaw. An
experienced pilot could compensate for this somewhat, but it was obvious
that some improvements were needed. If the integrated angles were mul-
tiplied by the sample time of 40[ms], the helicopter was unstable despite
eorts to ne tune it.
As all the values being used for the calculations were oating point val-
ues, it was decided to rewrite the code to calculate with xed point values.
This brought the period time under 10[ms] as described before. Calculating
with xed point values comes at a cost though. When calculations with
xed point values are done in general, a balance between lost accuracy in
the lower region and not overowing the variable in the higher region has
to be maintained. However, by setting the xed point so that there are 16
bits below the comma and 15 bits above it (one bit has to be used for sign)
the inaccuracy is only about 1% calculating small numbers. In the higher
region there is the possibility of overow, but the helicopter has to turn
around itself 20 times in the same ight before risking this.
After rewriting the code, tests were made on the helicopter on the ground
to ensure that the code was performing as intended. This gave promising
results and the microprocessor seemed to calculate everything in the right
manor. The angles were integrated to the right values as the helicopter was
turned. Unfortunately an hardware fault prevented further testing of the
helicopter. By the time this had been xed, the time frame for the project
was at an end, and further testing of the helicopter had to be suspended.
72 Software structure
Chapter 8
Flight test and model
validation
In this chapter the four rotor helicopter is tested and the nonlinear model is
validated. There is one test ight
1
presented, which describes the behavior
of the helicopter. It should be noted that at the time of this test ight, the
nal construction of the frame was not complete and later it was stiened
further to reduce state noise. Also the landing frame was changed to reduce
instability at take o.
As mentioned in chapter 7 there were some timing problems with regards to
the code. The execution time was to slow for the controller and the integra-
tion of the angular velocity was thereby incorrect. It was however possible
to y the helicopter despite these timing issues. The test ight required
good space due to the drifting of the helicopter.
Unfortunately further test ights, after the timing problems had been re-
solved, were not possible. This was due to a hardware fault that was resolved
at the end of the projects time frame. The results presented here are there-
fore sub optimal performance results that were logged during one of the
initial test ights.
In order to validate the nonlinear dynamic model of the helicopter, the
measured receiver values from the remote control, used as inputs during
the test ight, were used as input to the nonlinear model with its feedback
loops connected. This can be seen in gure 8.1. The setup with respect to
1
A video of the test can be seen on attached CD: FlightTest.MPG
74 Flight test and model validation
gains is exactly the same as was used on the helicopter in the test ight.
The data from the helicopter are logged by Matlab via the Bluetooth serial
connection.
Saturation
Ref u0
K matrix
K*u
Integrator 2
1
s
Integrator 1
1
s
Integrator
1
s
Gain 9
x1
Gain 8
x1
Gain 7
x1
Gain 6
x1
Gain 5
x2
Gain 4
x2
Gain 14
K
Gain 13
div
Gain 12
x3
Gain 11
x3
Gain 10
K
Gain 1
K
From
Workspace3
[Tsec,Pitch ]
From
Workspace2
[Tsec,Roll ]
From
Workspace1
[Tsec,Yaw]
Again
K
AVgain
K
4 rotor helicopter
Ud p q r
Figure 8.1: The setup for the model validation. The measured receiver input
signals are used as input to the nonlinear model. The outputs of
the nonlinear model, the angular velocities are then compared to the
respective measure values from the helicopter.
In gure 8.2 the servo signals for the rotors are shown. The servo signals
are increased steadily until the helicopter lifts from the ground after 7[s].
There is a spike at 27[s] caused by the pilot. At that time instant the pilot
gives the helicopter more throttle for a short period of time then lowering it
again and keeping it constant.
In gure 8.3 the input signals from the receiver are illustrated. The heli-
copter has a tendency to rotate relative to all its body frame axes. This
is especially noticeable on the yaw where the helicopter has a considerable
tendency to rotate counter clockwise. This is due to dierences between
rotors and possible construction deviations. Before the helicopter takes o,
the pilot therefore tries to eliminate this tendency by trimming in the angles
with the pitch, roll and yaw sticks on the remote control. In chapter 7, the
75
0 10 20 30 40 50 60 70
0.2
0.25
0.3
0.35
0.4
Servo signals
D
u
t
y

c
y
c
l
e


U1
U2
0 10 20 30 40 50 60 70
0.25
0.3
0.35
0.4
0.45
D
u
t
y

c
y
c
l
e
Time [s]


U3
U4
Figure 8.2: Servo signals that were logged during the ight test. This shows the
take o and the ight of the helicopter.
76 Flight test and model validation
way the remote control sticks pitch, roll and yaw inuence the angle and
angular velocity, was described.
In gure 8.3 the yaw input signal from the receiver is always negative, in-
dicating that the automatic trimming is not working. This is due to the
incorrect sample time used in the integration of the angular velocity. This
makes the inuence of the integrated angular velocity insucient, forcing
the pilot to keep the stick to the side. The same is necessary for the pitch
and roll angles. This can be seen on the pitch and roll receiver input signals
that gure 8.3 illustrates.
The angular velocity measurements are presented in gure 8.4. The angular
acceleration around the z-axis, r, is lower then for the velocity around the
other two axis indicating that the natural frequency is lower for the z-axis.
It is not possible to compare the natural frequencies of these measurements
with the simulated responses because these signals are a combination of re-
ceiver inputs and helicopter dynamics. In order to get data that describes
the dynamics of the helicopter correctly, the helicopters drift has to be min-
imized so that the receiver input signals pitch, roll and yaw can be set to
zero for a short period of time while the response measurements are being
logged. Unfortunately this was not possible for the reasons discussed above.
Figure 8.5 shows the measured and the simulated angular velocities for the
three axes over a much smaller interval then shown above. This gives a
more detailed view of the measured and the simulated signals in relation
to each other. It can be seen that the simulated signals mostly follow the
measured signals. If the gure is analyzed with respect to controller time
delay it can be seen that the delay is not constant. This could be caused
by the structure of the control algorithm and its varying loop time. There
is also a possibility of some variant time problems in the way the data is
collected on the helicopter and in the way it is sent.
Before the data is sent from the helicopter, it is multiplied by a factor 1000
to ensure accuracy of the sent data. The data is then scaled down again
with Matlab. It may be necessary to multiply the data by a greater factor
to improve the resolution more.
It seems reasonable to validate the nonlinear model on the base of the data
shown in gure 8.5. Its angular velocity responses to the logged input re-
sembles the logged angular velocity responses from the actual ight. The
dierence observed can be explained by a varying loop time of the controller
routine and a improper logging of the data. The controller design seems to
be working. The helicopter is stable even though a great drift occurs be-
cause of faulty integration. The performance of the controller implemented
77
0 10 20 30 40 50 60 70
0.15
0.1
0.05
0
0.05
Roll from receiver
0 10 20 30 40 50 60 70
0.3
0.2
0.1
0
0.1
Pitch from receiver
0 10 20 30 40 50 60 70
1
0.8
0.6
0.4
0.2
0
Yaw from receiver
Time [s]
Figure 8.3: Receiver signal inputs during the ight test. The pitch, roll and yaw
sticks must be held in positions dierent from zero in order for the
helicopter to hover indicating that a constant trim has to be done
by the pilot. This is necessary because the integration from angular
velocity to angle does not work correctly.
78 Flight test and model validation
0 10 20 30 40 50 60 70
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
p
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Measurement
Simulation
0 10 20 30 40 50 60 70
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
q
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Measurement
Simulation
0 10 20 30 40 50 60 70
0.6
0.4
0.2
0
0.2
0.4
0.6
Time [s]
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]
r


Measurements
Simulation
Figure 8.4: Measured angular velocity signals from the test ight compared to
simulated angular velocity signals using the nonlinear model. The
measured receiver inputs from the test ight were used as inputs to the
model. The gure illustrates that the signals behave in approximately
the same way.
79
13 14 15 16 17 18 19 20
0.4
0.2
0
0.2
0.4
0.6
p
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Measurement
Simulation
13 14 15 16 17 18 19 20
0.4
0.2
0
0.2
0.4
0.6
q
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]


Measurement
Simulation
13 14 15 16 17 18 19 20
0.6
0.4
0.2
0
0.2
Time [s]
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]
r


Measurements
Simulation
Figure 8.5: Measured angular velocity signals from the test ight compared to
simulated angular velocity signals using the nonlinear model. The
measured receiver inputs from the test ight were used as inputs to the
model. The gure illustrates that the signals behave in approximately
the same way.
80 Flight test and model validation
in the helicopter is hard to assess without it being stable enough for a step
response. Improvements on the control algorithm used to regulate the he-
licopter and better control on the data transmission are needed before the
model validation can be conrmed.
Chapter 9
Conclusion
The main goal with this project was to construct a four rotor helicopter
control system for an indoor ight. The platform for the helicopter was a
custom made helicopter frame to improve sensor performance using ecient
brushless motors to induce thrust. A nonlinear dynamic model of the he-
licopter was derived and a LQ regulator was designed from the linearized
dynamic model. The ight control was realized using an on-board micropro-
cessor which was programmed to run pilot augmented ight control routine.
Data was collected through a wireless Bluetooth connection.
9.1 Conclusion on the helicopter construction
The construction of the helicopter was discussed in chapter 3 and in appendix
G. Considerable amount of time was used to make a simple, sti and strong
platform for the four rotor helicopter.
The helicopter frame
The initial result was a simple cross with the rotors attached on each end.
It was discovered that the carbon proles used in the construction could not
tolerate twisting torque repeatedly applied to them while ying. When the
frame had been stiened by attaching thin carbon ber stripes between the
motors this problem was resolved. The result is a frame that has inherited
the specic stiness of the carbon ber. This is thought to minimize the
state noise derived from the exibility of the frame in the system.
82 Conclusion
The rotors
Using the chosen brushless DC motors combined with the chosen rotor blades
gives very good thrust to weight ratio. At hover the duty cycle is about 0.35
which means that the helicopter should be able to carry a maximum payload
of about its own weight or more without going to the limit of the maximum
motor current. The gure of merit for the rotors found to be 0.34 which
seems low, but the theory applied in these calculations derives from full
scale helicopters.
The ight controller
The ight controller did not perform as well as was intended using oat-
ing point values for all the variables. The controller loop was running with
about 0.04[s] (25[Hz]) intervals while the integration from angular velocity
to angles was done with a much smaller sample time. This was caused by
the microprocessors inability to process oating point values fast enough
to ensure high enough control loop frequency. The helicopter could not be
stabilized using sample time of 0.04[s] either. Using xed point calculations
in stead brought the control loop time under 0.010[s] (100[Hz]) which sim-
ulations suggested to be small enough sample time. This however could not
be conrmed on the helicopter because of a hardware fault and the lack of
time.
The serial data connection
Using the Bluetooth module to collect data from the helicopter was a success.
It was easy to set up and worked immediately. Errors while sending the data
can however occur so that in order to get reliable data it should be packed
with some sort of error detection before sending it.
9.2 Conclusion on the controller design and simu-
lations
A linearized model of the helicopter was derived in order to design a LQ
regulator. The simulations show that the attitude controller stabilizes the
model with a settling time with about 1[s] which is within the specications.
Simulations on the discrete controller that were based on the continuous
controller showed that even with a sampling time of 0.02[s] the controller
was able to stabilize the system, and its settling time was about the same
as for the continuous controller. There was more overshoot though. Higher
sampling times than 0.020[s] are not recommended because the helicopter
has small time constants and its harder to make such controllers work on
9.3 Conclusion on the validation of the nonlinear dynamic model 83
the physical system than in simulations. This is mainly because un-modeled
dynamics of the system could destabilize it.
9.3 Conclusion on the validation of the nonlinear
dynamic model
Data from one of the early test ights were used to validate the nonlinear
model. At the time of the test, the helicopter ight routines were not being
executed as intended resulting in a sub optimal ight performance. How-
ever, the simulations using the test ight data indicate that the model can
be validated on the basis of these data. There are though some dierences
that have to be explained before the validation can be conrmed. The most
likely explanation is the unacceptable performance of the ight controller
routine which also can cause the data collected to be inaccurately sent via
the Bluetooth connection.
The project is considered to have been solved successfully in the sense that
the helicopter can be own by a pilot and the stabilizing controller works
properly. Also the model has partly been validated even though more tests
are required to conrm this.
It seems reasonable to assume that the drift of the helicopter could be stabi-
lized considerably by improving the ight controller code. It is unacceptable
to run a control loop at varying and too slow sample time. In order to do
this a possible solution would be to choose a microprocessor that does not
limit the capabilities of the control loop running as a real time system at
the desired sample rate.
Th orhallur T omas Buchholz (s973637)
Dagur Gretarsson (s021235)
84 Conclusion
Bibliography
[1] Matlab and simulink. http : //www.mathworks.com/.
[2] Marcelo Alonso and Edward J. Finn. Fundamental University Physics.
Volume one. Mechanics and thermodynamics. Addison-Wesley Publish-
ing Company, 1980.
[3] AUCS. Areal unmanned compact system. http : //www.aucs.dk.
[4] Allan Bertelsen and Sigurj on Magn usson. Modeling and control of a
4-rotor helicopter. Masters thesis, DTU, March 2004.
[5] Bosch. Bmp085. http : //www.bosch sensortec.com.
[6] A. R. S. Bramwell. Helicopter Dynamics. Edward Arnold, 25 Hill St.
London W1X 8LL, 1976.
[7] Gunnar Christiansen, Erik Both, and Preben stergaard Srensen.
Mekanik. Institut for Fysik, Danmarks Tekniske Universitet, 2000.
[8] University of Cambridge. Department of engineering. Interactive charts.
http : //wwwmaterials.eng.cam.ac.uk/mpsite/interactive charts/.
[9] Analog Devices. Adis16350. http : //www.analog.com.
[10] Analog Devices. Adxrs150. http : //www.analog.com.
[11] Dragany. Draganyer. http : //www.rctoys.com.
[12] Ericsson. Introduction of high-speed data in gsm/gprs networks. http :
//www.ericsson.com/solutions.
[13] Hannu Koivisto et al. Bluetooth and wireless
lan applicability for real-time control. http :
//ae.tut.fi/research/AIN/Publications/automaatio03 paper vladimir lucan
final.pdf.
86 BIBLIOGRAPHY
[14] Exitgames. Third generation mobile system. http :
//www.exitgames.com.
[15] Free2move. Bluetooth module. http : //www.free2move.se.
[16] Robert A. Granger. Fluid Mechanics. Dover Publications, Inc., 1995.
[17] Graupner. Lithium ion battery. http : //www.graupner.com.
[18] Elbert Hendricks, Ole Jannerup, and Paul Haase Srensen. Linear
Systems Control. Polyteknisk, 3. edition, 2004.
[19] Gabriel M. Homann, Haomiao Huang, Steven L. Waslander, and
Claire J. Tomlin. Quadrotor helicopter ight dynamics and control:
Theory and experiment. AIAA Guidance, Navigation and Control Con-
ference and Exhibit, August 2007.
[20] IEEE. Wireless lan. http : //standards.ieee.org/getieee802/download/802.11g
2003.pdf.
[21] Ole Jannerup. Vidergaaende Styreteknik - notes 1, 3, 4, 5. Institute for
automation, DTH, February 1988.
[22] Ole Jannerup and Paul Haase Srensen. Reguleringsteknik. DTU -
Automation, 2006.
[23] Bjarne Chr. Jensen. Teknisk Stabi. Nyt Teknisk Forlag, 19 edition,
2006.
[24] J. R. Hendershot Jr and Tje Miller. Design Of Brushless Permanent-
Magnet Motors. Magna Physics Pub, 1994.
[25] J.Gordon Leishman. Principles of Helicopter Aerodynamics. Cambridge
University Press, second edition edition, 2006.
[26] Nils Leth. Servomekanismer - bind 1. Servolaboratoriet, 1978.
[27] Maxxprod. Rotor blades. http : //www.maxxprod.com/mpi/mpi
29a.html.
[28] Mikrokopter. Brushless speed controller. http :
//www.mikrokopter.de/ucwiki/en/BrushlessCtrl.
[29] Eryk Brian Nice. Design of a hovering four rotor vehicle. Masters
thesis, Cornell University, May 2004.
[30] Philips. The i2c-bus specication. http :
//www.nxp.com/acrobat
d
ownload/literature/9398/39340011.pdf.
BIBLIOGRAPHY 87
[31] P. Pounds, R. Mahony, P. Hynes, and J. Roberts. Design of a four
rotor aerial robot. Proc. 2002 Australian Conference on Robotics and
Automation, 2002.
[32] Robbe. Robbe roxxy bl motors. http : //cms.robbe.com/en/.
[33] Marcel J. Sidi. Spacecraft Dynamics and control. A practical engineering
approach. Cambridge University Press, 1997.
[34] Techworld. Zigbee. http : //www.techworld.com/mobility/features.
[35] Vishay. Fast infrared transceiver module. http :
//www.vishay.com/docs/81211/tfdu6103.pdf.
[36] Neta Weiss. Understanding egprs. http :
//www.comsysmobile.com/pdf/Understanding
E
GPRS.pdf.
88 BIBLIOGRAPHY
Appendix A
Rotating frame of reference
In order for Newtons second law to work for mass moving with a non-inertial
frame of reference, ctitious forces acting on it have to be introduced. These
forces are added to the existing natural forces acting on the mass.
In the following, a term for describing Newtons second law for a moving
frame of reference is derived, see (7, p.6-6).
Figure A.1: The moving system S

turns with the angular velocity while O

has the acceleration a


0
relative to the inertial system S. The primes
are used to mark the variables that are related to the moving frame
of reference.
90 Rotating frame of reference
Figure A.1 shows the inertial system S with O as its center and the moving
system S

with O

as its center. The variables related to the moving sys-


tem are marked with primes. If S and S

have the same starting point at


t = 0, r
0
= v
0
t where v
0
is the constant velocity of O

. At the time t the


particle P is located at r in S and at r

in S

. The angular velocity of S

is .
For an observer in S equations A.1 show r, v and a.
r = xe
x
+ye
y
+ze
z
v =
dx
dt
e
x
+
dy
dt
e
y
+
dz
dt
e
z
a =
dvx
dt
e
x
+
dvy
dt
e
y
+
dvz
dt
e
z
(A.1)
Equally for S

equations A.2 show r

, v

and a

.
r

= x

x
+y

y
+z

z
v

=
dx

dt
e

x
+
dy

dt
e

y
+
dz

dt
e

z
a

=
d
2
v

x
dt
2
e

x
+
d
2
v

y
dt
2
e

y
+
d
2
v

z
dt
2
e

z
(A.2)
It should be noted that because the unit vectors for the moving system are
constantly changing their orientation, v

=
dr

dt
and a

=
dv

dt
.
As r = r
0
+r

,
dr
dt
can be expressed like in equation A.3.
dr
dt
=
dr
0
dt
+
dr

dt
(A.3)
The rst term on the right hand side is v
0
and the second term is shown in
A.4.
dr

dt
=
dx

dt
e

x
+
dy

dt
e

y
+
dz

dt
e

z
+x

de

x
dt
+y

de

y
dt
+z

de

z
dt
(A.4)
The rst three terms on the right side in equation A.4 are v

. For the last


three terms it should be noted that the unit vectors for S

are rotating with


the angular velocity and their lengths are constant. Equation A.5 shows
the term for the three unit vectors in S

dierentiated.
de

x
dt
= e

x
,
de

y
dt
= e

y
,
de

z
dt
= e

z
(A.5)
Equation A.4 can therefore be written like A.6.
91
dr

dt
= v

+ (x

x
+y

y
+z

z
) (A.6)
Combining equation A.1 and equation A.6 gives A.7.
dr

dt
= v

+ r

(A.7)
Equation A.3 can therefore be written like A.8.
v = (v
0
+ r

) +v

(A.8)
The term inside the parentheses in A.8 is the velocity of the particle P as if
it were at rest in S

. The term v

is the velocity of S

relative to P.
Dierentiating v in A.8 with respect to time gives A.9.
dv
dt
=
dv
0
dt
+
d( r

)
dt
+
dv

dt
(A.9)
In A.9
dv
dt
= a and
dv
0
dt
= a
0
. Applying Newtons second law to A.9 gives
A.10.
ma = ma
0
+m
d( r

)
dt
+m
dv

dt
(A.10)
The third term on the right in A.10 is shown in A.11,
m
dv

dt
= m(
dv

x
dt
e

x
+
dv

y
dt
e

y
+
dv

z
dt
e

z
+v

x
de

x
dt
+v

y
de

y
dt
+v

z
de

z
dt
)
m
dv

dt
= m(a

+ (v

x
e

x
+v

y
e

y
+v

z
e

z
))
(A.11)
or as shown in A.12.
F = m
dv

dt
= m(a

+ v

) (A.12)
This equation shows the forces acting on S

relative to P.
92 Rotating frame of reference
Appendix B
Equations of angular motion
Two general equations are used to describe the dynamics of a particle in a
moving frame of reference. One describes the forces acting on it (see in ap-
pendix A) and the other, describing the angular momentum, or the torque,
acting on it, is introduced in this chapter.
The term for moment of inertia that can be applied in the general case
of moving reference frame, called the inertia tensor, is also introduced in
this chapter.
B.1 Torque
The impulse p of a particle is shown in B.1. It is equal to the change of
momentum for a particle (2, p.186).
p = mv (B.1)
The term for angular momentum L
0
of a particle with the impulse p with
respect O is B.2 (7, p.5-2).
L
0
= r p = mr v (B.2)
Figure B.1 shows a circular motion of a particle in a plane. With the radius
94 Equations of angular motion
Figure B.1: A particle moving in plane around a xed point 0. The angular
momentum L
0
is perpendicular to both r and v.
r, angular velocity and the mass m, the angular moment is B.3. Here L
0
is a vector product of r and p.
L
0
= mr
2
(B.3)
As the particle is moving in a circular motion around the xed point 0, B.3
can be written like B.4 (7, p.7-9).
L
0
= I (B.4)
Here I is the moment of inertia for the point mass of the particle times
radius squared, mr
2
.
Dierentiation of B.2 gives B.5.
dL
0
dt
=
d(r p)
dt
=
dr
dt
p +r
dp
dt
(B.5)
By Newtons second law
dp
dt
= F and using
dr
dt
= v and p = mv equation B.5
can be modied to B.6.
dL
0
dt
= v mv +r F (B.6)
In B.6 the rst term on the right hand side is zero because v v = 0. The
second term on the right hand side is the torque, see B.7,

0
= r F (B.7)
B.2 Inertia tensor 95
or B.8.
dL
0
dt
=
0
(B.8)
Equation B.7 shows that the torque
0
is a vector product of r and F. The
torque is therefore perpendicular to the plane of the circular motion around
the xed point 0.
Generally the axis of the coordinate system are moving. It is therefore
necessary to apply equation A.7, see (6, p.12), to give B.9.
dL

0
dt
=

+L

0
(B.9)
This general form of the torque can be used to describe the torques acting
on a mass in a moving frame of reference.
B.2 Inertia tensor
In order to nd the impulse moment L
0
of a sti body with respect to 0, it
is important to know the moment of inertia for that body. This is the topic
of this section.
For the orthonormal set of unit vectors, e
1
, e
2
and e
3
, the impulse mo-
ment L
0
can be described like in B.10 (7, p.8-1).
L
0
= I
1

1
e
1
+I
2

2
e
2
+I
3

3
e
3
(B.10)
The axes the unit vectors e
1
, e
2
and e
3
lie in, are called the principal axes.
The moments of inertia in B.10 are thus called the principal moments of
inertia. Figure B.2 shows m
i
s contribution L
i,0
to L
0
. This is shown in
B.11.
L
i,0
= r
i
p
i
= m
i
r
i
( r
i
) (B.11)
By inserting a orthonormal coordinate system with its center in 0 and
the unit vectors e
x
, e
y
and e
z
, r
i
can be written as (x
i
, y
i
, z
i
) and as
(
x
,
y
,
z
). The vector product r
i
can than be written as B.12.
r
i
= (z
i

y
y
i

z
, x
i

z
z
i

x
, y
i

x
x
i

y
) (B.12)
96 Equations of angular motion
Figure B.2: The mass m
i
s contribution L
i,0
contribution to L
0
.
L
i,0
can be found in the same way, by the vector product of m
i
r
i
and r
i
,
see B.13.
L
i,0
= e
x
m
i
{(y
2
i
+z
2
i
)
x
x
i
y
i

y
x
i
z
i

z
}
+ e
y
m
i
{y
i
x
i

x
+ (x
2
i
+z
2
i
)
y
y
i
z
i

z
}
+ e
z
m
i
{z
i
x
i

x
z
i
y
i

y
+ (x
2
i
+y
2
i
)
z
}
(B.13)
By summing all m
i
, the impulse moment L
0
with respect to 0 can be written
like B.14.

L
x
L
y
L
z

I
xx
D
xy
D
xz
D
yx
I
yy
D
yz
D
zx
D
zy
I
zz

(B.14)
The rst matrix on the right hand side is called the inertia tensor

I. The
individual terms of

I are shown in B.15.
D
xy
= D
yx
=

m
i
x
i
y
i
, D
xz
= D
zx
=

m
i
x
i
z
i
, D
yz
= D
zy
=

m
i
y
i
z
i
I
xx
=

m
i
(y
2
i
+z
2
i
), I
yy
=

m
i
(x
2
i
+z
2
i
), I
zz
=

m
i
(x
2
i
+y
2
i
)
(B.15)
B.2 Inertia tensor 97
The upper terms in B.15 are called the products of inertia. The lower terms
are the moments of inertia. Equation B.14 can now be written like B.16.
L

0
=

I (B.16)
If the coordinate system, with which the sti body is moving, can be turned
so that 0 lies in the bodys center of mass and the body is symmetrical
around all the axes, then B.14 can be simplied to B.17, see (7, p.8-3) and
(6, p.15).

L
x
L
y
L
z

I
xx
0 0
0 I
yy
0
0 0 I
zz

(B.17)
98 Equations of angular motion
Appendix C
Euler angle rotation
The projection between two coordinate systems, inertial frame coordinates
and moving frame coordinates is the topic of this chapter.
A successive angular rotation about the three orthogonal frame axes is called
the Euler angle rotation. Out of the six possible ways this can be done, only
one will be introduced here, see (33, p.320).
It is common to dene the Euler roll angle as the rotation about the
bodys x axis, the pitch angle about the y axis and the yaw angle about
the z axis.
By assuming that initially the moving frame axes are aligned with the axes
of the initial frame, transformation is done in the following way:
Rotating about the z axes is the rst step. It is done with the transfor-
mation matrix seen in C.1.

x
1
y
1
z
1

cos() sin() 0
sin() cos() 0
0 0 1

X
Y
Z

=
_
A

X
Y
Z

(C.1)
Initially, the body axes were aligned with the reference axes X, Y and Z.
The next step is to rotate about the y axis. That is done with the rota-
tional matrix seen in C.2.
100 Euler angle rotation

x
2
y
2
z
2

cos() 0 sin()
0 1 0
sin() 0 cos()

x
1
y
1
z
1

=
_
A

x
1
y
1
z
1

(C.2)
The last rotation is about the x axis. The rotational matrix can be seen in
C.3.

x
3
y
3
z
3

1 0 0
0 cos() sin()
0 sin() cos()

x
2
y
2
z
2

=
_
A

x
2
y
2
z
2

(C.3)
This results in C.4.

x
y
z

x
3
y
3
z
3

=
_
A

_
A

_
A

X
Y
Z

=
_
A

X
Y
Z

(C.4)
The projection matrix can be seen in C.5.
_
A

c()c() c()s() s()


c()s() +s()s()c() c()c() +s()s()s() s()c()
s()s() +c()s()c() s()c() +c()s()s() c()c()

(C.5)
For convenience c(...) in C.5 means cos(...) and s(...) means sin(...).
The projection from the moving frame coordinates into the inertial frame
coordinates are done with the transposed matrix [A

]
T
, see (33, p.319).
The transposed matrix can be seen in C.6.
_
A

T
=

c()c() c()s() +s()s()c() s()s() +c()s()c()


c()s() c()c() +s()s()s() s()c() +c()s()s()
s() s()c() c()c()

(C.6)
Appendix D
Thrust and H-force
D.1 Rotor thrust
The theoretical thrust produced by a rotor in forward ight can be seen in
equation (D.1), (6, p.147).
T = A
r

2
r
R
2
r
a
4
_
2
3

0
(1 +
3
2
2
) +
_
(D.1)
In (D.1) is the air density, R
r
is the rotor radius, A
r
is the rotor area and

r
is the angular velocity of the rotor. The ratio of blade lifting area and
disk area is called the rotor solidity. It can be seen in (D.2). Here b is the
number of rotor blades and c is the blade chord at
3
4
R
r
.
=
Blade area
Disk area
=
A
b
A
r
=
bcR
r
R
2
r
=
bc
R
r
(D.2)
The thrust coecient of equation (D.1), C
T
can be seen in (D.3).
C
T
=
a
4
_
2
3

0
(1 +
3
2
2
) +
_
(D.3)
In (D.3), a represents the lift-curve slope of the airfoil section (25, p.119).
The eective pitch angle of the rotor blade is
0
.
Equation (D.4) shows the tip speed ratio.
102 Thrust and H-force
=

v
2
+u
2
+w
2
cos(argtan
w

v
2
+u
2
)

r
R
r
(D.4)
The disk plane inow velocity can be seen in equation (D.5).
=
sin(AWU)

r
R
r

i
(D.5)
AWU from (D.5) depends on u and w. The relationship can be seen in
equation (D.6), (4, 106).
AWU =

if u > 0, w > 0 then arg tan(


w

u
2
+v
2
)
if u > 0, w < 0 then arg tan(
w

u
2
+v
2
)
if u < 0, w > 0 then arg tan(
w

u
2
+v
2
)
if u < 0, w < 0 then arg tan(
w

u
2
+v
2
)

(D.6)
From (D.5)
i
can be written like equation (D.7) (4, p. 106).

i
= 0.047
_
226.35
2
+
_
226.35
2

4
+ 1 (D.7)
D.2 H-force
The H-force of a rotor is described by (D.8).
H
r
= sA
r

2
r
R
2
r
[
1
4

a
4

0
] (D.8)
In equation (D.8), = 0.012 (4, 106) is the prole drag coecient. All other
values have been described above.
Appendix E
The inertia of the helicopter
The inertia of the helicopter can be described in an inertia tensor as shown
in appendix B. The inertia tensor shows the inertia about the three princi-
pal axes.
As the helicopter is an irregular object, it would be much work to approxi-
mate its inertia. Instead the inertia about the three principal axes has been
measured.
Figure E.1 shows the setup for the measurement. By using a spring with
a known spring constant attached to a rigid support, the helicopter can be
treated like a torsion pendulum with suspending it to the spring. The period
time of the harmonic motion this rotation follows when rotated and released
is measured and used to calculate the inertia about the respective axis.
A spring was made of piano wire. To measure its torsion constant, a rod
with known inertia was used. Equation (E.1) shows the inertia for a rod.
I
c
=
1
12
Ml
2
(E.1)
In (E.1) M is the mass of the rod, and l is the length of it.
The relationship between the period time and the torsion constant is shown
in equation (E.2).
T = 2
_
I
c
K
(E.2)
104 The inertia of the helicopter
In (E.2) K is the torsion constant, I
c
is the inertia of the object and T is
the period time.
Figure E.1: The inertia measurements are done by suspending the helicopter on
a spring with a known torsion constant. Thereafter the helicopter
is brought into rotation and the period time of its harmonic motion
is measured in order to calculate its inertia. This is done about the
three principal axes of the helicopter frame.
Equation (E.2) can be written as equation (E.3).
K =
I
c
(
T
2
)
2
(E.3)
By calculating the inertia of the rod using equation (E.1) and by measuring
the period time of the harmonic motion of the rod suspended in the spring,
the torsion constant can be calculated using equation (E.3).
By rewriting equation (E.3) the inertia I
c
can be isolated as shown in equa-
tion (E.4).
105
I
c
= K(
T
2
)
2
(E.4)
By measuring the harmonic motion period time of the helicopter rotating
about its three principal axes, equation (E.4) can be used to calculate their
respective inertias.
The torsion constant K was measured by using a rod with l = 0.524[m]
and M = 0.524[kg]. Three measured period times gave a mean period time
T = 12.05[s]. This gives the torsion constant T = 0.00326[
kgm
2
s
2
].
The mean measured swing periods about the x, y and z axis were mea-
sured 9.7[s], 9.67[s] and 14.53[s] respectively. By using equation E.4 the
inertia tensor shown in equation E.5 was derived.

I =

I
xx
0 0
0 I
yy
0
0 0 I
zz

0.00777 0 0
0 0.00772 0
0 0 0.0175

(E.5)
This inertia tensor is used in the simulink model.
106 The inertia of the helicopter
Appendix F
Rotor inertia
In order to calculate the spinning rotors gyro eect and the torque caused
by change in angular velocity of the rotors, it is necessary to know their mo-
ment of inertia about the center of rotation. To do this, one of the Roxxy
Robbe motors was disassembled and the inertia of its rotating parts was
measured along with that of the blade.
Figure F.1 shows one of the rotors used on the helicopter.
Figure F.1: One of the helicopter rotors
To calculate approximately the rotors moment of inertia it is disassembled
into three pieces, the rotor blade, the stator and the rotor mount. These
pieces are all irregularly shaped. Their form is therefore tted to a regular
form with known moment of inertia. These are a rod, a ring and a circular
plate respectively.
108 Rotor inertia
The blade mount, see gure F.2, is approximated with a circular plate.
Figure F.2: The blade mounting. The lower part is fastened to the motor with
three screws. The blade is than fastened by tightening the nut.
Its moment of inertia can then be calculated using F.1.
I =
1
2
mr
2
(F.1)
The estimated radius of the rotor mount is r
m
= 0.007[m] and its mass is
m
m
= 0.005[kg]. That gives I
m
= 1.225e
7
[kgm
2
]
The stator can be seen in gure F.3. It is approximated with a ring ro-
tating around an axle in its center. Equation F.2 shows the formula for the
inertia of a ring.
Figure F.3: The stator. Here the permanent magnets can be seen.
I = mr
2
(F.2)
109
The estimated radius of the stator is r
s
= 0.013[m] and its mass is m
s
=
0.018[kg]. This gives I
s
= 3e
6
[kgm
2
].
A picture of the rotor blade can be seen in gure F.4. It is assumed equiva-
lent to a rod rotating around an axle in its center. Equation F.3 shows the
formula for the inertia of a rod.
Figure F.4: One of the rotor blades used on the helicopter.
I =
1
12
ml
2
(F.3)
The length of the rotor blade is l
rb
= 0.254[m] and its mass is m
rb
=
0.006[kg]. This gives I
rb
= 3.2e
5
[kgm
2
]
The total inertia of the rotor is shown in F.4.
I
r
= I
m
+I
s
+I
rb
= 3.5e
5
[kgm
2
] (F.4)
The approximations used to calculate the moment of inertia for the rotor,
are considered to give a good estimation of its true moment of inertia. The
rotors moment of inertia together with its air resistance control the time
constant of the rotor. As the time constant has been measured no attempts
have been made to measure the inertia of the rotor.
110 Rotor inertia
Appendix G
Helicopter frame construction
In this chapter, a complete construction of a four rotor helicopter platform
is introduced. The goal of the construction is to build a battery powered
helicopter that is small enough to be used for wireless indoor ight exper-
iments. The helicopter is thus restricted in size which also limits the total
weight it can carry.
G.1 Frame materials
The main emphasis in choosing the materials used for the frame construc-
tion is that they are lightweight, sti, strong and easy to work with. As
this is a prototype helicopter which is to be a platform for the design of an
autonomous control system, the cost of the materials is considered to be less
important, as are other material features such as service temperature and
water resistance.
The construction materials considered for the frame are wood, metals, com-
posite materials and polymers. Generally, materials with high specic strength
and specic stiness are preferred in aerospace applications. Specic strength
is the strength to density ratio and the specic stiness is the stiness to
weight ratio. Wood and polymers can therefore be ruled out immediately as
the main construction materials. These material classes have lower specic
strength than metals and composite materials and are therefore less suitable
for this application. This can be seen in gure G.1. Furthermore gure G.1
shows that composite materials generally have higher specic strength than
112 Helicopter frame construction
metals or metal alloys.
Figure G.1: Material specic stiness and specic strength ratio domains.(8)
Figure G.2 shows that the toughness of metals and composite materials are
similar. The choice therefore, lies between these two categories.
Aluminum is the best metal candidate for this application. It is strong,
sti, light and easy to work with. The diversity of aluminum proles on the
market is also great.
Carbon ber reinforced polymer (CFRP) is not as easy to use and the diver-
sity of proles available for this particular application is also less. Carbon
ber, however, has higher specic strength and specic stiness than alu-
minum.
Carbon ber is therefore selected as the main construction material of the
frame. Other materials used for the frame construction are aluminum and
polyamide (nylon). This can be seen below.
G.2 Frame design 113
Figure G.2: Material strength and toughness ratio domains.(8)
G.2 Frame design
The goal of the frame design is to build a simple, light weight and sti frame
which is strong enough to carry itself, all the electronics of the control sys-
tem, the rotors and a battery with enough capacity to y the helicopter for
several minutes. Furthermore, the frame interference with the rotor wakes
should be minimal.
This is done by designing a horizontal cross frame with equally long arms
where one rotor is mounted on the end of each arm. The printed circuit
boards and the battery are mounted in the center of the frame as payload.
G.2.1 Frame arms
The arms are constructed of CFRP tubes. When choosing between round
and square tubes the forces acting on each arm have to be taken into ac-
count. Given that the arm lies parallel to the x axis, the forces acting on
it are approximately perpendicular to the x y plane and x z plane, see
chapter 2.
114 Helicopter frame construction
Figure G.3: Beam with force P[N] acting on it. The deformation is U[m] and
the length from the one support to the other is l[m]
With this approximation the arm prole can be treated as a ordinary beam
with force acting on as shown in gure G.3.
Equation (G.1), see (23) describes the deformation U[m] as a function of
applied force P[N], length l[m], Youngs modulus E[
N
m
2
], which is a mea-
sure of stiness, and the second moment of inertia I[m
4
] which is a cross
sectional parameter.
U =
1
48
Pl
3
EI
(G.1)
For two beams made of the same material, the only variable parameter is the
inertia I. For a beam made of square tube with equal sides a
s
and material
thickness d
s
, the inertia is described with equation (G.2).
I
s
=
1
12
(a
4
s
(a
s
2d
s
)
4
) (G.2)
For a beam made of round tube with the outer diameter a
r
and material
thickness d
r
the inertia is described with equation (G.3).
I
r
=

64
(a
4
r
(a
r
2d
r
)
4
) (G.3)
Assuming that the inertia of the two beams is the same and a
b
= a
r
= a
s
,
equations (G.2) and (G.3) can be combined and solved for d
r
as a function
of d
s
, see equation (G.4).
G.2 Frame design 115
d
r
=
a
b
(a
b

64
12
(a
4
b
(a
b
2ds)
4
)

)
1
4
2
(G.4)
The mass of the square and the round tubes can be seen in (G.5) and (G.6)
respectively.
m
s
= V
s
= A
s
l
s
= (a
2
s
(a
s
2d
s
)
2
)l
s
(G.5)
m
r
= V
r
= A
r
l
r
= ((
a
r
2
)
2
(
a
r
2
d
r
)
2
)l
r
(G.6)
For the two beams, the material density, , and the beam length, l, are the
same. The dierence in mass is thus only dependent on the dierence in the
cross sectional area of the two beams.
Two equally long and broad square tube and round tube beams are com-
pared in table G.1. It shows that in order to be equally sti, the cross
sectional area of the round tube has to be 60.2% higher than that of the
square tube.
- a[m] d[m] I[m
4
] A[m
2
]
Square tube 0.008 0.000600 1.6316 10
10
1.776 10
5
Round tube 0.008 0.001364 1.6316 10
10
2.844 10
5
Table G.1: Square tubes and round tubes compared.
For the square tube selected, see below, with the dimensions a = 0.008[m]
and d = 0.0006[m], the density is measured to be 1406[
kg
m
3
]. With the
length of the four tubes attached to the cross, see below, l = 0.215[m] the
mass of the four tubes is m
s
= 0.0215[kg]. By using equally sti and broad
round tubes this mass would be m
r
= 0.0344[kg].
To determine the Youngs modulus E[
N
m
2
] of the square arms chosen, the
setup in gure G.3 was used, see gure G.4. In this test, the l = 0.8[m],
m = 1.355[kg] and U = 0.00954[m]. The second moment of inertia can be
seen in table G.1. The Youngs modulus is calculated E = 91.14[GPa]. The
specic stiness of the beam is
E

= 64.8[
MNm
kg
] which falls within the CFRP
domain shown in gure G.1.
Another big advantage of the square tubes is, that their at surface makes
the mounting of peripherals such as the rotors much easier.
116 Helicopter frame construction
Figure G.4: The square beam with a mass stressing it.
G.2.2 Center cross
The function of the center cross is twofold. It is used to join the arm proles
together in a cross (see gure G.6), and it is used as a support inside the
square proles so that they do not collapse when the printed circuit boards
(PCB) and battery are attached to the frame with screws, see gure G.5.
The arms slide up on the center cross and are glued to it with epoxy glue.
Figure G.5: A section of a CFRP prole with a piece of nylon inside it for support.
The nylon supports the prole so that it does not collapse when
screws are used to mount something on it.
The material chosen for the center cross is nylon. It is light weight and its
easy to work with. The strength and stiness of the center cross are more
trivial, partly because it is surrounded by the arms but also because the
G.2 Frame design 117
Figure G.6: The center cross is used to join the arms and act as support within
the proles when something has to be fastened to the frame with
screws.
center plate, see below, ensures its stiness. The weakness of this construc-
tion lies in the center where the nylon does not have any support from the
carbon ber. This is solved by adding center plates to the construction.
G.2.3 Center plates
The purpose of the center plates, see gure G.7, is to stien the frame to a
greater extent. They are made of CFRP.
Figure G.7: Center plate
When these are glued with epoxy on top and beneath the center of the
frame, it connects the arms on the opposite side of the center and also
covers the otherwise exposed nylon in the center. This creates sort of a
sandwich construction in the sense that it adds a very strong outer shell to
the nylon core that is not nearly as sti. The center plates also stiens the
side movements of the arms with the cross beam between them. In addition
118 Helicopter frame construction
to the glue, the center plates are held in place by the screws supporting the
PCB platform.
G.2.4 Rotor mountings
Attaching the rotors to the helicopter is done with the mounting brackets,
see gure G.8, fastened to the end of the arms with glue and two 3[mm] ny-
lon bolts. The rotor mounts are made of aluminum, partly because CFRP
is harder to work with and partially because nylon is not as sti. When it
is screwed on the surface of the arm, square pieces of nylon are slid into to
end of the frame as support so that the proles do not collapse, see gure
G.5. The nylon bolts holding the mounts are also used to fasten the landing
frame, see section G.3.
Figure G.8: The rotor mounting is made of aluminum.
G.2.5 Frame extra supports
After the construction of the frame, one weakness was discovered. When
a twisting torque is applied to the carbon ber square proles they can
easily begin to crack lengthwise along the proles. This weakens the prole
structure considerably. The reason for this is, that the proles are only made
of one layer of bers that lie lengthwise. If the proles were fabricated by
using two layer of bers crossing each other this would not be a problem.
Attempts to come across better fabricated proles suitable for the frame
were not successful. Extra supports were therefore added to the frame.
These are narrow carbon ber bands connecting the end of the arms, see
gure G.9.
G.3 Landing frame 119
G.3 Landing frame
The landing frame is made of thin stripes of ash wood. These can be seen
on gure 3.3. The ash wood light weight and very exible. It can therefore
easily be bent into shape. Alternatively some plastic stripes can be used.
The landing gear is made exible enough to be able to absorb the energy to
some extent when the helicopter crash lands and thereby protects the frame
from being damaged. At the same time, the landing frame has to be sti
enough to keep the helicopter from vibrating uncontrollably when taking o.
G.4 The helicopter frame
The assembled helicopter frame can be seen in gure G.9.
Figure G.9: The complete frame of the helicopter. The landing frame is not shown
here.
By constructing the frame in this way, the high specic stiness of the square
tubes was retained. The mass of the whole frame is m = 0.075[kg] which is
less than the mass of one rotor (m = 0.075[kg]). The frame is only about
10% of the helicopters total mass which is m = 0.744[kg].
G.5 Frame drag
In order to calculate the drag force of the helicopter, the frontal area has to
be known. This will be treated here.
The frontal area of the helicopter depends on the relative direction it is
ying. The largest frontal area is therefore estimated here. As its shape is
irregular, some approximations have to be made.
120 Helicopter frame construction
In the following, the helicopter is split into four area parts, the motors,
the frame, the printed circuit boards and the battery.
The four motors are all approximated to be 0.025[m] by 0.025[m] squares.
The cross sectional area of the motors is A
m
= 0.000625[m
2
].
The frame is 0.436[m] by 0.006[m]. The frontal are of the frame is thus
A
m
= 0.002616[m
2
].
The printed circuit boards with all the electronic are 0.10[m] by 0.055[m]
which gives A
c
= 0.0055[m
2
].
The battery is 0.08[m] by 0.02[m] which gives A
b
= 0.0016[m
2
].
The combined frontal area of the helicopter is thus A
f
= 0.0103[m
2
].
The largest frontal area of the helicopter A
f
can now be used to calculate
the drag force acting on it in ight, see chapter 4.2.1.
Appendix H
The single chip yaw rate gyro
ADXRS150
In this appendix tests of gyroscopes, yaw rate gyro ADXRS150 (10), that are
used to measure the attitude of the four rotor helicopter, are made. These
measurements are done to evaluate the drift of the gyroscopes.
Test of a single chip yaw rate gyro, ADXRS150 by Analog Devices, were
done by sampling the outputs of the gyroscope, with the helicopter sitting
stationary on the oor. Sampling is done with the microprocessor on the
ight controller board and the data is sent by Bluetooth to a computer where
Matlab logs the data. Further information for the gyroscopes can be seen
in (10).
Steady state test of gyroscopes
The gyroscope has a sensitivity of 150[

/s] @ 25

C or 2.618[rad/s] and
the data was logged over 900 seconds with interval of 31.6ms. In gure
H.1, the logged angular velocity is plotted in rad/s. The angular velocity
around the x-axis is p
sensor
, the angular velocity around the y-axis is q
sensor
and the angular velocity around the z-axis is r
sensor
. The mean value of
the measurements was subtracted from each sample to eliminate oset. The
standard deviation, , for the steady state measurement are shown in table
H.1.
By integrating the angular speed, angular drift is obtained. is presented in
122 The single chip yaw rate gyro ADXRS150
0 100 200 300 400 500 600 700 800 900
0.02
0.01
0
0.01
0.02
Angular speed
p
s
e
n
s
o
r

[
r
a
d
/
s
]
Time [s]
0 100 200 300 400 500 600 700 800 900
0.02
0.01
0
0.01
0.02
q
s
e
n
s
o
r

[
r
a
d
/
s
]
Time [s]
0 100 200 300 400 500 600 700 800 900
0.05
0
0.05
r
s
e
n
s
o
r

[
r
a
d
/
s
]
Time [s]
Figure H.1: Angular speed measurements of the gyros. Measurements are logged
over a period of 900 seconds.
123

p
= 2.67 10
3
[rad/s]

q
= 2.66 10
3
[rad/s]

r
= 4.28 10
3
[rad/s]
Table H.1: Standard deviation for measurement in rad/s.
p
is the standard
deviation for p
sensor
,
q
is the standard deviation for q
sensor
and
r
is the standard deviation for r
sensor
.
gure H.2.
The steady state measurements of the gyroscopes, show that the gyroscopes
are not identical. Sensors p
sensor
and q
sensor
look more alike while the r
sensor
has more standard deviation. Sensor r
sensor
has higher noise peaks than the
two others, while the angular drift of r
sensor
(
sensor
) and q
sensor
(
sensor
)
are similar. These drifts of the gyroscopes vary with change in temperature.
This means that the drift of the gyroscopes causes the four rotor helicopter
to drift. The pilot of the helicopter has to counteract these eects, since
there is no positioning measurement of the helicopter.
In H.3 the steady state measurements of the gyroscopes are displayed in his-
tograms. It shows how frequently each value in the measurements appears,
in ratio from 0-1.
124 The single chip yaw rate gyro ADXRS150
0 100 200 300 400 500 600 700 800 900
0.08
0.06
0.04
0.02
0
0.02
Angle

s
e
n
s
o
r

[
r
a
d
]
Time [s]
0 100 200 300 400 500 600 700 800 900
0.1
0
0.1
0.2
0.3

s
e
n
s
o
r

[
r
a
d
]
Time [s]
0 100 200 300 400 500 600 700 800 900
0.05
0
0.05
0.1
0.15
0.2

s
e
n
s
o
r

[
r
a
d
]
Time [s]
Figure H.2: Calculated angles of the angular speed measurements over period of
900 seconds.
125
0.015 0.01 0.005 0 0.005 0.01 0.015
0
0.05
0.1
0.15
0.2
0.25
PDF for p
sensor
[rad/s]
0.015 0.01 0.005 0 0.005 0.01 0.015
0
0.1
0.2
0.3
0.4
PDF for q
sensor
[rad/s]
0.06 0.04 0.02 0 0.02 0.04 0.06
0
0.05
0.1
0.15
0.2
0.25
PDF for r
sensor
[rad/s]
Figure H.3: Probability density function for the gyroscopes steady state measure-
ments.
126 The single chip yaw rate gyro ADXRS150
Appendix I
Rotor measurements
In this chapter the results from rotor measurements are presented. Three
rotor blades were measured and compared. The chosen rotor blade is shown
in section I.2 and the two other blades are shown in section I.3.
The measurements show the relationship between duty cycle, angular veloc-
ity, thrust and torque of the rotors. The results from these measurements
are used to generate functions that are used in the Matlab/Simulink model
of the helicopter.
I.1 Measurement setup
The measurement setup is shown in gure I.1. The rotor blades are attached
directly to the motor and the motor is controlled by the controller. The
controller gets a PWM signal from an Atmel development board STK500
with the Atmega 128 microprocessor and is powered by an 11[V ] power
supply. By varying the duty cycle into the controller, dierent angular
frequencies are obtained.
The angular frequency of the rotor is measured with a reective object sen-
sor, OPB 701, placed under the rotor blades beside the motor. The sensor
can be seen in gure I.2. The angular velocity is calculated as half of the
measured angular frequency. This is because the rotor blade has to pass
the sensor two times to complete one circle. The equation for the angular
velocity passing the sensor two times is:
128 Rotor measurements
Figure I.1: Measurement setup.

r
= 2f/2.
The rod, to which the motor and reective object sensor are fastened, stands
on a weight scale, see gure I.3.
Figure I.2: Angular velocity measurements are done with reective object sensor,
OPB 701.
Thrust measurements are made with the scale and are measured in grams.
The scale is a top loading Philips HR 2385/A with the accuracy of 1g .
Thrust in newtons is calculated using Newtons second law,
F = m a
Where m[kg] is the weight measured by the scale and a[m/s
2
] is the earth
gravity. Torque measurements are done using a turntable and a weight
scale, see gure I.4. The turntable is put on the side, placing the rotor on
the middle. A rod connects the turntable to the scale.
I.1 Measurement setup 129
Figure I.3: Thrust measurements, with scale.
Figure I.4: The torque measurement setup.
130 Rotor measurements
The torque [Nm] is calculated using equation:
= m l g
Where m[kg] is the mass measured by the scale, l[m] is the length from the
middle of the turntable to the rode attached to the scale and g[m/s
2
] is the
earth gravity.
I.2 Applied rotor blades
In this section the measurements of the rotor blades used for the four rotor
helicopter are presented. The length of the blades is 254[mm] which is less
than for the other two blades that were not chosen, resulting in less drag and
more angular velocity. The results are used in the Matlab/Simulink model
for the helicopter.
I.2.1 Duty cycle and angular velocity
The relations between duty cycle and angular velocity is shown in gure
I.5. These measurements are made by varying the duty cycle controlling
the rotor and measuring the angular frequency and nally calculating the
angular velocity. These results are then taken and tted using the Matlab
function polyval. The result is a second order polynomial function shown
in equation I.1

R1
(D
R1
) = 838.58 D
2
R1
+ 1545.2 D
R1
117.63

R2
(D
R2
) = 724.67 D
2
R2
+ 1418.0 D
R1
86.696

R3
(D
R3
) = 738.80 D
2
R3
+ 1414.2 D
R1
92.171

R4
(D
R4
) = 756.91 D
2
R4
+ 1363.7 D
R1
49.655
(I.1)
These coecients are used in the Matlab/Simulink model of the helicopter.
I.2.2 Angular velocity and thrust
In gure I.6 the relations between angular velocity and thrust is shown. As
mentioned in previous section the results are tted with Matlab. In equation
I.2 the results are shown.
I.2 Applied rotor blades 131
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
200
250
300
350
400
450
500
550
600
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]
Duty cycle
Duty cycle vs. angular velocity
Rotor 1
Rotor 1 fit
Rotor 2
Rotor 2 fit
Rotor 3
Rotor 3 fit
Rotor 4
Rotor 4 fit
Figure I.5: Duty cycle controlling the rotors is plotted against the angular velocity
for each rotor.
100 200 300 400 500 600
0
1
2
3
4
5
6
T
h
r
u
s
t

[
N
]
Angular velocity [rad/s]
Angular velocity vs. Thrust
Rotor 1
Rotor 1 fit
Rotor 2
Rotor 2 fit
Rotor 3
Rotor 3 fit
Rotor 4
Rotor 4 fit
Figure I.6: Angular velocity of the rotors is plotted against the thrust for each
rotor.
132 Rotor measurements
T
R1
(
R1
) = 15.998 10
6

2
R1
1.7593 10
3

R1
+ 214.05 10
3
T
R2
(
R2
) = 15.781 10
6

2
R2
0.9070 10
3

R2
+ 80.918 10
3
T
R3
(
R3
) = 13.375 10
6

2
R3
+ 1.1213 10
3

R3
193.14 10
3
T
R4
(
R4
) = 15.818 10
6

2
R4
0.5653 10
3

R4
+ 23.589 10
3
(I.2)
These coecients are used in the Matlab/Simulink model of the helicopter.
I.2.3 Angular velocity and torque
In gure I.7 the relations between angular velocity and torque are shown.
The results are tted using Matlab resulting in equation I.3.
100 200 300 400 500 600
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
T
o
r
q
u
e

[
N
m
]
Angular velocity [rad/s]
Angular velocity vs. Torque
Rotor 1
Rotor 1 fit
Rotor 2
Rotor 2 fit
Rotor 3
Rotor 3 fit
Rotor 4
Rotor 4 fit
Figure I.7: Angular velocity of the rotors is plotted against the torque for each
rotor.

R1
(
R1
) = 1.5226 10
6

2
R1
+ 56.190 10
6

R1
14.581 10
3

R2
(
R2
) = 1.8526 10
6

2
R2
106.31 10
6

R2
+ 12.710 10
3

R3
(
R3
) = 1.3391 10
6

2
R3
+ 267.13 10
6

R3
38.838 10
3

R4
(
R4
) = 1.4517 10
6

2
R4
+ 154.46 10
6

R4
28.498 10
3
(I.3)
The coecients are used in the Matlab/Simulink model of the helicopter.
I.3 Other rotor blades 133
I.3 Other rotor blades
In this section measurements for two rotor blades, not used for the four rotor
helicopter, are presented. These rotor blades are longer than the blade used
for the helicopter. Blade 1 is 336[mm] and blade 2 is 280[mm].
I.3.1 Duty cycle versus angular velocity
Figure I.8 shows the relation between the duty cycle to the controller and the
angular velocity for the two rotor blades. Blade 2 achieves higher angular
velocity than blade 1 for any given duty cycle, indicating that blade 2 has
less drag.
0.2 0.3 0.4 0.5 0.6 0.7 0.8
50
100
150
200
250
300
350
A
n
g
u
l
a
r

v
e
l
o
c
i
t
y

[
r
a
d
/
s
]
Duty cycle
Duty cycle for controller vs. angular velocity
Blade 1
Polyfit for Blade 1
Blade 2
Polyfit for Blade 2
Figure I.8: Duty cycle for driver versus angular for the two rotor blades.
I.3.2 Angular velocity and thrust
The angular velocity is plotted against the thrust from the rotor blades in
gure I.9. Here it can bee seen that blade 1 has more lift than blade 2 for
every given angular velocity.
134 Rotor measurements
0 50 100 150 200 250 300 350 400
0
0.5
1
1.5
2
2.5
3
3.5
T
h
r
u
s
t

[
N
]
Angular velocity [rad/s]
Angular velocity vs. Thrust
Blade 1
Blade 2
Figure I.9: Angular velocity versus thrust for the two rotor blades.
I.4 Figure of merit
The gure of merit (FM) is a way to asses the rotors relative performance.
It is a dimensionless number between 0 1 where 1 is ideal. FM has been
calculated for the rotors using the dierent rotor blades. The denition of
gure of merit can be seen in equation I.4, (25, p. 73).
FM = P
ideal
/P
meas
(I.4)
P
ideal
is found in appendix J can be seen in the following equation I.5.
P
ideal
= T sqrt
T
2A
(I.5)
Here is the density of air and A is the area of the rotor. P
meas
can be
found with equation I.6.
P
meas
= U I (I.6)
Figure of merit was calculate to be 0.34 for the applied rotor, 0.22 for the
rotor using rotor blade 1 and 0.266 for rotor blade 2. These seem relatively
low, but the applied theory is used on full size helicopters rotors and it is
not sure that it can be applied to small size rotors in unchanged form.
It is clear from all the data above that the applied rotor is the best choice
I.4 Figure of merit 135
in this project. The rotor blades 1 and 2 perform much worse. It should
though be noted that their rotor area is much larger so they might perform
better using dierent motors. This is supported by the fact that they give
greater lift at lower velocities.
136 Rotor measurements
Appendix J
Momentum theory
In this chapter, a theoretical basis for a simple analysis of the rotor per-
formance in hovering ight is derived. This is known as Rankine-Froude
momentum theory, (25, p.58).
In this approach, the following assumptions are made. The rotor blades
are treated as an innitely thin disk with the area A, over which a pressure
dierence exists, see gure J.1. Far upstream and downstream of the rotor
the velocity of the uid is quiescent. Viscous eects are negligible. The
thrust loading and induced velocity are uniformly distributed over the disk.
The uid is assumed to be incompressible. Furthermore, the ow through
the rotor is considered to be one dimensional and quasi-steady, or that the
ow properties at a point do not change with time. Fluid properties only
change with axial position relative to the rotor.
Three conservation laws now apply to the model and can be used in the fol-
lowing. These are conservation of mass, momentum and energy. Referring
to gure J.1, a control volume surrounding the rotor and its wake has the
surface area S. Equation J.1 describes the conservation of mass by stating
that the mass ow into the control volume is equal to the mass ow out of
it.
_ _
S

V d

S = 0 (J.1)
The conservation of uid momentum is described by equation J.2. Here the
force on the uid is supplied by the rotor. Newtons third law states that
138 Momentum theory
Figure J.1: Fluid ow model for momentum theory visualization.
the uid exerts a counterforce on the rotor. This force is the thrust, T.

F =
_ _
S
pd

S +
_ _
S
(

V d

S )

V (J.2)
The work done on the uid by the rotor is expressed in equation J.3. It
simply states that the work done by the rotor on the uid increases its
kinetic energy.
W =
_ _
S

V
2
1
2
(

V d

S ) (J.3)
These equations can now be used with the model shown in gure J.1, which
represents a hovering helicopter rotor. The area of the disk is A, the cross
section 0 represents the plane far upstream, cross sections 1 and 2 the plane
just above and below the rotor disk respectively. The cross section rep-
resents the plane far downstream.
The mass ow rate, equation J.4 is assumed to be constant within the bound-
aries of the wake.
m =
_ _

V d

S =
_ _
2

V d

S (J.4)
Equation J.4 reduces to equation J.5.
139
m = A

w = A
2
v
i
= Av
i
(J.5)
The relationship between the thrust and the net time rate-of-change of uid
momentum out of the wake is given by equation J.6. This is in accordance
with Newtons second law.

F = T =
_ _

V d

S )

V
_ _
0
(

V d

S )

V (J.6)
In hovering ight, the velocity of the uid far upstream is negligible. The
second term on the right of equation J.6 thus becomes zero, which reduces
the equation to equation J.7.
T =
_ _

V d

S )

V = mw (J.7)
The work done on the uid per unit time is Tv
i
which gives equation J.8.
Tv
i
=
_ _

1
2
(

V d

S )

V
2

_ _
0
1
2
(

V d

S )

V
2
(J.8)
As above, this equation can be reduced when considering the hover state
where the second term on the right of the equation becomes zero. This gives
J.9.
Tv
i
=
_ _

1
2
(

V d

S )

V
2
=
1
2
mw
2
(J.9)
Combining equations J.7 and J.9 gives equation J.10.
v
i
=
1
2
w (J.10)
Combining equations J.5, J.7 and J.10 gives the following useful relation
between the area, induced uid velocity, uid density and the thrust.
T = mw = m(2v
i
) = 2(Av
i
)v
i
= 2Av
2
i
(J.11)
Solving this equation for v
i
gives equation J.12.
v
i
=

T
2A
(J.12)
The power required to hover can be seen in equation J.9 and combined with
140 Momentum theory
equation J.12 it gives equation J.13.
P = Tv
i
= T

T
2A
(J.13)
In order to test the momentum theory, air velocity measurements were made
with the same setup as shown in gure I.1. This is described below.
Fluid velocity vector eld: To visualize the theoretical bounded wake
or slipstream, measurements were made on the air velocity above and below
the rotor with the two rotor blades that were not used on the four rotor heli-
copter. The air velocity measurements were done with the micro-manometer
TSI DP-Calc 8705 and a pivot-tube, see gure J.2.
Figure J.2: Fluid vector elds in the upstream and the wake of the rotor with
blade 2
The results can be seen in the next two gures. Figure J.3 shows the mea-
sured velocity values plotted as one dimensional motion vectors.
Measurements were taken with 20mm intervals horizontally along the blade,
starting at 40mm from the rotor axle out to the tip of the blade. Vertically
or axially, the measurements were taken at 285mm and 80mm upstream
and at 10mm and 368mm down in the wake. The same measurements were
taken with rotor blade 1. The results can be seen in gure J.4.
It is obvious from the gures that more measurements are necessary in order
to visualize air ow velocity vectors with more density. However the simple
moment theory seems to give a good idea of the air ow above the rotor disk
and in its wake.
141
300 200 100 0 100 200 300
500
400
300
200
100
0
100
200
300
400
Radius [mm]
H
e
i
g
h
t

[
m
m
]
Wind velocity blade 2 as a function of position
Figure J.3: Fluid vector elds in the upstream and the wake of the rotor with
blade 2. The x-axis shows the radius of the rotor disk and the y-axis
shows the height above and below the rotor disk.
Fluid velocity to thrust conversion: Fluid velocity measurements are
made under and above the rotor. The momentum theory is then used, with
the average wind velocity v
h
at hover as a parameter, to calculate the ex-
pected thrust. This is then compared with the measured thrust.
The wind velocity measured 10mm under the rotor blades measured is plot-
ted in gure J.5. These measurements are used to calculate the thrust from
each of the two rotor blades, blade 1 and blade 2. On the left and the right
gure J.5 there are two lines plotted. These two lines are used to calculate
the wind velocity under the two rotor blades. The equation for those lines
are shown in table J.1. To calculate the wind velocity the equation for a line
is isolated for x, x = (y b)/a, and the areal equation for a circle, A = r
2
,
are integrated, equation J.14
v
tot
=
_
vtop
0
(
y b
a
)
2
dy (J.14)
142 Momentum theory
Table J.1: Coecients for lines in gure J.5
Blade 1 Blade 2
v
top
6.97m/s 8.49m/s
f
1
(x) y = 0.3105x 12.20 y = 0.3495x 13.4
f
2
(x) y = 0.277x + 40.21 y = 0.6355x + 72.04
The velocity calculated using f
2
(x) is subtracted from f
1
(x), thereby getting
the total velocity under the rotor blades. Now equation J.11 is used to
calculate the thrust.
T = 2A(v
tot
/A)
2
= 2v
2
tot
/A (J.15)
Using this equation with the measured uid velocity at 10mm downstream
gives 2.98N for blade 1 and 2.18N for blade 2. The measured thrust value
at the same angular velocity was 2.35N for blade 1 and 2.49N for blade 2.
Using the uid velocity measurement to derive the thrust thus gives 27%
higher thrust for blade 1, but 12% lower thrust for blade 2.
It is clear that measuring the uid velocity in this way to derive the thrust
by using these calculations is more inaccurate then measuring the thrust
directly. Great care has to be taken when setting up the rig in order to get
more precise measurements. Also, the interval, at which the measurements
are taken, should be reduced to be able to derive a better describing function
for the change in wind velocities along the rotor blade.
143
400 300 200 100 0 100 200 300 400
500
400
300
200
100
0
100
200
300
400
Radius [mm]
H
e
i
g
h
t

[
m
m
]
Wind velocity blade 1 as a function of position
Figure J.4: Fluid vector elds in the upstream and the wake of the rotor with
blade 1. The x-axis shows the radius of the rotor disk and the y-axis
shows the height above and below the rotor disk. The theoretical
radius of the rotor wake far down-stream is r

=
R

2
where R is the
radius of the rotor disk.
20 40 60 80 100 120 140 160 180
2
1
0
1
2
3
4
5
6
7
8
Wind velocity under Blade 1
Radius [mm]
V
e
lo
c
it
y

[
m
/
s
]
Measurements
f1(y)
f2(y)
20 40 60 80 100 120 140 160
6
4
2
0
2
4
6
8
10
12
Wind velocity under Blade 2
Radius [mm]
V
e
lo
c
it
y

[
m
/
s
]
Measurements
f1(y)
f2(y)
Figure J.5
144 Momentum theory
Appendix K
Level shifter simulation
In this appendix the level shifter, used for communication between the ight
controller board and the motor controller board, is introduced and simu-
lated.
The microprocessor on the ight controller board is connected to the SDA1
(data line) and SCL1 (clock line), which is the low voltage (3.3[V ]) side
of the level shifter. The microprocessor on the motor controller board is
connected to the SDA2 and SCL2, which is the high voltage (5[V ]) side of
the level shifter. The bus lines are connected to an N-channel MOS-FET.
Figure K.1 shows the simulation setup in Altium Designer.
Figure K.1: Diagram of the level shifter simulation.
146 Level shifter simulation
The bus lines are pulled up by resistors R
1
, R
2
, R
3
and R
4
. When the
3.3[V ] device pulls the line down the V
gs
(pins 1,2) voltage on the MOS-
FET gets higher than the threshold voltage. This makes the MOS-FET
conduct, thereby pulling the 5[V ] side down. When the 5[V ] device pulls
the line down, the diode between source and drain (pins 2,3) pulls source on
the MOS-FET (pin 2) down until the V
gs
voltage passes the threshold and
the MOS-FET conducts. Thereby the low voltage side is pulled down.
Figure K.2: Simulation results of the level shifter.
To demonstrate the functionality above; two square wave generators, run-
ning with period of 10[s] (100[kHz]) with 5[s] pulse width, are connected
to SDA1 and SCL2. The simulation results are shown in gure K.2, where
SDA1 line (purple) pulls down the SDA2 line (blues) and SCL2 line (green)
pulls down SCL1 line (yellowish).
Appendix L
Schematics and PCB layouts
In this appendix the schematics and PCB (Printed Circuit Board) layouts
made for this project are presented. Two schematics were made and put on
the same board.
Figure L.1 shows the schematics for the two power sources, a 5[V ] and a
3.3[V ] regulators, bluetooth module F2M03GA, IMU (Inertial Measuring
Unit) ADIS16350 and pressure sensor BMP085.
In gure L.2 the PCB (Printed Circuit Board) layout for the schematics in
gure L.1 is shown.
Schematic of the level shifter is shown in gure L.3. In gure L.3 the PCB
layout of the level shifter is shown. The two PCB layouts presented in gures
L.2 and L.4 are combined on the same board shown in gure L.5.
148 Schematics and PCB layouts
1 1
2 2
3 3
4 4
D
D
C
C
B
B
A
A
T
it
le
N
u
m
b
e
r
R
e
v
is
io
n
S
iz
e
A
4
D
a
t
e
:
2
0
/
0
1
/
2
0
0
9
S
h
e
e
t
o
f
F
ile
:
C
:\
D
o
c
u
m
e
n
t
s
a
n
d
S
e
t
t
in
g
s
\..\S
h
e
e
t
1
.S
c
h
D
o
c
D
r
a
w
n
B
y
:
G
N
D
G
N
D
+
5
V
+
3
.3
V
+
5
V
+
5
V
G
N
D
G
N
D
G
N
D
G
N
D
+
3
.3
V
1
2
S
C
L
K
3
D
O
U
T
4
D
I
N
5
C
S
6
D
I
O
0
7
R
S
T
8
D
I
O
1
9
V
C
C
1
0
V
C
C
1
1
V
C
C
1
2
G
N
D
1
3
G
N
D
1
4
G
N
D
1
5
D
N
C
4
1
6
D
N
C
3
1
7
D
N
C
1
1
8
D
N
C
2
1
9
D
A
C
2
0
A
D
C
2
1
Y
A
C
C
L
2
2
X
-
A
C
C
L
2
3
2
4
S
C
L
K
D
O
U
T
D
I
N
C
S
D
I
O
0
R
S
T
D
I
O
1
V
C
C
V
C
C
V
C
C
G
N
D
G
N
D
G
N
D
D
N
C
4
D
N
C
3
D
N
C
1
D
N
C
2
D
A
C
A
D
C
Y
A
C
C
L
X
-
A
C
C
L
U
2
A
D
I
S
1
6
3
5
0
G
N
D
1
E
O
C
2
V
d
d
a
3
V
d
d
d
4
N
C
5
S
C
L
6
S
D
A
7
X
C
L
R
8
G
N
D
E
O
C
V
d
d
a
dd
V
d
d
d
dd
N
C
S
C
L
S
D
A
X
C
L
R
U
3
B
M
P
0
8
5
G
N
D
G
N
D
+
3
.3
V
+
3
.3
V
R
1
R
2
1
2
D
1
G
F
1
M
1
2
D
2
G
F
1
M
I
N
1
G N D
4
G N D
2
O
U
T
3
I
N
G N D
G N D
O
U
T
U
4
M
I
C
5
2
0
9
-
5
.0
I
N
1
G N D
4
G N D
2
O
U
T
3
I
N
G N D
G N D
O
U
T
U
5
M
I
C
5
2
0
9
-
3
.3
G
N
D
V
b
a
t
C
3
C
4
C
1
C
2
+
5
V
+
3
.3
V
G
N
D
G
N
D
1 2
P
4
H
e
a
d
e
r
2
1 2
P
5
H
e
a
d
e
r
2
1 2
P
6
H
e
a
d
e
r
2
1 2 3 4
P
3
H
e
a
d
e
r
4
1 2 3 4 5 6
P
2
H
e
a
d
e
r
6
S
P
I
_
C
L
K
2
S
P
I
_
M
I
S
O
3
S
P
I
_
M
O
S
I
4
S
P
I
_
C
S
B
5
P
C
M
_
C
L
K
6
P
C
M
_
O
U
T
7
P
C
M
_
S
Y
N
C
8
P
C
M
_
I
N
9
R
E
S
E
T
3
5
+
V
_
P
A
2
0
+
V
C
C
3
6
R
T
S
3
1
C
T
S
3
2
R
X
3
3
T
X
3
4
G
N
D
1
G
N
D
1
6
G
N
D
1
7
G
N
D
1
8
P
I
O
[
2
]
2
5
P
I
O
[
3
]
2
6
P
I
O
[
4
]
2
7
P
I
O
[
5
]
2
8
P
I
O
[
6
]
1
0
P
I
O
[
7
]
1
1
P
I
O
[
8
]
1
2
P
I
O
[
9
]
1
3
P
I
O
[
1
0
]
1
4
P
I
O
[
1
1
]
1
5
A
I
O
[
0
]
2
3
A
I
O
[
1
]
2
4
U
S
B
D
-
3
0
U
S
B
D
+
2
9
G
N
D
1
9
G
N
D
2
1
G
N
D
2
2
G
N
D
3
7
S
P
I
_
C
L
K
S
P
I
_
M
I
S
O
S
P
I
_
M
O
S
I
S
P
I
_
C
S
B
P
C
M
_
C
L
K
P
C
M
_
O
U
T
P
C
M
_
S
Y
N
C
P
C
M
_
I
N
R
E
S
E
T
+
V
++
_
P
A
+
V
++
C
C
R
T
S
C
T
CC
S
R
X
T
X
TT G
N
D
G
N
D
G
N
D
G
N
D
P
I
O
[
2
]
P
I
O
[
3
]
P
I
O
[
4
]
44
P
I
O
[
5
]
P
I
O
[
6
]
66
P
I
O
[
7
]
P
I
O
[
8
]
88
P
I
O
[
9
]
99
P
I
O
[
1
0
]
P
I
O
[
1
1
]
A
I
O
[
0
]
00
A
I
O
[
1
]
U
S
B
D
-
U
S
B
D
+
G
N
D
G
N
D
G
N
D
G
N
D
U
1
F
2
M
0
3
G
X
A
C
6
C
5
R
3
R
4
1 2 3
P
1
H
e
a
d
e
r
3
R
X
T
X
R
X
T
X
G
N
D
Figure L.1: Schematic of regulators and sensors.
149
Figure L.2: PCB of regulators and sensors.
150 Schematics and PCB layouts
1 1
2 2
3 3
4 4
D
D
C
C
B
B
A
A
T
it
le
N
u
m
b
e
r
R
e
v
is
io
n
S
iz
e
A
4
D
a
t
e
:
1
7
/
1
2
/
2
0
0
8
S
h
e
e
t
o
f
F
ile
:
C
:\
D
o
c
u
m
e
n
t
s
a
n
d
S
e
t
tin
g
s
\
..
\
S
h
e
e
t
2
.
S
c
h
D
o
c
D
r
a
w
n
B
y
:
D
3
G
1 S
2
Q
1
B
S
N
2
0
D
3
G
1 S
2
Q
2
B
S
N
2
0
R
5
R
6
R
7
R
8
5
V
3
.
3
V
S
D
A
1
S
C
L
1
S
D
A
2
S
C
L
2
1 2
P
1
H
e
a
d
e
r
2
1 2
P
2
H
e
a
d
e
r
2
3
.
3
V
5
V
G
N
D
G
N
D
1 2
P
3
H
e
a
d
e
r
2
S
D
A
1
S
C
L
1
S
D
A
2
S
C
L
2
1
2
3
4
5
6
7
8
P
4
H
e
a
d
e
r
4
X
2
Figure L.3: Schematic of level shifter.
151
Figure L.4: PCB of level shifter.
152 Schematics and PCB layouts
Figure L.5: PCB board.
Appendix M
Functions used in control loop
The three functions adc convert, receiver convert and controllerdy-
namicthrust, that are used when the helicopter is in the state Flight aug-
mented, will be explained in this chapter. The functions are shown as ow
diagrams.
adc convert
The function adc convert is shown in gure M.1. An hardware capture and
compare routine runs constantly with 10[ms] intervals. As this is a hard-
ware routine its use of the micro controller CPU time is trivial. The routine
sets the adc ag each time it has new data to be processed. This ag is
checked when entering the adc convert function. If there are no new data
available, it will not do anything and return false. If there is new adc data
ready to be processed, the adc convert function will convert the raw data
to
rad
s
and then integrate them. When this has been done, the function will
set adc ag to zero and return true.
The whole controller routine period time is thus controlled by the adc ag
as long as the controller can execute all its calculations within the 10[ms].
154 Functions used in control loop
Figure M.1: The ow diagram for the adc convert function.
155
receiver convert
The signals coming from the receiver are PWM signals. The receiver convert
function, which is shown in gure M.2, has to measure these and convert
them into the respective values that are used in the control loop. First the
function checks that all the receiver channels are working. If they are work-
ing it will proceed. Otherwise it will return false.
After checking that all channels are working, the function starts convert-
ing them. The values from the receiver are from 0 to 1. The function will
rst calibrate the values so that their midpoint is set to 0.5. Thereafter it
will check if the values are out of the range 0 1. If they are lower they
will be set to zero, if they are higher they are set to one. Thereafter it will
convert them with respect to their usage. The pitch, roll and yaw values
are converted so that their range is from 0.5 to 0.5. All the other values
keep their range 0 1. As the conversion depends on which value is being
converted, this is coded as a switch-case structure.
controllerdynamicthrust
When controllerdynamicthrust, see gure M.3, is called, both adc data
and receiver data are available. The controller has to calculate the con-
trol signal for each of the four rotors rst. This is done by looping four
times where the angular velocity contributions to the control signal is rst
calculated. Thereafter the angle contributions to the control signal are cal-
culated. These are then multiplied by their respective gains and are nally
added together for the total control signal to the respective rotor. This can
also been seen in gure 7.4 in chapter 7.
When the control signals for all the rotors has been calculated they are
multiplied with Gain. Thereafter they are subtracted from the Receiver
thrust. The resulting servo signals are sent to the motor controllers.
156 Functions used in control loop
Figure M.2: The ow diagram for the receiver convert function.
157
Figure M.3: The ow diagram for the controllerdynamicthrust function.
158 Functions used in control loop
Department of Electrical Engineering
Automation (AU)
Technical University of Denmark
Elektrovej building 326
DK-2800 Kgs. Lyngby
Denmark
www.elektro.dtu.dk/forskning/au
Tel: (+45) 45 25 35 50
Fax: (+45) 45 88 12 95
E-mail: bkp@oersted.dtu.dk

You might also like