adaptive control of a quadcopter in the presence of large ...€¦ · an example for a mav is the...

15
American Institute of Aeronautics and Astronautics 1 Adaptive Control of a Quadcopter in the Presence of large/complete Parameter Uncertainties Michael Achtelik * , Thomas Bierling , Jian Wang , Leonhard Höcht § and Florian Holzapfel ** Institute of Flight System Dynamics, Munich, Germany, 85748 Adaptive control of unmanned aerial vehicles has gained recent interest in the field of flight control. Control algorithms seek to provide robustness in the presence of uncertain parameters, unmodeled dynamics, external disturbances or failure situations. As adaptive control algorithms are a priori designed to account for uncertain system dynamics and determine the system parameters online they provide a promising approach to improve the robustness of the control system w.r.t. parameter uncertainties. In this paper, we present an adaptive attitude controller for a quadcopter utilizing the full dynamic bandwidth of the system. The concept of Model Reference Adaptive Control is used in combination with a nonlinear control structure based on the method of nonlinear, dynamic inversion. Standard robustness modifications are used and adapted to the specific application on the quadcopter in order to ensure long term stability and robustness against unmodeled dynamics as well as external disturbances without persistent excitation. The focus is fast and robust adaption, so that even complete resets of the adaptive system in flight are possible. Further issues like unbounded growth of adaptive gains or integrator wind-ups due to actuator limitations are accounted for in the control structure and are successfully prevented. A small quadcopter is used as experimental platform, which enables the authors to perform real flight experiments without the need for expensive flight tests on larger systems. Therefore, all algorithms are optimized to run at high update rates on the onboard microprocessor hardware. The fast update rates of 1 kHz of the control loops are one key feature to achieve the high performance of the system. The tools based on MATLAB/Simulink to design the control system, the implementation and the optimization for the onboard hardware are presented as well as the quadcopter itself. Experimental results prove that a highly adaptive control system is able to handle a wide variety of external disturbances or parameter changes. To show the capabilities and verify the controller design, flight test results are presented for the following three extreme failure and uncertainty conditions: 1. Simulated power loss of a certain motor; 2. Disturbance due to external weight hung on a quadrocopter arm and cut off during flight; 3. Complete gain resets to zero during flight. The experimental results show that the adaptive controller can adjust fast enough to maintain stability and restore a desired transient performance under these adverse conditions. The presented adaptive control system and the implementation on the quadcopter and its microprocessor hardware using the simple MATLAB/Simulink framework is a starting point for ongoing research and development of adaptive algorithms on Micro Aerial Vehicles. It enables one to perform low cost validation of control algorithms in real flight experiments without the need for intense knowledge of programming languages or hardware design. * External Ph.D. Candidate, CEO Ascending Technologies GmbH, Email: [email protected] Ph.D. Candidate, Email: [email protected], Student Member AIAA Ph.D. Candidate, Email: [email protected], Student Member AIAA § Ph.D. Candidate, Email: [email protected] ** Professor, Email: [email protected], Senior Member AIAA Infotech@Aerospace 2011 29 - 31 March 2011, St. Louis, Missouri AIAA 2011-1485 Copyright © 2011 by Michael Achtelik, Institute of Flight System Dynamics, Technische Universität München. Published by the American Institute of Aeronautics and Astronautics, Inc., with pe

Upload: others

Post on 18-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

1

Adaptive Control of a Quadcopter in the Presence of

large/complete Parameter Uncertainties

Michael Achtelik*, Thomas Bierling†, Jian Wang‡, Leonhard Höcht§ and Florian Holzapfel**

Institute of Flight System Dynamics, Munich, Germany, 85748

Adaptive control of unmanned aerial vehicles has gained recent interest in the field of

flight control. Control algorithms seek to provide robustness in the presence of uncertain

parameters, unmodeled dynamics, external disturbances or failure situations. As adaptive

control algorithms are a priori designed to account for uncertain system dynamics and

determine the system parameters online they provide a promising approach to improve the

robustness of the control system w.r.t. parameter uncertainties. In this paper, we present an

adaptive attitude controller for a quadcopter utilizing the full dynamic bandwidth of the

system. The concept of Model Reference Adaptive Control is used in combination with a

nonlinear control structure based on the method of nonlinear, dynamic inversion. Standard

robustness modifications are used and adapted to the specific application on the quadcopter

in order to ensure long term stability and robustness against unmodeled dynamics as well as

external disturbances without persistent excitation. The focus is fast and robust adaption, so

that even complete resets of the adaptive system in flight are possible. Further issues like

unbounded growth of adaptive gains or integrator wind-ups due to actuator limitations are

accounted for in the control structure and are successfully prevented.

A small quadcopter is used as experimental platform, which enables the authors to perform

real flight experiments without the need for expensive flight tests on larger systems.

Therefore, all algorithms are optimized to run at high update rates on the onboard

microprocessor hardware. The fast update rates of 1 kHz of the control loops are one key

feature to achieve the high performance of the system. The tools based on

MATLAB/Simulink to design the control system, the implementation and the optimization

for the onboard hardware are presented as well as the quadcopter itself.

Experimental results prove that a highly adaptive control system is able to handle a wide

variety of external disturbances or parameter changes. To show the capabilities and verify

the controller design, flight test results are presented for the following three extreme failure

and uncertainty conditions: 1. Simulated power loss of a certain motor; 2. Disturbance due

to external weight hung on a quadrocopter arm and cut off during flight; 3. Complete gain

resets to zero during flight. The experimental results show that the adaptive controller can

adjust fast enough to maintain stability and restore a desired transient performance under

these adverse conditions.

The presented adaptive control system and the implementation on the quadcopter and its

microprocessor hardware using the simple MATLAB/Simulink framework is a starting

point for ongoing research and development of adaptive algorithms on Micro Aerial

Vehicles. It enables one to perform low cost validation of control algorithms in real flight

experiments without the need for intense knowledge of programming languages or hardware

design.

* External Ph.D. Candidate, CEO Ascending Technologies GmbH, Email: [email protected] † Ph.D. Candidate, Email: [email protected], Student Member AIAA ‡ Ph.D. Candidate, Email: [email protected], Student Member AIAA § Ph.D. Candidate, Email: [email protected] ** Professor, Email: [email protected], Senior Member AIAA

Infotech@Aerospace 201129 - 31 March 2011, St. Louis, Missouri

AIAA 2011-1485

Copyright © 2011 by Michael Achtelik, Institute of Flight System Dynamics, Technische Universität München. Published by the American Institute of Aeronautics and Astronautics, Inc., with permission.

Page 2: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

2

I. Introduction

MALL and light-weight flying machines, the so called Micro Aerial Vehicles (MAVs) gained a lot of popularity

in the past years. These flying machines can accomplish a variety of tasks e.g. in the fields of search and rescue,

industrial inspection or observation. Other applications for the small and light-weight flying platforms are in the

field of education and research. Due to the ongoing minimization of powerful computer hardware and the increasing

computing power of micro controllers, MAVs can also be used for a variety of experiments e.g. in the field of

navigation and sensor data fusion or flight control. Compared to flight experiments with manned aircrafts, nearly no

legal permissions are necessary and the time and effort for the experiments is minimized. The small machines can

even tolerate some crashes and can be tested indoors as a kind of “lab flyer”

An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass.

Figure 1 shows a standard quadcopter, available out of the box and ready to fly. The control of the quadcopter is

done only by changing the rotation speed of the propellers. Two of the propellers are spinning clockwise and two

counterclockwise. Having all propellers spinning at the same speed, the angular momentum is balanced in all axes

because of the left and right spinning propellers. To turn around the vertical (yaw) axis for example the right spinning propellers are slowed down and the left spinning propellers are speeded up. The overall thrust stays

constant and as a result of the changing angular momentum, the quadcopter will turn right. The cross (pitch) axis as

well as the front (roll) axes are not affected because the left and right spinning propeller pairs are mounted on the

opposite sites. To turn around the roll axis to the left side for example, the right motor is speeded up and the left

slowed down. As both propellers are spinning in the same direction, the total angular momentum around the yaw

axis is zero and this axis is not affected. Speeding all motors up or down results in ascending or descending, without

effecting pitch, roll and yaw. This control scheme is basically used to “mix” the control signals to the four motors

and to control all axes independently. To generate the control signal and to stabilize the quadcopter, a flight

controller is necessary. For such a control system there are basically two approaches: Many manufactures and

research institutes follow the approach of complex mathematical models and algorithms. Usual update rates of the

control systems are 100 to 200 Hz. Combined with slow motors and big propellers it is possible to control a stable

flight, but just for slow maneuvers. The low update rates demand precise models and exact algorithms because small linearization errors can result in instability. A completely different approach was presented in Ref. 1: All

components are optimized for fast reactions to ensure a continuous update rate of 1 kHz. Based on this high update

rate, high stability, high bandwidth and high maneuverability could be achieved. The intention is now to combine

the high update rate with nonlinear and adaptive control algorithms to utilize the full bandwidth of the system.

This paper is based on Ref. 2, where a second order nonlinear attitude controller based on the concept of

dynamic inversion is shown. The design of this controller leads to an analysis of parameter uncertainties and to an

adaptive control concept. As mentioned above, at first the concept of nonlinear dynamic inversion is applied, which

can be found in standard text books like Ref. 3,4 and was presented in detail in Ref. 5. The idea behind this method,

is to linearize the system for the entire operating range without neglecting nonlinear effects. To do that, a physical

model of the system is dynamically inverted. The result is a dynamically input output linearized system. For the

control algorithm applied on this linearized system, the well known linear methods can be used.

S

Figure 1: Quadcopter

Page 3: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

3

Second, model reference adaptive control (MRAC) is used to compensate for parameter uncertainties. A good

overview of this concept is given in Ref. 6. As the name suggests, the concept is based on a reference model whose

dynamics should be matched by the plant using adaptive elements.

Figure 2 shows a standard structure of a direct MRAC controller. The controller is adjusted by an adaptive law

using the system input r and the controller error ce . The control error is the difference between the system output

Px and the output of the reference model Mx . The reference dynamics can be chosen by the designer, but the choice

has to be physically reasonable and the designer has to be aware of the control authority and dynamic limitations. Based on Lyapunov analysis the adaptive laws are derived, so that stability of the closed loop system is guaranteed

and the error between the plant and the reference dynamics converges to zero asymptotically.

In general, there are two types of MRAC6: Indirect and Direct MRAC. In the direct approach, the control error

ce is used to adapt the controller to compensate for the unknown plant parameters. In the indirect approach, an

identification model is implemented to indentify the unknown parameters which are used to calculate the control

parameters. For the quadcopter controller, the direct approach will be used in this work.

In the following sections an adaptive controller will be derived. As this work is focused on the implementation of the overall system on a flying quadcopter, the needed theoretical background will be given step by step as far as it is

needed for this controller instead of a general overview. However, the MRAC approach has been treated in standard

textbooks on adaptive control and for more detailed information the reader is referred to Ref. 6-9.

II. Hard- and Software Implementation

As flying hardware the quadcopter “AscTec Hummingbird”10, equipped with the “AscTec AutoPilot”10, is used.

This quadcopter is the consequent improvement of the one described in Ref 7 and shown in Figure 1. Using the

small quadcopter for experiments, the time to test new algorithms is minimal as no long planned and expensive

flight tests are necessary. Tests can be made indoors, or even in the hand to test controller reactions. For further

flight tests, a small field is sufficient and no legal permissions are required.

The Flight Control Unit (FCU) on this vehicle is equipped with two ARM 7 60 MHz, 32 Bit microcontrollers.

One controller, the low level processor (LLP) is responsible for all the hardware management and IMU†† sensor data

fusion. A basic attitude controller is implemented as well on this processor. The LLP is delivered as a kind of black

box with clearly defined interfaces to additional components and to the high level processor (HLP). To operate the

quadcopter, only the LLP is necessary. Therefore, the HLP is free for experimental code. All relevant IMU data is

provided at an update rate of 1 kHz via SPI‡‡. Furthermore in case of failures on the HLP a fallback for low level control to the LLP is implemented.

For the programming of the HLP a Software development Kit (SDK) is available featuring all basic functions

and acting as a kind of operating system. This SDK was further developed at the Institute of Flight System

Dynamics together with Ascending Technologies to a framework for quadcopter programming using

MATLAB/Simulink. The HL-SDK provides all tools necessary to program custom C-Code and to flash and debug

the code on the processor. Simulink provides the well known environment for graphical programming and control

system design. Together with MATLAB, it is a very powerful tool for mathematic development and control system

design. Here, it is used to design the control system without the need of programming knowledge. The control

†† IMU: Inertial Measurement Unit ‡‡ SPI: Serial Peripheral Interface is a synchronous serial data link. On the AscTec AutoPilot, it is used for fast chip-

to-chip communication

Figure 2: Direct MRAC

Reference

Model

PlantController

Adaptive

Law

ce

Mx

Pxr u

Page 4: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

4

system is then translated to the C-Code by the Real-Time-Workshop Embedded coder. The Simulink-Quadcopter

Framework provides all templates for the code interfaces between the Simulink controller and the HL-SDK code as

well as the templates for code generation for the target, the HLP. The system is designed to work with fixed point

data types to generate efficient microcontroller C-Code, as microcontrollers of this size and architecture normally

have no floating point unit. To provide the fixed point functionality the Simulink and MATLAB fixed-point toolbox

is necessary. With this toolbox, the fixed point conversion is easy to do, based on physical signal range considerations, either with automatic tools like the fixed-point advisor, or by simply setting relevant data types by

hand.

III. System Dynamics and Uncertainties

As a first step for the design of the control system, the quadcopter dynamics are analyzed as for a reliable controller design, at least the structure of a precise system model hast to be known. In Figure 3, the quadcopter

dynamics are shown:

The four rotational speeds T

1 4n n of the motors result in body fixed moments L, M, N and a total thrust,

defined by the quadcopter geometry and the motor and propeller dynamics. F denotes the thrust of one propeller and

n its rotational speed. kn is a motor and propeller specific constant for the conversion rotational speed to thrust. MProp

denotes the motor torque and can be calculated using the constant km. Both constants are averaged using test bench

data2. Thus the force and moment produced by one motor are given by

2

nF n k (1)

Prop mM  k F (2)

With the lever arm length r the resulting moment at the center of gravity can be denoted by

1

x

2

yB3

z

c

m

4

m m m

0 r 0 r

M r      0 r 0

k k

FM L

FM M

FM k

FkN

(3)

Defined by the angular momentum dynamics, these body fixed moments L , M , and N result in angular

accelerations5:

1

0B G 0B G 0B

K BB K BBc B K

p

q M

r

ω I ω I ω

(4)

The angular rates p, q and r are the inputs for the attitude dynamics, resulting in the attitude angles5 , and :

1 sin tan cos tan p

0 cos sin q  

sin cos r0

cos cos

(5)

Geoemtry/

Propeller

Angular

Momentum

Dynamic

Tnnnn 4321 TNML T

T

Attitude

Dynamic

Trqp

Figure 3: Quadcopter Dynamics

Page 5: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

5

The total thrust T can be neglected for attitude control but is important for position and height control. This

dynamic structure of the quadcopter can easily be analyzed, but parameters like, the moments of inertia, motor and

propeller data are only known vague. Big effort is needed to identify these parameters by experiments or

simulations. It is obvious that the uncertainties are connected to the angular momentum dynamic and two the motor

and propeller parameters in the first block. In contrast, the attitude dynamics are purely trigonometric without any

parameter uncertainty. This leads to the idea of a cascade controller structure with an adaptive rate loop and an attitude controller as outer loop as shown in Figure 4. In the outer loop, no adaptive elements are needed as the inner

loop compensates for the mentioned uncertainties.

IV. Adaptive Rate Loop

In the following, the adaptive rate loop is designed based on a direct MRAC structure.

A. Plant and Reference Dynamics

The plant dynamics are given by the following equation:

*

P p p px = A x + f x ,u (6)

PA describes the linear part of the uncertain plant dynamics. *

pf x ,u is a nonlinear function of the state vector

and the input vector. It describes the nonlinear plant dynamics as well as the influence of the system inputs

T

1 2 3 4u F F F F . *

pf x ,u includes the geometry of the quadcopter, the moments of inertia, as well as the

nonlinear rotational forces based on the equations in section III. At this point, the linear correlation between

propeller thrust and moment (Eq.(2)) is important. The equation can be split into a linear and a nonlinear part:

2 4-1

G 0B G 0B

BB 1 3 K BB K

m m m m

2 4-1 -1

G

*

G 0B G 0B ' **

BB 1 3 BB K BB K P p

m m m m

p

0 r 0 r

= I r      0 r 0 u ω × I ω

k k k k

0 r 0 r

I r      0 r 0 u -I ω × I ω B u + f

f x ,u

k

x

k k k

(7)

As the structure of '

PB is known, the following simplification can be made:

11

22'

P P

33

44

0

λ 0 0 00 1 0 1

0 λ 0 0B = B Λ = 1      0 1 0

0 0 λ 01 1 1 1

0 0 0 λ

(8)

It is important that the motor thrusts are used as input values. In the end rotational speeds are commanded to the

motors, which can be calculated by Eq. (1). The constant mk is again an uncertainty, but its linear effect can be

Figure 4: Cascade Controller Structure

Attitude loop

T

cmdp q r

T

cmd MRAC

Rate loop

Tnnnn 4321 Plant:

Quadcopter

T

p q r

T

Page 6: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

6

compensated by . In the next step, the nonlinear part **

Pf (x ) can be simplified and reshaped. At this point, the

used coordinate system is assumed to be a principal system because of the quadcopter’s symmetry. Thus, the inertia

tensor has diagonal shape, i.e. all the products of inertia are zero.

xx-1 -1

** G 0B G 0B G

p BB K BB K BB yy

zz

xx zz yy

yy xx zz P p

zz yy xx

p I 0 0 p

f x = -I ω × I ω -I q 0 I 0 q

r 0 0 I r

1 / I (I I ) 0 0 rq

0 1 / I (I I ) 0 rp α f x

0 0 1 / I (I I ) pq

(9)

As an additional uncertainty, a constant disturbance is added here. The constant disturbance d is written by

D i with T

i 1 1 1 to have a similar structure of matrix times vector for all parts of the equation.

P P P P P P

D i

x = A x + B Λu +α f x + d (10)

So the problem is to identify or compensate the uncertain parameters PA , Pα and d . The objective is to find a

control-law and the corresponding adaptive laws in order to make the plant behavior match the reference dynamics.

B. Adaptive Control Laws

The following control law is used with x,r, ,dΘ

as adaptive gains:

x P r α P d

3 13 14 3 4 34 3 3 1 4 3 3 1

u = Θ x + Θ r + Θ f x i+ Θ

(11)

Applying the control law on the plant dynamics leads to the closed loop structure:

P P P P x P r α P d P P

P P x P P r P α P P P P d

x A x + B Λ Θ x +Θ r +Θ  f x +Θ i + α f x + D i

A + B ΛΘ x + B ΛΘ r + B ΛΘ  f x + α f ix + B ΛΘ +D i

(12)

The following stable reference model is used:

q q

p p

M cmdrM r

1 / T 0 0 p 1 / T 0 0 p

0 1 / T 0 q 0 1 / T 0 q

0 0 1 / T r 0 0 1r / r

q

T

p

(13)

M M M Mx = A x + B r + 0 + 0 (14)

Page 7: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

7

By comparing the reference and the closed loop dynamics, the matching condition can be derived. Therefore, the

existence of ideal parameters, marked by ()*, is assumed, so that the plant will match the reference dynamics.

* *

P P x M P M P xA + B ΛΘ = A    A = A -B ΛΘ (15)

*

M P rB = B ΛΘ (16)

Pwith f x 0* *

P α P P P P P α0 = B ΛΘ  f x +α f x     α = -B ΛΘ

(17)

* i 0 *

P d P dB ΛΘ +D i = 0  B ΛΘi D = - (18)

The matching conditions now can be inserted in the error dynamics resulting in:

* * * *

c p M M P M P x x P P r r P α α P P d d= - = A x - x + B Λ Θ -Θ x +B Λ Θ -Θ r + B Λ Θ -Θ  f xe x + B Λ Θ -x iΘ (19)

With the parameter error expressed by *Θ=Θ-Θ and the definition of the control error c P Me x x the error

dynamics can be written as:

c M c P x P P r P α P P de = A e + B ΛΘ x +B ΛΘ r +B ΛΘ  f x + B Λ iΘ (20)

This equation is the basis to find adaptive laws for the gains which ensure stability of the control error and the

adaptive gains themselves.

With a symmetric positive definite matrix P and the symmetric, positive definite adaption rate matrixes dx,r,α,Γ

the following Lyapunov function candidate is chosen based on Ref. 7.

T T -1 T -1 T -1 T -1

c c x x x r r r α α α d d d1 1 1 1 1V e Pe Tr Θ Γ Θ Λ Tr Θ Γ Θ Λ Tr Θ Γ Θ Λ Tr Θ Γ Θ Λ

2 2 2 2 2 (21)

Deriving w.r.t. time and using the Lyapunov equation T

M M 0A P + PA = -Q to replace the term T

M MA P + PA by

0-Q leads to the adaptive laws to ensure that V is negative semi definite:

*x

*r

α*

*D

T T

x x P c P

T T

r r

=0

x x

=0

r r

=0

α α α α

Θ*

x x

Θ*

P c

TT

α α P c P

T

d d P c

r r

Θ*

Θ*

d d

=0

d d

Θ = -Γ B Pe x

Θ = -Γ B Pe

Θ = Θ =

Θ = Θ =

Θ = Θ =

r

Θ = -Γ B

Θ -Θ

Θ -Θ

Θ -Θ Pe f x

Θ = -Γ BΘ = Θ = e iΘ -Θ P

(22)

The adaptive behavior can be adjusted by x,r, ,d and P, respective 0Q . At this point, stability is shown because

of x rc d, , , ) 0V(e , . But there is no asymptotic stability shown yet. That means until now neither

convergence of the control error to zero, nor convergence of the adaptive parameters to their true values can be

concluded. According to Ref. 7, convergence of the parameters to their true values cannot be followed and convergence of the parameters can only be achieved if the system is persistently excited. However, convergence of

the control error to zero can be followed from Barbalat’s Lemma7,11.

In conclusion, it can be shown that using the adaptive laws in Eq. (22) the error dynamics are asymptotically

stable, but there is no convergence of the parameters to their true values7.

Page 8: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

8

V. Attitude Loop

To design the attitude loop (see Figure 4), the concept of nonlinear, dynamic inversion5 was chosen. The needed

correlation between the attitude angles and the body fixed angular rates is given by Eq.(5). As stated before, this

dynamics are independent of model parameters and thus has no model uncertainties. The performance is highly

dependent on the rate loop which was previously designed by the adaptive controller to compensate for model

uncertainties.

The attitude angles are defined as system states and outputs:

T

x y (23)

The input signals are the commanded angular rates:

T

c c c cu p q r (24)

To follow the formalism of nonlinear inversion, the system can now be rewritten in state space representation

and already has canonical form:

1 1 1 2 1 2 1

2 1 2

3 3 1 1

2

3

2 2

y x 1 sin x tan x cosx tan x u

x cosx sin u

y x sin x cosx u0

cosx co

y 0

sx

(25)

It is obvious, that all first and only the first derivatives of the outputs are influenced by the inputs. Thus, the

system has three times relative degree one5. As the system also has only three states, there is no internal dynamics.

C. Inversion of the Attitude Dynamics

The following pseudo controls are defined:

T

1 2 3 pc

T

pc pcν (26)

The linearizing state feedback, the inversion of Eq. (25) and can be used for the implementation:

pc

c pc

c

c pc

2

c 1 1 2

1 1 2

p 1 0 sin

q 0 cos sin cos

r 0 sin cos cos

1 0 sin x

u 0 cosx sin x cosx ν

0 sin x cosx cosx

(27)

D. Reference Model To generate the reference trajectories, a first order reference model is needed, as only the first derivatives of the

attitude angles can be commanded through the inversion:

i,ref i,cmd i,refy 1/ T y y (28)

E. Error Control Because the system is input output linearized, a simple linear error controller can be used. In the attitude loop no

modeling error has to be compensated as the inversion is purely trigonometric. But errors might also occur due to

numerical or sensor errors. This errors lead to a difference between the first derivatives of the outputs y and the

pseudo controls ν . This difference is propagated to the outputs by the one integration of the relative-degree-one

Page 9: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

9

system and will result in a deviation between the commanded reference value and the system output as the system is

not stable because of the pole in the origin of the complex plane caused by the integrator. Therefore the stabilizing

error controller is needed.

The error dynamics can be interpreted as first order lag. A stable eigendynamic can be set by Pk 1/ T , where

the Time constant T is chosen based on considerations on the achievable system dynamics.

i p i i

excitationeigendynamic

e k e x (29)

In addition, the error controller can be extended by adding an integrator for steady state accuracy. The error

controller is now expressed by:

ref p i

ey k e ks

(30)

F. Pseudo Control Hedging The concept of pseudo control hedging is presented in Ref. 12 to account for the actuator dynamics and for

actuator saturation. In this case, the inner loop is seen like an actuator for the outer loop. So the idea is to use the

measured angular rates in the inner loop to propagate the attitude and slow down the reference model if necessary.

Using this concept, it should be possible to reduce the time scale separation without the risk of instability caused by

actuator saturation. Furthermore, pseudo control hedging hides the actuator dynamics from the error dynamics5.

Therefore, actuator saturations will not cause integrator wind ups or unbounded growth of adaptive elements as the

reference model will not command any values, the system cannot follow. The effects on the robustness of the adaptive laws will be addressed later in section VI. But the drawback is that using pseudo control hedging stability

of the reference model cannot directly be followed by the choice of the reference model parameters because the

reference model is now strongly influenced by the model, the actuator dynamics, and actuator saturations.

For the pseudo control hedging equations, the difference between actuator state and actuator command is marked

by the index “c”. The difference between the real model dynamics and the assumed model dynamic are marked by ^

for the assumed dynamics.

c c

mod elling _ errorreference _ signal deviation _ due _ to _ actuatorssystem _ output

ˆy x,u ν x,u Δ x,u y x,u ν x,u (31)

So the hedging signal can be calculated as follows:

c

hedge ref

F̂ x,uF̂ x,u

re

u

f

1 sin tan cos tan p

cos sin q

sin cos r0

cos c

ν

o

ν

s

ˆν ν

0

(32)

This hedge signal is used to slow done the reference model by the expected reaction deficit:

i,ref i,cmd i,ref i,hedgey 1/ T y y (33)

Page 10: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

10

VI. Robustness Modifications

After empirically tuning of the adaption rates, all adaptive gains adapted to match the quadcopter dynamics.

Even complete parameter resets during a flight are possible. But a stable flight was not possible longer than 30 s.

After this time, the adaptive gains started to drift away until the quadcopter became unstable. The reasons are

unmatched uncertainties, unmatched dynamics, or sensor noise. To increase robustness against these effects, there

are basically two methods, presented in Ref. 7. One is the persistent excitation of the input command, and the other

is a modification of the adaptive laws. For an aircraft, the concept of persistent excitation can be used for parameter

identification purposes. For the control task, the input command is issued by the pilot and depends on the desired

flight path and not on a pattern specially designed for robustness. However, there are methods for persistent

excitation of internal signals or signals which do not influence the desired flight path and pilot commands7. For the quadcopter application, the topic of robustness is addressed in the following by modifications of the adaptive laws.

G. Dead Zone

The adaption is switched off, if the control error is smaller than the predefined bound i,maxe . The problem is to

find a reasonable bound as it implies a tradeoff between robustness and performance. The more conservative the

bound is, the larger the control error will remain. For the quadcopter application, the dead zone modification is used

to eliminate the effects of sensor noise on the adaption. A reasonable value was determined based on the stored

sensor signals during a test flight in stable hover conditions. The dead zone is set to +/- 0.2 rad/sbased on the

measured sensor data shown in Figure 5.

H. Bound on the Parameters

The next concept is to limit the parameters. To do that, meaningful bounds need to be known. This requires a

good knowledge about the uncertainties and the modeled system as well. Furthermore, a bound on the parameters

does not solve the problem of parameter drift. For the quadcopter application no bound is used because it would hide

the real performance of the system. It is the aim to find adaption rates and robustness modifications so that no

parameter bound is necessary. Of course, for “real” flight applications the parameters should be bounded, e. g. based

on simulations or experimental results. Furthermore the switching of the adaptive gains should to be implemented in

a smooth way like presented in Ref. 8.

I. σ-Modification and e-Modification For the σ-modification an additional damping term is added to the adaptive law. With the additional parameter,

the adaptive law becomes:

T T

x x P c xP xΘ = -Γ B Pe Γ Θx (34)

A drawback of this modification is that the term x xΓ Θ acts as forgetting factor: As long as the error is close to

zero, this term is the active part in the adaptive law, drawing the adaptive gains back to zero. This problem occurs

e.g. if the reference command is constant during a long period

To solve the problem of the σ-Modification that the adaptive gains are drawn back to zero if the error is close to

zero, the modification can be implemented in a switching way. Such a scheme is suggested e.g. in Ref. 8. Another

approach, suggested in Ref. 7 is to scale the damping term by the norm of the control error:

T T

x x P c P x xΘ = -Γ B Pe x Γ Θe (35)

Figure 5: Sensor Noise

30 30.5 31 31.5 32 32.5 33 33.5 34 34.5 35-0.4

-0.2

0

0.2

0.4

Time [s]

IMU

(p,q

, r)

[ra

d/s

]

IMU_Phi_Theta_Psi

Page 11: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

11

Like the σ-Modification, the e-Modification was implemented on the quadcopter. The choice of the design

parameter σ states a problem as it determines the robustness w.r.t. unmatched and nonparametric uncertainties. For

the quadcopter it was chosen empirical. The adaptive gains were monitored during the flight. A σ set too small still

allowed the gains to drift. The result was instability over time if the input command was not persistently excited. σ

set to large limited the adaptive performance of the system.

In general, the modification works well. But a problem appeared if the quadcopter is flying in a stable hover flight and is then excited in only one axis: As long as the quadcopter is not excited the error is close to zero. The e-

modification is not active and the parameters are nearly constant. Once the system is excited in one axis, the error is

not close to zero anymore, the e-modification is active and the adaptive gains in the other axis converge to zero as

the damping term in the adaptive law is dominant. For the adaptive gains rΘ , this problem is even more relevant,

because the damping term in the adaptive law is proportional to the norm of the error and the first term is

proportional to the input command. (See Eq. (36)). The norm of the error can be increased by an error in all axes of

the quadcopter but the adaptive gains for a certain axis depend on the input command in this axis.

T

r r

T

P c r rΘ = -Γ B Pe Γ Θr e (36)

If the quadcopter is excited e.g. in the body fixed x-axis by an input command, resulting in a control error, the

column relevant for the y-axis of the adaptive gain matrix rΘ will converge close to zero.

J. Axis separation of the e-Modification

To avoid the problem described above, the e-modification was separated for the different axes. Instead of scaling

the damping term by the norm of the error, it is now additionally scaled by the absolute value of the error in each

control axis:

T T

x x P c P x x

x

y

z

e 0 0

0 e 0

0 0

Θ = -Γ B Pe x Γ e Θ

e

(37)

This new modification was applied on all adaptive gains. As far as the test could be made with the quadcopter,

this modification combined with a dead zone on the control error ensures robustness and stability over all tested

flight situations. Results of the performed test flights are summarized in section VII.

K. Pseudo Control Hedging in the Attitude Loop

Applying the robustness modification as described above, stable and robust flights in all situations, controllable

by the pilot are possible. Even complete parameter resets during the flight were performed. But a general problem

for adaptive systems still exists: If the adaption in an aircraft is activated on the ground, far too big adaptive gains

will be the result. The same happens on the quadcopter. Once the quadcopter hits the ground or touches an obstacle,

the obstacle is adapted and the parameters increase far too high for normal flight. In most cases these high parameters were drawn back by the damping terms in the adaptive laws. But starting from the ground or landing

with the adaption activated was not possible. Starting with the adaption switched off and activating the adaption in

flight was not possible either, because the parameters are all initialized to zero. Until now, it is only possible to hold

the quadcopter loosely in the hand, switch the adaption on and start out of the hand. Of course one solution would be

to initialize and limit the parameters to reasonable values, but the general idea was to build and initialize the

adaptive system without parameter knowledge. The source of the problem is that any small error in the attitude loop

will command an angular rate to the adaptive rate loop to compensate for the error. If the quadcopter is fixed on the

ground or hits an obstacle, the actuators are not strong enough to compensate for that. The actuators are saturated

and the error controller still commands an angular rate. The result is that an integrator in the attitude error controller

will wind up and the adaptive gains will grow unbounded.

The concept of pseudo control hedging was introduced in Ref. 5,12 to solve these problems. Pseudo control hedging hides the actuator dynamics from the error dynamics. This is exactly what is necessary here. Due to the

cascade structure of the attitude controller in this chapter, the adaptive rate loop is seen like an actuator for the

attitude loop. The pseudo control hedging described in section V for the attitude loop hides the dynamics and

saturations of the rate loop from the attitude loop error controller. Thus, the error controller will no longer command

any angular rates, the rate loop cannot follow. Herewith, not only the integrator in the error controller is protected

Page 12: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

12

from windups but also the adaptive gains from unbounded growth caused by actuator saturations. The results are

shown in the plots in the following section.

VII. Flight Test Results

In this section, the performance of the adaptive system is summarized and shown by plots of flight experiments.

Due to the combination of the robustness modifications, the adaptive rates could be tuned further based on

experimental results. The following adaption rates and robustness modifications are used:

Adaption rates:

x r d

50 0 0 20 0 0 5 0 0 20 0 0

Γ 0 50 0 ,Γ 0 20 0 ,Γ 0 5 0 ,Γ 0 20 0

0 0 50 0 0 20 0 0 5 0 0 20

(38)

Axis separated e-modification: x 3,4 ,

r 1,2 , 1 , d 0.5

Error Dead zone: x y zDeadZone DeadZone DeadZone 0.2rad

L. Parameter Convergence

In Figure 6, the elements of the adaptive gain matrix xΘ are shown together with the pilot’s command signal.

For better visibility, the command signals of are scaled by 1/5. In this experiment, the input signals are either

persistently excited or constant for some time. At the beginning of the experiment, all gains were initialized to zero and the quadcopter started from the ground with the adaptive controller engaged. In the plots, activity of the

adaptive gains is visible once the corresponding axis is excited by the input command. In non excited phases, the

gains seem to be stable and are not drifting away once they have converged to their final value close to 0.2 for the x-

and y-axes and 0.5 for the z-axis.

The adaptive gains rΘ show similar behavior like xΘ while dΘ and Θ show only little activity in standard

flight situations.

M. Input Signal Tracking

Figure 7 shows the ability of the controller to track a commanded input signal. The shown data is again from the

same test flight as the adaptive gains shown in the previous plot. The plots show a nearly perfect tracking of the

Figure 6: Adaptive Gains xΘ

50 100 150 200 250-0.4

-0.2

0

0.2

0.4

Theta

X,

x

50 100 150 200 250-0.4

-0.2

0

0.2

0.4

Theta

X,

y

50 100 150 200 250

-0.5

0

0.5

Theta

X,z

50 100 150 200 250

-0.5

0

0.5

1

Time [s]

Att

itude c

om

mand [

rad]

Phi

Theta

Psi/5

Motor 1

Motor 2

Motor 3

Motor 4

Motor 1

Motor 2

Motor 3

Motor 4

Motor 1

Motor 2

Motor 3

Motor 4

Page 13: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

13

commanded signals in the three control axes , and . In the plots, the pilots stick command is plotted together

with the attitude loop’s reference model signal and the IMU sensor measurement.

N. System Parameter Changes or External Disturbances

To show the system’s reaction on parameter changes, a switch on the remote control is programmed to divide the

output command signal of one motor by two. Figure 8 shows the logged data of this experiment. In the first plot, the

pilots command, the reference signal and the IMU measurement for the attitude angle are shown. The second plot

shows the adaptive gains dΘ . These are the adaptive gains to compensate for constant disturbances acting similar to

an error controller with integrator. The difference to the integrator in the attitude loop error controller is that these

adaptive gains are separated for each motor and not for control axes. In the third plot, the signal scaling of the motor command is shown.

In the experiment, at first the “disturbance” was activated. The adaptive gains compensated this disturbance from

the beginning on and converged to the values shown at t=35 s in the plot. It is obvious that one motor, the one which

Figure 8: Scale Motor Signal, System Reaction

35 40 45 50 55 60 65 70 75 80-0.5

0

0.5

Phi [r

ad]

ATT_Phi Stick/Ref/IMU [rad]

35 40 45 50 55 60 65 70 75 80

0.5

1

Scale

moto

r

scale Motor cmd35 40 45 50 55 60 65 70 75 80

-0.2

0

0.2

Time [s]

Theta

D,

x

MRAC Theta D

Sensor

Reference

Stick

Motor 1

Motor 2

Motor 3

Motor 4

Figure 7: Input Signal Tracking

150 160 170 180 190 200 210

-0.5

0

0.5

Phi [r

ad]

Ref_mdl_Phi

150 160 170 180 190 200 210

-0.5

0

0.5

Theta

[ra

d]

Ref_mdl_Yaw

150 160 170 180 190 200 2100

2

4

6

Time [s]

Psi [r

ad]

Ref_mdl_Yaw

Reference

Sensor

Stick

Reference

Sensor

Stick

Reference

Sensor

Stick

Page 14: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

14

is scaled, has a higher gain to compensate for the missing power. Once the disturbance is switched off (t≈38s), all

the gains converge to similar values (close to zero). The reaction on the disturbance is obvious. Once it is switched

on again (t≈71s) the gains adapt back to the old values. In the first plot, the attitude reaction is shown. At the time

the disturbance is switched on or off, a short disturbance in the attitude is visible until the gains have adapted to the

new situation. Once the gains have adapted to the disturbance the tracking of the system is as good as before. A

similar, but more impressive experiment was performed having the “external disturbance” hang on one motor like shown in Figure 9 and cutting it off during flight. The result is similar to the one shown for motor scaling above.

O. In-flight Parameter Reset

The final experiment is the parameter reset in flight. The results are shown in Figure 10: At about 67 s, all

adaptive gains were reset to zero and the adaption activated again. The plot shows the attitude reaction in the axis

compared to the pilots command as well as the first two columns of the adaptive gain matrix xΘ , the most critical

part of the adaptive controller. During the parameter reset, the attitude error in the axis grows up to about 0,4 rad

(= 22°) and is compensated within split seconds by the reactivated adaptive controller. This experiment proves the performance of the adaptive system and how fast it can adapt the quadcopter’s dynamics.

Figure 10: In-flight Parameter Reset

50 55 60 65 70 75 80 85 90-0.5

0

0.5

Phi [r

ad]

Attitude Theta: Stick-Ref-IMU [rad]

50 55 60 65 70 75 80 85-0.4

-0.2

0

0.2

0.4

Theta

X,

x

MRAC, Theta_ X (2. colum, theta)

50 55 60 65 70 75 80 85-0.4

-0.2

0

0.2

0.4

Time [s]

Theta

X,

y

MRAC, Theta_ R (2. colum, theta)

Sensor

Reference

Stick

Motor 1

Motor 2

Motor 3

Motor 4

Motor 1

Motor 2

Motor 3

Motor 4

Figure 9: External Disturbance by Hanging a Weight on one Motor

Page 15: Adaptive Control of a Quadcopter in the Presence of large ...€¦ · An example for a MAV is the quadcopter, a helicopter driven by for rotors, symmetric to the center of mass. Figure

American Institute of Aeronautics and Astronautics

15

VIII. Conclusion

Especially the last experiment, the complete parameter reset in flight proofs the performance of the implemented

quadcopter controller and the enormous potential of adaptive systems. However there are still robustness issues to

solve leading to a bound on the adaptive gains for real flight situations. Therefore, the described adaptive controller

and its implementation on the quadcopter will remain experimental but is meant to be a good starting point to

perform experiments in real flight situations without legal considerations. The presented concept of using well

known tools like MATLAB/Simulink on a small MAV Hardware should provide an opportunity for students and

researchers to easily get in touch with real flight experiments.

Acknowledgments

We like to thank The Mathworks and the Team of Ascending Technologies for their great cooperation

concerning the Simulink framework and the quadcopter hardware.

References 1Gurdan, D., Stumpf, J., Achtelik, M. Doth, K.-M., Hirzinger, G., and Rus, D., “Energy-efficient Autonomous Four-rotor

Flying Robot”, IEEE ICRA 2008 2Achtelik M., “Nonlinear and Adaptive Control of a Quadcopter”, Diploma Thesis, Technische Universität München, 2010 3Khalil, H. K., “Nonlinear Systems”, Pertinence-Hall, Englewood Cliffs, NJ, 1996. 4Isidori, A., “Nonlinear Control Systems”, Springer, London, 2001. 5Holzapfel F. „Nichtlineare adaptive Regelung eines unbemannten Flugzeuges“, Ph.D. Dissertation, Technische Universität

München,2004 6Bierling, T., Höcht, L., and Holzapfel, F., “Comparative Analysis of MRAC Architectures in a Unified Framework”, AIAA

Guidance, Navigation, and Control Conference, 2010 7Narendra, K. S., and Annaswamy, A. M., “Stable Adaptive Systems”, Pertinence-Hall, Englewood Cliffs, NJ, 1989. 8Ioannou, P. A., and Fidan, B., “Adaptive Control Tutorial”, SIAM, 2006. 9Ioannou, P. A., and Sun, J., “Robust Adaptive Control”, Pertinence-Hall, Englewood Cliffs, NJ, 1996. 10Ascending Technologies GmbH, website, http://www.asctec.de. 11Slotine, J. J. E., and Li, W., “Applied Nonlinear Control”, Pertinence-Hall, Englewood Cliffs, NJ, 1991. 12Johnson, E. N., “Limited Authority Adaptive Flight Control”, Ph.D. Dissertation, Georgia Institute of Technology, 2000.