Professional Documents
Culture Documents
Quadcopter Paper PDF
Quadcopter Paper PDF
Randal W. Beard
Brigham Young University
October 3, 2008
Reference Frames
This section describes the various reference frames and coordinate systems that
are used to describe the position of orientation of aircraft, and the transformation
between these coordinate systems. It is necessary to use several different coordinate systems for the following reasons:
Newtons equations of motion are given the coordinate frame attached to
the quadrotor.
Aerodynamics forces and torques are applied in the body frame.
On-board sensors like accelerometers and rate gyros measure information
with respect to the body frame. Alternatively, GPS measures position,
ground speed, and course angle with respect to the inertial frame.
Most mission requirements like loiter points and flight trajectories, are specified in the inertial frame. In addition, map information is also given in an
inertial frame.
One coordinate frame is transformed into another through two basic operations: rotations and translations. Section 1.1 develops describes rotation matrices
and their use in transforming between coordinate frames. Section 1.2 describes
the specific coordinate frames used for micro air vehicle systems. In Section 1.3
we derive the Coriolis formula which is the basis for transformations between
between between translating and rotating frames.
1.1
Rotation Matrices
Figure 1: Rotation in 2D
vector p can be expressed in both the F 0 frame (specified by (i0 , j 0 , k0 )) and in
the F 1 frame (specified by (i1 , j 1 , k1 )). In the F 0 frame we have
p = p0xi0 + p0y j 0 + p0z k0 .
Alternatively in the F 1 frame we have
p = p1xi1 + p1y j 1 + p1z k1 .
Setting these two expressions equal to each other gives
p1xi1 + p1y j 1 + p1z k1 = p0xi0 + p0y j 0 + p0z k0 .
Taking the dot product of both sides with i1 , j 1 , and k1 respectively, and stacking
the result into matrix form gives
1 1 0 1 0 1 0 0
i i i j i k
px
px
4
1
1
1
0
1
0
1
0
p0y .
p = py = j i j j j k
1
p0z
pz
k1 i0 k1 j 0 k1 k0
From the geometry of Figure 1 we get
p1 = R01 p0 ,
2
(1)
where
cos() sin() 0
4
R01 = sin() cos() 0 .
0
0
1
The notation R01 is used to denote a rotation matrix from coordinate frame F 0 to
coordinate frame F 1 .
Proceeding in a similar way, a right-handed rotation of the coordinate system
about the y-axis gives
cos() 0 sin()
4
1
0 ,
R01 = 0
sin() 0 cos()
and a right-handed rotation of the coordinate system about the x-axis resultes in
1
0
0
4
R01 = 0 cos() sin() .
0 sin() cos()
As pointed out in [1], the negative sign on the sin term appears above the line with
only ones and zeros.
The matrix R01 in the above equations are examples of a more general class of
rotation matrices that have the following properties:
P.1. (Rab )1 = (Rab )T = Rba .
P.2. Rbc Rab = Rac .
P.3. det Rab = 1.
In the derivation of Equation (1) note that the vector p remains constant and
the new coordinate frame F 1 was obtained by rotating F 0 through a rightedhanded rotation of angle .
We will now derive a formula, called the rotation formula that performs a
left-handed rotation of a vector p about another vector n
by an angle of . Our
derivation follows that given in [1]. Consider Figure 2 which is similar to Figure
1.2-2 in [1]. The vector p is rotated, in a left-handed sense, about a unit vector n
~
that the length N Q equals the length N P which is equal to p ON we get
that
p (p n
) n
N Q cos
N~W =
kp (p n
) n
k
= (p (p n
) n
) cos .
The vector W~Q is perpendicular to both p and n
and has length N Q sin . Noting
that N Q = kpk sin we get
pn
N Q sin
kpk sin
=
n p sin .
W~Q =
(3)
cos sin 0
= sin cos 0 p0
0
0
1
= R01 p0 .
Note that the rotation matrix R01 can be interpreted in two different ways. The
first interpretation is that it transforms the fixed vector p from an expression in
frame F 0 to an expression in frame F 1 where F 1 has been obtained from F 0
by a right-handed rotation. The second interpretation is that it rotates a vector
p though a left-handed rotation to a new vector q in the same reference frame.
Right-handed rotations of vectors are obtained by using (R01 )T .
1.2
For quadrotors there are several coordinate systems that are of interest. In this
section we will define and describe the following coordinate frames: the inertial
frame, the vehicle frame, the vehicle-1 frame, the vehicle-2 frame, and the body
frame. Throughout the book we assume a flat, non-rotating earth: a valid assumption for quadrotors.
1.2.1 The inertial frame F i .
The inertial coordinate system is an earth fixed coordinate system with origin at
the defined home location. As shown in Figure 4, the unit vector ii is directed
North, j i is directed East, and ki is directed toward the center of the earth.
Figure 4: The inertial coordinate frame. The x-axis points North, the y-axis points
East, and the z-axis points into the Earth.
Figure 5: The vehicle coordinate frame. The x-axis points North, the y-axis points
East, and the z-axis points into the Earth.
Figure 6: The vehicle-1 frame. If the roll and pitch angels are zero, then the x-axis
points out the nose of the airframe, the y-axis points out the right wing, and the
z-axis points into the Earth.
of the airframe, j v1 points out the right wing, and kv1 is aligned with kv and points
into the earth. The vehicle-1 frame is shown in Figure 6.
The transformation from F v to F v1 is given by
pv1 = Rvv1 ()pv ,
where
cos sin 0
Rvv1 () = sin cos 0 .
0
0
1
Figure 7: The vehicle-2 frame. If the roll angel is zero, then the x-axis points out
the nose of the airframe, the y-axis points out the right wing, and the z-axis points
out the belly.
The transformation from F v1 to F v2 is given by
v2
pv2 = Rv1
()pv1 ,
where
cos 0 sin
v2
1
0 .
Rv1
() = 0
sin 0 cos
Figure 8: The body frame. The x-axis points out the nose of the airframe, the
y-axis points out the right wing, and the z-axis points out the belly.
where
1
0
0
b
Rv2
() = 0 cos sin .
0 sin cos
The transformation from the vehicle frame to the body frame is given by
b
v2
Rvb (, , ) = Rv2
()Rv1
()Rvv1 ()
1
0
0
cos 0 sin
cos sin 0
1
0 sin cos 0
= 0 cos sin 0
0 sin cos
sin 0 cos
0
0
1
cc
cs
s
= ssc cs sss + cc sc ,
csc + ss css sc cc
4
1.3
Equation of Coriolis
d
p
dti
we get
d
d
p=
p.
dti
dtb
(4)
On the other hand, assume that p is fixed in F b but that F b is rotating with respect
to F i , and let s be the instantaneous axis of rotation and the (right-handed)
rotation angle. Then the rotation formula (3) gives
p + p = (1 cos())
s(
s p) + cos()p sin()
s p.
Using a small angle approximation and dividing both sides by t gives
p
s p.
t
t
Taking the limit as t 0 and defining the angular velocity of F b with respect to
4
F i as b/i = s we get
d
p = b/i p.
(5)
dti
Since differentiation is a linear operator we can combine Equations (4) and (5) to
obtain
d
d
p=
p + b/i p,
(6)
dti
dtb
which is the equation of Coriolis.
10
In this chapter we derive the expressions for the kinematics and the dynamics of a
rigid body. While the expressions derived in this chapter are general to any rigid
body, we will use notation and coordinate frames that are typical in the aeronautics
literature. In particular, in Section 2.1 we define the notation that will be used for
the state variables of a quadrotor. In Section 2.2 we derive the expressions for the
kinematics, and in Section 2.3 we derive the dynamics.
2.1
The state variables of the quadrotor are the following twelve quantities
pn = the inertial (north) position of the quadrotor along ii in F i ,
pe = the inertial (east) position of the quadrotor along j i in F i ,
h = the altitude of the aircraft measured along ki in F i ,
u = the body frame velocity measured along ib in F b ,
v = the body frame velocity measured along j b in F b ,
w = the body frame velocity measured along kb in F b ,
= the roll angle defined with respect to F v2 ,
= the pitch angle defined with respect to F v1 ,
= the yaw angle defined with respect to F v ,
p = the roll rate measured along ib in F b ,
q = the pitch rate measured along j b in F b ,
r = the yaw rate measured along kb in F b .
The state variables are shown schematically in Figure 10. The position (pn , pe , h)
of the quadrotor is given in the inertial frame, with positive h defined along the
negative Z axis in the inertial frame. The velocity (u, v, w) and the angular velocity (p, q, r) of the quadrotor are given with respect to the body frame. The Euler
angles (roll , pitch , and yaw ) are given with respect to the vehicle 2-frame,
the vehicle 1-frame, and the vehicle frame respectively.
11
2.2
Quadrotor Kinematics
The state variables pn , pe , and h are inertial frame quantities, whereas the velocities u, v, and w are body frame quantities. Therefore the relationship between
position and velocities is given by
pn
u
d
v
p e = Rb v
dt
h
w
u
b T
v
= (Rv )
w
cc ssc cs csc + ss
u
= cs sss + cc css sc v .
s
sc
cc
w
The relationship between absolute angles , , and , and the angular rates p,
q, and r is also complicated by the fact that these quantities are defined in different
coordinate frames. The angular rates are defined in the body frame F b , whereas
the roll angle is defined in F v2 , the pitch angle is defined in Fv1 , and the yaw
angle is defined in the vehicle frame F v .
,
and .
Since ,
,
are small and noting
We need to relate p, q, and r to ,
that
b
= Rv2 ()
= Rv1 ()
= I,
Rv2
()
v1
v
12
we get
0
0
p
b
0 + Rb ()Rv2 ()
+ Rb ()Rv2 ()Rvv1 ()
0
q = Rv2
()
v2
v1
v2
v1
r
0
0
0
0
1
0
0
cos 0 sin
1
0
0
1
0 0
= 0 + 0 cos sin + 0 cos sin 0
0 sin cos
sin 0 cos
0 sin cos
0
0
1 0
s
(7)
= 0 c sc
.
0 s cc
Inverting we get
cos()
sin()
q .
0 sin() sec() cos() sec()
r
2.3
(8)
Let v be the velocity vector of the quadrotor. Newtons laws only hold in inertial
frames, therefore Newtons law applied to the translational motion is
m
dv
= f,
dti
where m is the mass of the quadrotor, f is the total applied to the quadrotor, and
d
is the time derivative in the inertial frame. From the equation of Coriolis we
dti
have
dv
dv
m
=m
+ b/i v = f ,
(9)
dti
dtb
where b/i is the angular velocity of the airframe with respect to the inertial frame.
Since the control force is computed and applied in the body coordinate system,
and since is measured in body coordinates, we will express Eq (9) in body
4
4
b
coordinates, where vb = (u, v, w)T , and b/i
= (p, q, r)T . Therefore, in body
coordinates, Eq. (9) becomes
u
rv qw
fx
v = pw ru + 1 fy ,
(10)
m
fz
w
qu pv
13
where f b = (fx , fy , fz )T .
For rotational motion, Newtons second law states that
dhb
= m,
dti
where h is the angular momentum and m is the applied torque. Using the equation
of Coriolis we have
dh
dh
=
+ b/i h = m.
(11)
dti
dtb
b
Again, Eq. (11) is most easily resolved in body coordinates where hb = Jb/i
where J is the constant inertia matrix given by
R
R
R 2
(y R+ z 2 ) dm R xy dm
R xz dm
(x2R+ z 2 ) dm R yz dm
J = R xy dm
xz dm
yz dm
(x2 + y 2 ) dm
Jx Jxy Jxz
4
= Jxy Jy Jyz .
Jxz Jyz
Jz
Figure 11: The moments of inertia for the quadrotor are calculated assuming a
spherical dense center with mass M and radius R, and point masses of mass m
located at a distance of ` from the center.
As shown in Figure 11, the quadrotor is essentially symmetric about all three
axes, therefore Jxy = Jxz = Jyz = 0 which implies that
Jx 0 0
J = 0 Jy 0 .
0 0 Jz
14
Therefore
1
Jx
J1 = 0
0
0
1
Jy
0
0 .
1
Jz
Jx =
1
0 0
p
Jx 0 0
0
p
r q
Jx
0 Jy 0 q +
q = 0 J1 0 r 0
p
y
r
0 0 Jz
r
q p 0
0 0 J1z
J J
y
z
1
qr
Jx
Jx
1
x
pr
= JzJJ
+ Jy .
y
1
Jx Jy
pq
Jz
Jz
The six degree of freedom model for the quadrotor kinematics and dynamics
can be summarized as follows:
pn
cc ssc cs csc + ss
u
pe = cs sss + cc css sc v
(12)
h
s
sc
cc
w
u
rv qw
fx
v = pw ru + 1 fy ,
(13)
m
w
qu pv
fz
cos
sin
q
(14)
cos
sin
r
0
cos
cos
Jy Jz 1
qr
p
Jx
Jx
1
Jz Jx
q =
(15)
Jy pr + Jy .
1
J
J
x
y
r
pq
Jz
J
z
15
The objective of this section is to describe the forces and torques that act on the
quadrotor. Since there are no aerodynamic lifting surfaces, we will assume that
the aerodynamic forces and moments are negligible.
The forces and moments are primarily due to gravity and the four propellers.
front
left
right
back
Figure 12: The top view of the quadrotor. Each motor produces an upward force
F and a torque . The front and back motors spin clockwise and the right and left
motors spin counterclockwise.
Figure 13: Definition of the forces and torques acting on the quadrotor.
Figure 12 shows a top view of the quadrotor systems. As shown in Figure 13,
each motor produces a force F and a torque . The total force acting on the
16
quadrotor is given by
F = Ff + Fr + Fb + Fl .
The rolling torque is produced by the forces of the right and left motors as
= `(Fl Fr ).
Similarly, the pitching torque is produced by the forces of the front and back
motors as
= `(Ff Fb ).
Due to Newtons third law, the drag of the propellers produces a yawing torque
on the body of the quadrotor. The direction of the torque will be in the oppositive
direction of the motion of the propeller. Therefore the total yawing torque is given
by
= r + l f b .
The lift and drag produced by the propellers is proportional to the square of the
angular velocity. We will assume that the angular velocity is directly proportional
to the pulse width modulation commend sent to the motor. Therefore, the force
and torque of each motor can be expressed as
F = k1
= k2 ,
where k1 and k2 are constants that need to be determined experimentally, is the
motor command signal, and represents f , r, b, and l.
Therefore, the forces and torques on the quadrotor can be written in matrix
form as
F
k1
k1
k1
k1
f
f
0 `k1
0
`k
r
4
1 r
=
.
= M
`k1
0
`k1 0
b
b
k2 k2
k2 k2
l
l
The control strategies derived in subsequent sections will specify forces and
torques. The actual motors commands can be found as
F
f
r
= M1 .
b
l
17
Note that the pulse width modulation commands are required to be between zero
and one.
In addition to the force exerted by the motor, gravity also exerts a force on the
quadrotor. In the vehicle frame F v , the gravity force acting on the center of mass
is given by
0
fgv = 0 .
mg
However, since v in Equation (13) is expressed in F b , we must transform to the
body frame to give
0
b
b
0
fg = Rv
mg
mg sin
= mg cos sin .
mg cos cos
Therefore, equations (12)(15) become
pn
cc ssc cs csc + ss
u
pe = cs sss + cc css sc v
s
sc
cc
w
h
u
rv qw
g sin
0
v = pw ru + g cos sin + 1 0 ,
m
w
qu pv
g cos cos
F
cos
sin
q ,
sin
cos
r
0
cos
cos
Jy Jz 1
qr
p
Jx
Jx
1
Jz Jx
q =
Jy pr + Jy .
1
Jx Jy
r
pq
Jz
J
(16)
(17)
(18)
(19)
Simplified Models
Equations (16)(19) are the equations of motion to be used in our six degreeof-freedom simulator. However, they are not appropriate for control design for
18
several reasons. The first reason is that they are too complicated to gain significant
insight into the motion. The second reason is that the position and orientation
are relative to the inertial world fixed frame, whereas camera measurements will
measure position and orientation of the target with respect to the camera frame.
4.1
For the quadrotor, we are not able to estimate the inertial position or the heading
angle . Rather, we will be interested in the relative position and heading of the
quadrotor with respect to a ground target. The relative position of the quadrotor
will be measured in the vehicle-1 frame, i.e., the vehicle frame after it has been
rotated by the heading vector . The vehicle-1 frame is convenient since x, y,
and z positions are still measured relative to a flat earth, but they are vehicle
centered quantities as opposed to inertial quantities. Let px , py , and pz denote
the relative position vector between the target and the vehicle resolved in the v1
frame. Therefore Eq (16) becomes
px
c ss cs
u
py = 0
c s
v.
(20)
pz
s sc cc
w
4.2
p
= q .
r
(21)
Similarly, Equation (19) is simplified by assuming that the Coriolis terms qr, pr,
and pq, are small to obtain
1
p
Jx
1
q = J .
(22)
y
1
r
Jz
Combining Eq. (21) and (22) we get
1
Jx
= J1 .
y
1
Jz
19
(23)
(24)
Neglecting the Coriolis terms and plugging Eq. (17) into Eq. (24) and simplifying
gives
csc ss
0
pn
pe = 0 + css + sc F .
(25)
m
cc
g
pd
Therefore, the simplified inertial model is given by
F
m
F
pe = ( cos sin sin + sin cos )
m
F
pd = g (cos cos )
m
1
=
Jx
1
=
Jy
1
= .
Jz
(26)
(27)
(28)
(29)
(30)
(31)
(32)
The dynamics given in Equations (26)(31) are expressed in the inertial frame.
This is necessary for the simulator. However, we will be controlling position,
altitude, and heading using camera frame measurements of a target position. In
this setting heading is irrelevant. Therefore, instead of expressing the translational
dynamics in the inertial frame, we will express them in the vehicle-1 frame F v1 ,
which is equivalent to the inertial frame after rotating by the heading angle.
Differentiating Eq. (20) and neglecting R bv1 gives
c ss cs
px
u
py = 0
c s v .
(33)
pz
s sc cc
w
20
Neglecting the Coriolis terms and plugging Eq. (17) into Eq. (33) and simplifying
gives
px
0
cs
py = 0 + s F .
(34)
m
pz
g
cc
Therefore, the simplified model in the vehicle-1 frame is given by
px = cos sin
py = sin
F
m
F
m
pz = g cos cos
1
=
Jx
1
=
Jy
1
= .
Jz
(35)
(36)
F
m
(37)
(38)
(39)
(40)
(41)
5
5.1
Sensors
Rate Gyros
A MEMS rate gyro contains a small vibrating lever. When the lever undergoes
an angular rotation, Coriolis effects change the frequency of the vibration, thus
detecting the rotation. A brief description of the physics of rate gyros can be
found at RateSensorAppNote.pdf.
The output of the rate gyro is given by
ygyro = kgyro + gyro + gyro ,
where ygyro is in Volts, kgyro is a gain, is the angular rate in radians per second,
gyro is a bias term, and gyro is zero mean white noise. The gain kgyro should be
given on the spec sheet of the sensor. However, due to variations in manufacturing
it is imprecisely known. The bias term gyro is strongly dependent on temperature
and should be calibrated prior to each flight.
21
If three rate gyros are aligned along the x, y, and z axes of the quadrotor, then
the rate gyros measure the angular body rates p, q, and r as follows:
ygyro,x = kgyro,x p + gyro,x + gyro,x
ygyro,y = kgyro,y q + gyro,y + gyro,y
ygyro,z = kgyro,z r + gyro,z + gyro,z .
MEMS gyros are analog devices that are sampled by the on-board processer.
We will assume that the sample rate is given by Ts . The Kestrel autopilot samples
the gyros at approximately 120 Hz.
5.2
Accelerometers
5.3
Camera
The control objective is to hold the position of the quadrotor over a ground based
target that is detected using the vision sensor. In this section we will briefly describe how to estimate px and py in the vehicle 1-frame.
We will assume that the camera is mounted so that the optical axis of the
camera is aligned with the body frame z-axis and so that the x-axis of the camera
points out the right of the quadrotor and the y-axis of the camera points to the
back of the quadrotor.
The camera model is shown in Figure 14. The position of the target in the
vehicle-1 frame is (px , py , pz ). The pixel location of the target in the image is
(x , y ).
The geometry for py is shown in Figure 15. From the geometry shown in
Figure 15, we can see that
py = pz tan x
,
(42)
My
where is the camera field-of-view, and My is the number of pixels along the
camera y-axis. In Figure 15, both py and x are negative. Positive values are
toward the right rotor. A similar equation can be derived for px as
px = pz tan y
.
(43)
My
23
State Estimation
The objective of this section is to describe techniques for estimating the state of the
quadrotor from sensor measurements. We need to estimate the following states:
px , py , pz , u, v, w, , , , p, q, r.
The angular rates p, q, and r can be obtained by low pass filtering the rate
gyros. The remain states require a Kalman filter. Both are discussed below.
6.1
a
U (s),
s+a
24
Optical
Axis
Target
Figure 15: The geometry introduced by the vision system. The height above
ground is given by pz , the lateral position error is py , the roll angle is , the
field-of-view of the camera is , the lateral pixel location of the target in the image
is x , and the total number of pixels along the lateral axis of the camera is Mx .
were u(t) is the input of the filter and y(t) is the output. Inverse Laplace transforming we get
y = ay + au.
(44)
Using a zeroth order approximation of the derivative we get
y(t + T ) y(t)
= ay(t) + au(t),
T
where T is the sample rate. Solving for y(t + T ) we get
y(t + T ) = (1 aT )y(t) + aT u(t).
For the zeroth order approximation to be valid we need aT 1. If we let = aT
then we get the simple form
y(t + T ) = (1 )y(t) + u(t).
25
Note that this equation has a nice physical interpretation: the new value of y
(filtered value) is a weighted average of the old value of y and u (unfiltered value).
If u is noisy, then [0, 1] should be set to a small value. However, if u is
relatively noise free, then should be close to unity.
In the derivation of the discrete-time implementation of the low-pass filter, it is
possible to be more precise. In particular, returning to Equation (44), from linear
systems theory, it is well known that the solution is given by
Z T
aT
y(t + T ) = e y(t) + a
ea(T ) u( ) d.
0
Assuming that u(t) is constant between sample periods results in the expression
Z
y(t + T ) = e
aT
y(t) + a
ea(T ) d u(t)y(t + T )
(45)
6.2
The angular rates p, q, and r can be estimated by low-pass filtering the rate gyro
signals:
p = LP F (ygyro,x )
q = LP F (ygyro,y )
r = LP F (ygyro,z ).
6.3
26
(46)
(47)
(48)
L (y C x),
| {z }
copy of the model correction due to sensor reading
(49)
(51)
(52)
28
System model:
x = Ax + Bu
y(tk ) = Cx(tk )
Initial Condition x(0).
Assumptions:
Knowledge of A, B, C, u(t).
No measurement noise.
Prediction: In between measurements (t [tk1 , tk )):
Propagate x = A
x + Bu.
Initial condition is x+ (tk1 ).
Label the estimate at time tk as x (tk ).
Correction: At sensor measurement (t = tk ):
x+ (tk ) = x (tk ) + L (y(tk ) C x (tk )) .
Table 1: Continuous-Discrete Linear Observer.
6.4
1
E{x1 }
Z
E{xi } =
fi () d,
and f () is the probability density function for xi . Given any pair of components
xi and xj of X, we denote their covariance as
cov(xi , xj ) = ij = E{(xi i )(xj j )}.
The covariance of any component with itself is the variance, i.e.,
var(xi ) = cov(xi , xi ) = ii = E{(xi i )( i )}.
The standard deviation of xi is the square root of the variance:
p
stdev(xi ) = i = ii .
29
System model:
x = f (x, u)
y(tk ) = c(x(tk ))
Initial Condition x(0).
Assumptions:
Knowledge of f , c, u(t).
No measurement noise.
Prediction: In between measurements (t [tk1 , tk )):
Propagate x = f (
x, u).
Initial condition is x+ (tk1 ).
Label the estimate at time tk as x (tk ).
Correction: At sensor measurement (t = tk ):
x+ (tk ) = x (tk ) + L (y(tk ) c(
x (tk ))) .
Table 2: Continuous-Discrete Nonlinear Observer.
The covariances associated with a random vector X can be grouped into a matrix
known as the covariance matrix:
11 12 1n
21 22 2n
T
T
T
= ..
.. = E{(X )(X ) } = E{XX } .
.
.
.
.
.
n1 n2 nn
Note that = T so that is both symmetric and positive semi-definite, which
implies that its eigenvalues are real and nonnegative.
The probability density function for a Gaussian random variable is given by
fx (x) =
(xx )2
1
e x2 ,
2x
where x is the mean of x and x is the standard deviation. The vector equivalent
is given by
1
1
T 1
fX (X) =
exp (X ) (X ) ,
2
2 det
in which case we write
X N (, ) ,
30
Figure 17: Level curves for the pdf of a 2D Gaussian random variable.
and say that X is normally distributed with mean and covariance .
Figure 17 shows the level curves for a 2D Gaussian random variable with
different covariance matrices.
6.5
31
At
x(t) = e x0 +
eA(t ) G( ) d.
= E A
xxT + G xT + xxT AT + x T GT
= AP + P AT + GE{ xT }T + E{
x T }GT .
As in the previous section we get
Z t
T
AT t
T
T AT (t )
E{ x } = E (t)
x0 e
+
(t) ( )G e
d
0
1
= QGT ,
2
which implies that
P = AP + P AT + GQGT .
32
6.5.2 At Measurements.
At a measurement we have that
x+ = x x+
= x x L Cx + C x
= x LC x L.
Therefore
P + = E{
x+ x+T }
n
T o
= E x LC x L x LC x L
= E x xT x xT C T LT x T LT
=
LC x xT + LC x xT C T LT + LC x T LT
L
xT + L
xT C T LT + L T LT
(53)
System model:
x = Ax + Bu +
yi (tk ) = Ci x(tk ) + k
Initial Condition x(0).
Assumptions:
Knowledge of A, B, Ci , u(t).
Process noise satisfies N (0, Q).
Measurement noise satisfies k N (0, R).
Prediction: In between measurements (t [tk1 , tk )):
Propagate x = A
x + Bu.
Propagate P = AP + P AT + Q.
Correction: At the ith sensor measurement (t = tk ):
Li = P CiT (Ri + Ci P CiT )1 ,
P + = (I Li Ci )P ,
x+ (tk ) = x (tk ) + L (y(tk ) C x (tk )) .
Table 3: Continuous-Discrete Kalman Filter.
6.6
where the rate gyros and accelerometers will be used to drive the prediction step,
and an ultrasonic altimeter and camera will be used in the correction step.
34
System model:
x = f (x, u) +
yi (tk ) = ci (x(tk )) + k
Initial Condition x(0).
Assumptions:
Knowledge of f , ci , u(t).
Process noise satisfies N (0, Q).
Measurement noise satisfies k N (0, R).
Prediction: In between measurements (t [tk1 , tk )):
Propagate x = f (
x
, u),
f
Compute A = x x=x(t) ,
Propagate P = AP + P AT + Q.
th
Correction: At
the i sensor measurement (t = tk ):
ci
Ci = x x=x
Li = P CiT (Ri + Ci P CiT )1 ,
P + = (I Li Ci )P ,
x+ (tk ) = x (tk ) + L (y(tk ) ci (
x (tk ))) .
px
py
pz
cos
sin
a
z
,
sina
f (x, u) =
z
g + cos cos az
q cos r sin
sin
+ r cos
q cos
cos
where we have used the fact that the z-axis of the accelerometer measures az =
35
out
7:
P = P + TN
AP + P AT + GQGT
8: end for
9: if A measurement has been received from sensor i then {Correction: Measurement Update}
i
10:
Ci = c
x
11:
Li = P CiT (Ri + Ci P CiT )1
12:
P = (I Li Ci )P
13:
x = x + Li (yi ci (
x)).
14: end if
F/m. Differentiating we obtain
0 0 0 1 0 0
0
0
0 0 0 0 1 0
0
0
0 0 0 0 0 1
0
0
0 0 0 0 0 0
s s az
c c az
0
0
0
0
0
0
c
a
0
A=
z
0 0 0 0 0 0
s c az
c s az
0 0 0 0 0 0 qs rc
0
qcrs
t
(qs + rc) c
0 0 0 0 0 0
c
0
0
0
0
Note that it may be adequate (not sure) to use a small angle approximation in
36
and
0
0
A=
0
0
0
0
px
py
pz
az
,
a
f (x, u) =
z
g + az
q
r
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0 0
0
0 0
0
1 0
0
0 0 az
0 az 0
0 0
0
0 0
0
0 0
0
0 0
0
0
0
0
.
0
0
0
If this form works, then the update equation for P can be coded by hand, significantly reducing the computational burden. Note also that f (x, u) does not take
into account the motion of the target. A feedforward term can be added to f to
account for the target motion as
px m
x
py m
y
az m
x
,
a
f (x, u) =
z
y
g + az
q
r
where (m
x, m
y ) is the velocity of the target in the vehicle-1 frame, and (m
x, m
y)
is the acceleration of the target in the vehicle-1 frame.
37
Let the relative position between the quadrotor and the target be denoted by
p = (px , py , pz )T . We can tranform to the camera frame as
v1
b
pc = Rgc Rbg Rv1
pv1 ,
where
0 1 0
Rgc = 0 0 1
1 0 0
0 0 1
Rbg = 0 1 0
1 0 0
transforms body coordinates to gimbal coordinates, and
cc ssc cs csc + ss
b
Rv1
= cs sss + cc css sc
s
sc
cc
transforms vehicle-1 coordinates to body coordinates. Using the small angle approximation for and we get
px + py + pz
pc = px + pz .
px py + pz
The model for the pixel coordinates are therefore computed as
px + py + pz
px py + pz
px + pz
4
2 = cy (x) = f
.
px py + pz
4
x = cx (x) = f
We therefore have the following sensors available to correct the state estimate:
4
(54)
(55)
(56)
(57)
The linearization of the first and fourth output functions are given by
C1 = 0 0 1 0 0 0 0 0
C4 = 0 0 0 0 0 0 0 1 .
(58)
(59)
The linearization of the expression for the pixel coordinates is messy and can
easily be computed numerically using the approximation
.
f (x1 , , xi + , , xn ) f (x1 , , xi , , xn )
f (x1 , , xi , . . , xn )
,
xi
Control Design
The control design will be derived directly from Equations (35)(40). Equations (38)(40) are already linear. To simplify Equations (35)(37) define
4
ux = cos sin
4
uy = sin
F
m
F
m
uz = g cos cos
(60)
(61)
F
,
m
(62)
to obtain
px = ux
py = uy
pz = uz .
(63)
(64)
(65)
The control design proceeds by developing PID control strategies for ux , uy , and
uz . After ux , uy , and uz have been computed, we can compute the desired force
F , and the commanded roll angle c and the commanded pitch angle c from
Equations (60)(62) as follows. From Equation (62) solve for F/m as
F
g uz
=
.
m
cos cos
39
(66)
uy cos
c
1
.
= tan
g uz
uy =
ux
c
1
= tan
.
uz g
7.1
(67)
(68)
Target
Figure 18: The size of the target is S in meters, and the size of the target in the
image plane is denoted by s in pixels. The focal length is f , and the height above
the target is pz .
target of size S. From similar triangles we have that
pz
f
= .
S
s
40
f S s
.
2s
(69)
us =
2s
fS
2s
uz + 2 ,
s
(70)
we get
s = us .
We can now derive a PID controller to drive s ds as
Z t
d
us = kps (s s ) kds s + kis
(ds s ) d.
0
Z
fS
fS
f S s
fS t d
d
( s ) d. (71)
uz = 2 kps (s s ) kds 2 + 2 3
s + kis 2
s
s
s
s 0 s
The downside to this equation is that it requires knowledge of the target size S and
the focal length f . This requirement can be removed by incorporating f S into the
PID gains by defining
4
kps = f Skps
4
kis = f Skis
4
kds = f Skds ,
and by noting from Equation (69) that f S2s = w. Therefore Equation (71) bes
comes
!
Z
d
ds
)
k
w
kis t d
(
s
s
+2
s + 2
( s ) d.
(72)
uz = kps
2s
2s
s
s 0 s
41
7.2
The equation of motion for roll is given by Eq. (38) as = p /Jx . We will use a
PID controller to regulate the roll attitude as
Z t
c
p = kp ( ) kd p + ki
(c ) d.
0
1
s
Jx
kp
s2 +
= 0.
Jx
1
Jx
s3 +
kd
Jx
s2 +
42
kp
Jx
= 0.
s
The integral gain ki can be selected so that damping ratio is not significantly
changed.
7.3
The equation of motion for pitch is given by Eq. (39) as = q /Jy . Similar to the
roll attitude hold, we will use a PID controller to regulate pitch as
Z t
c
q = kp ( ) kd q + ki
(c ) d.
0
7.4
7.5
The heading dynamics are given in Equation (40) as = r /Jz . Define d as the
4
inertial heading of the target, and define = d as the relative heading. The
Assuming that d is constant we get = r /Jz . We
camera directly measures .
regulate the relative heading with the PID strategy
Z t
d.
r = kp kd r ki
0
43
7.6
Feedforward
When the quadrotor is tracking a ground robot, the motion of the robot will cause
tracking errors due to the delayed response of the PID controller. If we can communicate with the robot, and we know its intended motion, we should be able to
use that information to help the quadrotor predict where the robot is moving.
To motivate our approach, lets consider a simple example to gain intuition.
Consider the double integrator system
y = u,
where y is position, and u is commanded acceleration. If r is the reference signal
then the standard PD loop is shown in Figure 20.
1
s2 +kd s+kp
and if w
then we get
e + kd e + kp e = 0,
which ensures that e(t) 0 independent of r(t). The associated block diagram
is shown in Figure 21.
or
= tan
m
+ kp y + kd y
g
45
Given the decoupling terms described at the beginning of this section, the
motion model for the quadrotor in the vehicle-1 frame is given by
px = ux
py = uy
= u .
Let the position of the target in the vehicle-1 frame be given by (mx , my ) and let
it orientation be given by t , and define
px = mx px
py = my py
= t .
Differentiating twice we get
px = m
x ux
py = m
y uy
= u .
t
Vt cos
cos sin
Vt cos t
m
x
,
=
=
Vt sin t
m
y
sin cos
Vt sin
46
u1
m
x
cos sin
=
.
m
y
u2
sin cos
To implement feedforward on the quadrotors, we must communicate with the
robot to obtain Vt , u1 , and u2 .
References
[1] B. L. Stevens and F. L. Lewis, Aircraft Control and Simulation. Hoboken, New Jersey:
John Wiley & Sons, Inc., 2nd ed., 2003.
[2] D. Halliday and R. Resnick, Fundamentals of Physics. John Wiley & Sons, 3rd ed.,
1988.
[3] http://www.silicondesigns.com/tech.html.
[4] M. Rauw, FDC 1.2 - A SIMULINK Toolbox for Flight Dynamics and Control Analysis, February 1998. Available at http://www.mathworks.com/.
47