Introduction to Multicopter Design and...
Transcript of Introduction to Multicopter Design and...
Introduction to Multicopter Design and Control
Quan Quan , Associate [email protected]
BUAA Reliable Flight Control Group, http://rfly.buaa.edu.cn/Beihang University, China
Lesson 05 Coordinate System and Attitude Representation
2016/12/25 2
Whatarethethreeattituderepresentationmethodsandtherelationshipbetweentheirderivatives
andtheaircraftbody’sangularvelocity?
Preface
Outline
1. Coordinate System
2. Attitude Representation– Euler Angles– Rotation matrix– Quaternion
3. Conclusion
2016/12/25 3
1. Coordinate System
2016/12/25 4
Right-Hand Rule
As shown in the figure above, the thumb of the right hand points to the positivedirection of the ox axis, the first finger points to the positive direction of the oy axisand the middle finger points to the positive direction of the oz axis. Furthermore, asshown in the figure above, in order to determine the positive direction of a rotation,the thumb of the right hand points the positive direction of the rotation axis and thedirection of the bent fingers is the positive direction of rotation.
Fig 5.1 Coordinate axes and the positive direction of a rotation using the right-hand rule
2016/12/25 5
EFCF and ABCF
eoex
ey
ez
bo
bxby
bz
Fig 5.2 The relationship
between the ABCF and the EFCF
The Earth-Fixed Coordinate Frame (EFCF) is used to studymulticopter’s dynamic state relative to the Earth’s surfaceand to determine its 3D position. The Earth’s curvature isignored. The initial position of the multicopter or the centerof the Earth is often set as the coordinate origin , theaxis points to a certain direction in the horizontal planeand the axis points perpendicularly to the ground. Then,the axis is determined according to the right-hand rule.The Aircraft-Body Coordinate Frame (ABCF) is fixed to themulticopter. The Center of Gravity (CoG) of the multicopteris chosen as the origin . The axis points to the nosedirection in the symmetric plane of the multicopter. Theaxis is in the symmetric plane of the multicopter, pointingdownwards, perpendicular to the axis. The axis isdetermined according to the right-hand rule.
eo
bo
e eo xe eo z
e eo y
b bo x
b bo zb bo yb bo x
Subscript e represents the Earth, subscript b represents the Body.
1. Coordinate System
2016/12/25 6
EFCF and ABCF
eoex
ey
ez
bo
bxby
bz
1 2 3
1 0 00 , 1 , 00 0 1
e e e
Define the following unit vectors
In the EFCF, the unit vectors along the axis, axis andaxis are expressed as , respectively. In the ABCF, the
unit vectors along the axis, axis and axis satisfy thefollowing relationship (Superscript b represents the expressionin ABCF of a vector)
b b b1 1 2 2 3 3, , b e b e b e
In the EFCF, the unit vectors along the axis, axis andaxis are expressed as , respectively. (Superscript
e represents the expression in EFCF of a vector).
e eo x e eo y
e eo z 1 2 3, ,e e eb bo x b bo zb bo y
b bo x b bo y
b bo z e e e1 2 3, ,b b b
Fig 5.2 The relationship
between the ABCF and the EFCF
1. Coordinate System
o o o
3n
3k
2 2( )k n
1k
1n
2n
2b
3n
1 1( )n b
3b
1e
1k
3 3( )e k
2e
2k
(a) Yaw angle (b) Pitch angle (c) Roll angle
2016/12/25 7
Fig 5.3 Euler angles and frame transformation
The rotation from the EFCF to the ABCF is composed of threeelemental rotations about axes by separately.3 2 1, ,e k n , ,
2. Attitude Representation
Euler Angles(1) Definition
2. Attitude Representation
2016/12/25 8
Euler Angles
Fig 5.4 Intuitive representation of the Euler angles (x axis is orange , y axis is green, z axis is blue)
(1) Definition
exeo
ey
ez
bo by
bz
bx
2016/12/25 9
Euler Angles
Fig 5.5 Representation of Euler angles
(1) Definition
The angles between the EFCF and theABCF are attitude angles, namely Eulerangles.Pitch angle :the angle between the bodyaxis and the horizon plane. The pitch angleis positive when the aircraft nose pitches up.Yaw angle : the angle between theprojection of the body axis in the horizonplane and the earth’s axis. The yaw angle ispositive when the aircraft body turns to right.Roll angle : the rotation angle of theaircraft symmetry plane around the bodyaxis. The roll angle is positive when theaircraft body rolls to right.
2. Attitude Representation
eoex
ey
ez
bo
bxby
bz
bobzo
bxo
e bx xo
2016/12/25 10
Fig 5.6 Diagram of the Euler angles
The pitch angle shown in theleft figure is positive;The roll angle shown in the leftfigure is negative;The yaw angle shown in theleft figure is positive.
Pitch angle
Roll angle
Yaw angle
(1) Definition
Euler Angles
2. Attitude Representation
2016/12/25 11
(2) Relationship between the attitude rate and the aircraftbody’s angular velocity
The angular velocity of the aircraft body’s rotation is
b b b
Tbx y z ω
Then
?
Euler Angles
2. Attitude Representation
b
b
b
x
y
z
2016/12/25 12
b b b b3 2 1 ω k n b
b
b
b
1 0 sin0 cos cos sin0 sin cos cos
x
y
z
Then
Superscript b represents the expression in ABCF of a vector.
The angular velocity of the aircraft body’s rotation is
b b b
Tbx y z ω
(2) Relationship between the attitude rate and the aircraftbody’s angular velocity
Euler Angles
2. Attitude Representation
2016/12/25 13
Furthermore
1 tan sin tan cos0 cos sin0 sin cos cos cos
WSingularity problem
2
T Θwhere
When , one has, 0
(2) Relationship between the attitude rate and the aircraftbody’s angular velocity
Euler Angles
2. Attitude Representation
b Θ W ω
b
b
b
x
y
z
2016/12/25 14
Rotation Matrix(1) Definition
Define the rotation matrix as
The vectors in rotation matrix satisfy
e e e eb 1 2 3 R b b b
Rotation matrix from the ABCF to the EFCF
Superscript b represents the expression in ABCF of a vector.
Superscript e represents the expression in EFCF of a vector.
e eT eT eb b b b 3 R R R R I
ebdet 1R
Note: det() represents the determinant
2. Attitude Representation
e e b e e e b e e e b e1 b 1 b 1 2 b 2 b 2 3 b 3 b 3, , b R b R e b R b R e b R b R e
2016/12/25 15
The rotation from the EFCF to the ABCF is composed of three elemental steps
where
Rotation Matrix(1) Definition
2. Attitude Representation
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
x
y
z
R
R
R
e k n b ne k n k be k e n b
cos sin 0 cos 0 sin 1 0 0sin cos 0 , 0 1 0 , 0 cos sin .0 0 1 sin 0 cos 0 sin cos
z y x
R R R
o o o
3n
3k
2 2( )k n
1k
1n
2n
2b
3n
1 1( )n b
3b
1e
1k
3 3( )e k
2e
2k
(a) Yaw angle (b) Pitch angle (c) Roll angle
2016/12/25 16
2. Attitude Representation
(1) Definition
Rotation Matrix
1e bb e
1 1 1z
=
cos cos cos sin sin sin cos cos sin cos sin sincos sin sin sin sin cos cos sin sin cos cos sin .
sin sin cos cos cos
y x
z y x
R R
R R R
R R R
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
x
y
z
R
R
R
e k n b ne k n k be k e n b
2016/12/25 17
11 12 13eb 21 22 23
31 32 33
r r rr r rr r r
R
21
11
31
32
33
tan
sin
tan
rrr
rr
Calculate Eulerangles from therotation matrix
It is assumed that inthis case.
0
Singularity problem2
21
11
31
32
33
arctan
arcsin
arctan
rr
rrr
2. Attitude Representation
(1) Definition
Rotation Matrix
When ,2
e
b
0 sin cos0 cos sin .1 0 0
R
Infinite number of combinations
2016/12/25 18
The cross product of two vectors and is defined as
where
(2) Relationship between the derivative of the rotation matrix and the aircraft body’s angular velocity
2. Attitude Representation
Rotation Matrix
0
00
z y
z x
y x
a aa aa a
a sin a b a b n
a b a b
T
x y za a a a T
x y zb b b b
(2) Relationship between the derivative of the rotation matrix and the aircraft body’s angular velocity
2016/12/25 19
If the rigid body’s rotation (without translation) is only considered,then the derivative of a vector satisfies (Similar to the circularmotion)
e 3r e
e eddt
r ω r
where the symbol × represents the vector cross product. One has
2. Attitude Representation
Rotation Matrix
e e e1 2 3 e e e e e e
1 2 3
ddt
b b b
ω b ω b ω bFig 5.7 The derivative of a vector presented by the circular motion
eddt
r
er
eω
2016/12/25 20
According to and the property of the cross product Following property ofthe cross product isused : for a rotationmatrixand any two vectors
, one has
3 3 det 1 R R
3, a b Ra Rb R a b
The use of the rotation matrix can avoid the singularity problem. However, sincehas nine unknown variables, the computational burden of solving equation is heavy.
(2) Relationship between the derivative of the rotation matrix and the aircraft body’s angular velocity
Rotation Matrix
2. Attitude Representation
e e bb ω R ω
ee b e e b e e b ebb b 1 b b 2 b b 3
e b e b e bb 1 b 2 b 3
e b b bb 1 2 3
e bb
ddt
R R ω R e R ω R e R ω R e
R ω e R ω e R ω e
R ω e ω e ω e
R ω
2016/12/25 21
Quaternion(1) Definition
Fig 5.8 Quaternion plaque on Brougham(Broom) Bridge, Dublin, and the image is fromhttps://en.wikipedia.org/wiki/Quaternion
It reads “Here as he walked by on the 16thof October 1843 Sir William RowanHamilton in a flash of genius discoveredthe fundamental formula for quaternionmultiplication & cutit on a stone of this bridge.”
Quaternions are normally written as
0
v
q
where is the scalar part of andis the vector part.
For a real number , the correspondingquaternion is defined as . For avector , the corresponding quaternion is
.
0 q 4q T 3
v 1 2 3q q q q
s T1 3q 0 s
3vTT0q v
i2 = j2 = k2 = ijk = −1
2. Attitude Representation
2016/12/25 22
(2) Quaternions’ basic operation rules0 0 0 0
v v v v
p q p q
p qp q p q
T0 0 0 0 v v
v v v v 0 v 0 v
p q p qp q
q pp q
p q p q q p
• Addition and subtraction
• Multiplication
Multiplication properties (Note: q, r, m are quaternions, s is a scalar, u, v are column vectors)
q r m q r q m
q r m q r m q r m0
v
sqs s
s
q qq
T0 0
u vu v
q qu v u v
Quaternion
2. Attitude Representation
2016/12/25 23
• Conjugate
0
v
q
0
v
q
q q
p q q p
p q p q
Some properties:
• Norm2
2 T0 v v
2 2 2 20 1 2 3
q
q q q q
q q q q q
q q
p q p q
q q
Some properties:
(2) Quaternions’ basic operation rules Quaternion
2. Attitude Representation
2016/12/25 24
• Inverse1
3 1
1
q q
0
According to the definition of , one has q 1
qqq
• Unit quaternionFor a unit quaternion , it satisfies . Let . Thenq 1q
(2) Quaternions’ basic operation rules
1p q
1
1p q
q q
Quaternion
2. Attitude Representation
2016/12/25 25
(3) Quaternions as rotationsAssume that represents a rotation process and represents a vector. Then under the action of , the vector is turned into . This process is expressed as
q 31 v
q1v
1
1 1
0 0
q qv v
The first rowalways stands
cos2
sin2
qv
A unit quaternion can always be written in the form
Fig 5.9 Physical meaning of unit quaternionsReaders can further refer to:[1] Shoemake K. Quaternions. Department of Computer and Information Science,University of Pennsylvania, USA, 1994
31v
Quaternion
2. Attitude Representation
v
x
y
z
1v
1v
o
2016/12/25 26
T0 1 cos
2
v v
0 1 0 1 0 1
0 10 1 sin sin
2 2
v v v v v vvv v v v 0 1 sin
2
v v v
Define two unit vectors with being the angle between them. Therefore, one has
0 1 1 0, v v v v 2
Define a unit quaternion, one has
T0 1
010 1
cos 002
sin2
v vq
vvv vvFig 5.10 Rotation represented by quaternions
(3) Quaternions as rotations Quaternion
2. Attitude Representation
0 1
0 1
v v
vv v
22v
2
1v0v
0 1
0 1
v v
vv v
22v
2
1v0v
2016/12/25 27
Fig 5.10 Rotation represented by quaternions
1
02
00
q q
vv* *
1
02 1 1
* *
0 0 1 1
* *
0 0 1 1
3 1 3 1
1
00 0 0
0 0 0 0
0 0 0 0
1 1
0
q qvv v v
qv v v v
qv v v v
q0 0
q
v
*
0
0
v
lies in the same plane as and , as shownin the figure below, and also forms an anglewith .
2v 1v2
Why can quaternionsrepresent the rotation?
0v
1v
(3) Quaternions as rotations Quaternion
2. Attitude Representation
2016/12/25 28
1
1 1
0 0
q qv v
• Coordinate frame rotation• Vector rotation
Pay attention to the difference !
(3) Quaternions as rotations Quaternion
2. Attitude Representation
1
1 1
0 0
q qv v
v
x
y
z
1v
1v
o
1 1( )v v
v
x
y
z
x
yz
o
2016/12/25 29
It is assumed that the rotation from the EFCF to the ABCF is represented by
the quaternion , one has (Coordinate frame rotation) Tbe 0 1 2 3q q q qq
1e eb be b
1b be eb
0 0
0
q qr r
q qr
0 1 2 3 0 1 2 3
1 0 3 2 1 0 3 2e b
2 3 0 1 2 3 0 1
3 2 1 0 3 2 1 0
0 0q q q q q q q qq q q q q q q qq q q q q q q qq q q q q q q q
r r
2 2 2 20 1 2 3 1 2 0 3 1 3 0 2
b 2 2 2 2e 1 2 0 3 0 1 2 3 2 3 0 1
2 2 2 21 3 0 2 2 3 0 1 0 1 2 3
2( ) 2( )( ) 2( ) 2( )
2( ) 2( )
q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q
C q
(4) Quaternions and rotation matrix Quaternion
2. Attitude Representation
e b be( )r C q re bb e( )R C q
2016/12/25 30
be z y x q q q q
T
T
T
cos sin 0 02 2
cos 0 sin 02 2
cos 0 0 sin2 2
x
y
z
q
q
q
According to the rotation order of Euler angles, one has
be
cos cos cos sin sin sin2 2 2 2 2 2
sin cos cos cos sin sin2 2 2 2 2 2
cos sin cos sin cos sin2 2 2 2 2 2
cos cos sin sin sin cos2 2 2 2 2 2
q
(5) Quaternions and Euler angles Quaternion
2. Attitude Representation
1b be eb e
1
e
-1 -1-1z e
0 0
0
0=
z y x z y x
x y z y x
q qr r
q q q q q qr
q q q q q qr
o o o
3n
3k
2 2( )k n
1k
1n
2n
2b
3n
1 1( )n b
3b
1e
1k
3 3( )e k
2e
2k
2016/12/25 31
0 1 2 32 21 2
0 2 1 3
0 3 1 22 22 3
2( )tan1 2
sin 2
2tan
1 2
q q q qq q
q q q q
q q q qq q
2
be
cos2 2
sin2 2 2
2cos
2 2
sin2 2
q
When , the singularity problem occurs.
0 2 1 3 0 2 1 32 1|| 2 1q q q q q q q q
Infinite number of combinations
It is assumed that . 0
0 1 2 32 21 2
0 2 1 3
0 3 1 22 22 3
2( )arctan1 2
arcsin 2
2arctan
1 2
q q q qq q
q q q q
q q q qq q
(5) Quaternions and Euler angles Quaternion
2. Attitude Representation
be
cos cos cos sin sin sin2 2 2 2 2 2
sin cos cos cos sin sin2 2 2 2 2 2
cos sin cos sin cos sin2 2 2 2 2 2
cos cos sin sin sin cos2 2 2 2 2 2
q
2016/12/25 32
According to the composite rotationquaternion in the case of rotatingcoordinate frames, one has
where b b
e et t t q q qAircraft body’s angular velocity
The derivative of is obtained as be tq
Perturbation
(6) Relationship between the derivative of the quaternions and the aircraft body’s angular velocity
Quaternion
2. Attitude Representation
Tb T11
2t
q ω
b be eb
e 0
b be e
0
Tb b T be e
0
b Tb b
3 e eb b
0
b Tbeb b
lim
lim
112lim
012
lim
012
t
t
t
t
t t tt
tt t
t
t t t
tt
t tt t
t
t
q qq
q q q
q ω q
ωI q q
ω ω
ωq
ω ω
2016/12/25 33
b T
b be eb b
012
t t
ωq q
ω ω
T b0 v
bv 0 3 v
12
12
q
q
q ω
q I q ω
In practice, can be measuredapproximately by a three-axisgyroscope, then the equationabove is linear!
bω
Tb Te 0 vq q q
Transformation
e bb e( )R C q
Quaternion
2. Attitude Representation
(6) Relationship between the derivative of the quaternions and the aircraft body’s angular velocity
3. Conclusion
2016/12/25 34
ee bbb
ddt
R R ω
• Relationship between the Euler angles andthe aircraft body’s angular velocity
• Relationship between the rotation matrixand the aircraft body’s angular velocity
• Relationship between the quaternions andthe aircraft body’s angular velocity
Fig 5.11 Mutual transformations among three rotation expressions
Singularity, Nonlinear
Non-singularity, High dimension
Non-singularity, Lower dimension
Most autopilots of multicopters use this representation. Un
ique
Sing
ular
ity
Non-uniqueUnique
b Θ W ω
b T
b be eb b
012
t t
ωq q
ω ω
2016/12/25 35
Yangguang Cai
Acknowledgement
Deep thanks go to
for material preparation.Jinrui Ren Xunhua Dai
2016/12/25 36
Thank you!All course PPTs and resources can be downloaded at
http://rfly.buaa.edu.cn/course
For more detailed content, please refer to the textbook: Quan, Quan. Introduction to Multicopter Design and Control. Springer,
2017. ISBN: 978-981-10-3382-7.It is available now, please visit http://
www.springer.com/us/book/9789811033810