Professional Documents
Culture Documents
ABSTRACT
In this paper, the comparison between the three methods: Euler, Quaternion and Direction-Cosine-
Matrix method for attitude and orientation estimation purpose are discussed. Direction-Cosine-Matrix
method was chosen as our main orientation estimation and was discussed in detail. Some calculations
are addressed to reduce the number of states for this estimation algorithm. The advantage is that
normal Kalman filter is used instead of Extended Kalman filter, so the first order approximation error
is prevented. The paper also shows some possibility ways to combine magnetic compass with
accelerometers and gyrometers.
Keywords Orientation Estimation, Direction Cosine Matrix(DCM) , Quaternion, Euler Representation
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-80-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
orientation estimation. And because the desired The notation “s” refers to sine and “c” refers
application is for low cost, strapdown Inertial to cosine. The transformation matrix bn C can be
Measurement Unit in which the accelerometers,
obtained with the following integration [10]:
gyrometers and magnetic compass are sampled n
at the same frequency, so direct filter has been bC = bn C [b ωnb ⊗] (2)
used. 0 −ωz ωy
In order to combine magnetic compass to
b
the estimator, there also some methods are [ ωnb ⊗] = ωz 0 −ωx (3)
applied such as using directly measure vector as −ωy ωx 0
measurement [3], calculating yaw angles and Normally, whole DCM is updated.
use as measurement [5] , tilt compensating or However, we can update each line of DCM
automatically magnetic vector fixing method matrix separately as below:
[8]. In this paper, the first two methods are bn C 31 0 b ωx
−bn C 33 n
C 32
investigated. b
n n
b 32
C = b C 33 0 −bn C 31 b ωy
2. ATTITUDE ESTIMATION n b (4)
bn C 33 −b C 32 n
C 31 0 ωz
b
Attitude estimation involves roll and pitch n
angle determination used the gyrometers and Where, b C 3x is the component of DCM at
accelerometers. Because the gravity vector is position (3,x) and bω x , bω y , bω z are angular
considered fixed or easily be compensated due velocity state with respect to the body-fixed
to the location of the object so it is mostly used frame which measured by gyrometers. So, even
as measurement for roll and pitch angle though using the DCM method, only three states
determination. Gyrometers play as the process need to be updated in each circle.
model in which estimated angular velocity and Measurements model using accelerometers:
previous states are used to calculate the present
step states. For roll and pitch estimation purpose bf 0 bn C 31
x
only, Quaternion representation hardly to be b n T 0 = bn C 32 g
used because its need four variables updated as fy = b C (5)
compulsory while DCM need three and Euler
b g n
fz b C 33
need only two. Below, Euler-based and DCM-
based attitude estimation has been discussed. b
In this equation, fx ,y ,z are the accelerometers
data, g is gravitational acceleration.
2.1 DCM-based attitude estimation
Even though relationships in Eq.(4) means
we integrate by time the angular velocity to have
Establish DCM through the rotation matrix the true angle, however, the angles can be
from the body fixed frame to navigation frame directly produced from accelerometer data. We
has a relationship with three Euler angles: yaw use these accelerometer data as the
(ψ) , pitch (θ) , roll (φ) corresponding to measurements for the filter as Eq.(5). Output of
rotation about zz’, yy’ and then xx’, the the filter adapts from these two sources. To
transformation matrix bn C that describe the adjust the believably degree in which source, we
orientation of coordinates frames “b” with change the measurement covariance values in
respect to navigation frame “n” can be Kalman Filter.
expressed as : Apply the mechanical relationship to the
θc ψc −φc ψs + φs θs ψc φs ψs + φc θs ψc
Kalman Filter form:
x (t ) = Φt x(t ) + w(t ) (6)
n −φs ψc + φc θs ψs
b C = θc ψs φc ψc + φs θs ψs
−θ z(t ) = Hx(t ) + v(t ) (7)
s φs θc φc θc
Where,
(1)
0 3×3 C 3
Φt = H = 0 6× 6 I6 ,
03×3 03×3 ,
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-81-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
0 n
−b C 33
n
C 32
2.2 Euler-based attitude estimation as
b comparison with DCM-based method
n n
C3 = b C 33 0 −b C 31
This method is described in [1]. The propag-
−n C n
0
b 32 b C 31 ation of Euler angles follows the equation:
With the state-variables: φ 1 sin φ tan θ cos φ tan θ ωx
b
bn C 31
ωz
b b b
θ = 0 − sin θ b ωy (14)
n n
x(t ) = b C 32 b C 33 ωx ωy cos θ
ψ 0 sin φ sec θ cos φ sec θ b
And measurements: ωz
z(t ) = b fx b fy b fz b ωx b ωy b ωz In this attitude estimation, two first line of
The noise covariance value of process model transfer matrix corresponding to two first
and measurement model follow: variables are needed only. Notice that this
relationship means whenever pitch angle reaches
T
0 9 ×9 0 9× 3 π / 2 , the state will be singularity. This is the
Q = E {w(t ) w (t )} = 0 q .I 3×3
(8)
3×3 first drawback of Euler method.
0 3× 3 Measurement model using accelerometers:
ra I 3×3 g sin θ
R = E {v(t ) vT (t )} = (9)
0 3×3 rg I 3×3 f (θ, φ) = (15)
g sin φ cos θ
Change to discrete model using van Loan
In order to establish the filter, extended Kalman
method,
filter in this case, first derivation is applied for
I 3×3 Cˆ3dT
Φk = (10) variable x = [θ φ ]T
03×3 I 3×3 ∂f (x )
Hk (x ) = (16)
dT 3Cˆ3CˆT3 dT 2Cˆ3 ∂x x =[θˆk− ,φˆk− ]
Qk = q (11) Error from the first order approximation is
dT 2CˆT3 dTI 3×3
another limitation of Euler-based method which
Accelerometer measurement noise DCM-based doesn’t have.
covariance values can be adjusted to compensate The table below shows the imaging about
the effect of external acceleration. q value is also executing speed of this DCM based attitude
chosen to maintain the smooth of output estimation compared with Euler based
response. estimation(The algorithm was tested with
1 Matlab Ver 7.1, on CPU P4 2.8 GHz):
ra = ra 0 → r , r = rg 0 → αrg 0 , q = const
α a0 g
Where, ra 0 , rg 0 is variance of static Table 1: Compare executing speed of Euler and
DCM attitude estimation for 10 seconds of
accelerometer and gyrometer data. The
measured data:
adjustment based on the following criteria: Method Euler DCM Ratio
f (ax , ay , az ) = ax2 + ay2 + az2 − 1 > σ (12) Process 25 (5x5) 36(6x6) 1/1.44
model matrix
Normalization is necessary for prevent the
Executed time 0.31 0.37 1/1.194
unit property. seconds seconds
x(i ) (13)
DCM (3, i ) i =1:3 =
∑ x (i)
i =1:3
2
3. ORIENTATION ESTIMATION
In this method, the process model is varied Orientation estimation is an extension of
as Φk is the function of Cˆ3 k . Due to its slow attitude estimation with the joining of magnetic
dynamic, state matrices can be considered as compass data. In this part, DCM based and
constant in the interval between two sampling Quaternion based orientation estimation are
times. The state matrices are in explicit form so compared. Moreover, two ways of magnetic
the filter can be prevented from the error of first compass using are examined.
order approximation.
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-82-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-83-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
Measurement model use three (Strapdown IMU) with Magnetic Compass was
accelerometers, b a , and three components of made. This model is modified from the Gimbal
magnetic compass, b m . And bn C(q) is the well- IMU of Matlab Aerospace Blockset. The most
difference between the two kinds of IMU is at
known conversion between DCM and
the platform where accelerometers are attached.
quaternion as [3]:
In Strapdown IMU, the platform rotates with
b a b C(q) 0(3×3) n go va (t )
n respect to the moving object while that of
b = n + v (t ) (26)
m 0(3×3) b
C(q ) m g Gimball IMU is kept stable.
n o So, the nominal measure value of
Because the nonlinear nature of (26), Strapdown IMU is:
extended Kalman Filter approach requires first b
Aideal = nbC n A + n ω × ( n ω × d ) + n ω × d − n g
order derivation around the current estimated
state to get the Jacobian matrix: (29)
b Where, the ideal measured acceleration
∂ a
Hk = (27) include the acceleration in the body axes at the
∂x b m center of gravity, lever arm effects due to the
x=xˆ−k
accelerometer not being at the center of gravity,
As example the element Hk (1,1) is given by:
and the Earth gravity vector. All of them are
2q − b C(1,1)q T considered in body fixed coordinate by
1 n 1
1 multiplied with DCM matrix.
Hk (1,1) = 2q2 − bn C(1, 2)q1 n m (28)
2 2 The real measured value contains error
e + q4
2q 3 − bn C(1, 3)q1 sources such as: uncertainty scale factor, cross
coupling, bias state and sensors noise:
This complexity leads to the large b
Areal = b Aideal Ksf _cc kbias + vnoise (30)
computational expense even though this method
need to update fours quaternion only.
Another drawback of this method is using
n 2 ω (rad/s) ω meas(rad/s)
earth magnetic vector m which magnitude w
T hree-axis Gyroscope
always be changed in the large range of time. To 1
GAM_meas
overcome this problem, initialization must be 1
DCM
DCM
2
pqr
done carefully to find out exactly the magnitude 3
G_meas
pdot qdot rdot
and orientation of magnetic field and this vector w_dot
4 Ab
Ameas 3
A_meas
would be used during the experiment. A_b
5 CG
with Matlab Ver 7.1, on CPU P4 2.8 GHz): 7 Mag Vector M_meas
m_vec
Magnetic Compass
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-84-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
deg
similar to the corresponding of accelerometers. 0
-0.5
5. SIMULATION EXAMINATION
-1
Roll Error
motion planning and Quaternion 6dof motion Pitch Error
1
planning. After that, use the Simulink
Strapdown IMU model that is described in 0.5
deg
0
support of this model, algorithm testing is much
easier, singularity points can be showed out -0.5
clearly.
-1
To adjust the accuracy of algorithm, average
absolute error and maximum error performance -1.5
0 1 2 3 4 5 6 7 8 9 10
1 N (c)
Se
N
∑ e2 (kT ) (33) Fig. 2 Attitude estimation, ordinary case,
k =1 compared between Euler and DCM method.
Me max e(kT ) (34) (a) DCM’s Estimated Roll and Pitch angles
k
In which, e(kT ) is the error between the compared with reference
(b) and (c) Angular error of DCM’s method
estimated angles and the true angle.
and corresponding of Euler’s. Average absolute
errors are attached with each figure title (p
5.1 Attitude estimation denoted for Roll, t for Pitch)
Simulation1: Ordinary case, examine the error
Notice: the errors of DCM tend to smaller
of each filter: DCM-based and Euler-based.
than that of Euler based attitude estimation. This
Reference signal archived from motion
aspect fits the discussion about the method error
generated model. Euler reference is given from
in part I. In this experiment, roll and pitch angle
Euler 6dof motion planning of Matlab
changing in the range of [−π / 2 : π / 2] so, there
Aerospace Blockset. DCM reference is given
from Quaternion one. is no singularity happens to Euler-based method.
Estimated roll
60 Reference roll
Estimated pitch
Whenever pitch angle reach exactly 90
50
Reference pitch degrees, there is a singularity occurs. This may
40
cause variable change unwillingly. With the
same rotation, DCM based attitude estimation
deg
30
has no bad effect even though the displays
20
angular is ambiguous as the result of the
10
conversion between the DCM states and the
0 displayed angle.
-10
0 1 2 3 4 5 6 7 8 9 10
t(s)
(a)
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-85-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
200
Simulation 3: Quaternion based orientation
estimation using earth magnetic vector.
100 Estimation(DCM)[Roll(φ ), Pitch(θ), Yaw(ψ ) ]
60
deg
0
40
-100
20
-200
0
-300
deg
-20
-400
0 1 2 3 4 5 6 7 8 9 10 -40
Estimated roll
t(s)
Reference roll
-60
Estimated pitch
(a) Reference pitch
Estimated Yaw
-80
Roll(φ ) Estimation(EULER), S = 2107.3958, M = 3056.4466
φ φ Reference Yaw
3500
Estimated roll -100
0 1 2 3 4 5 6 7 8 9 10
3000 Reference roll t(s)
2500 (a)
ERROR(DCM) [ Sp= 0.20934 , St= 0.15735, Ss= 0.21286 ]
2000 2
Error roll
deg
500
0.5
0 deg
0
-500
0 1 2 3 4 5 6 7 8 9 10
-0.5
t(s)
(b) -1
40
(b)
20
ERROR(Quaternion) [ Sp= 0.46653 , St= 0.39755, Ss= 0.40208 ]
2
deg
0
Error roll
-20 1.5 Error Pitch
Error Yaw
-40
1
-60
0.5
-80
deg
-100 0
0 1 2 3 4 5 6 7 8 9 10
t(s)
-0.5
(c) -1
Fig. 3 Attitude estimation, singularity case
-1.5
(a) and (b) Euler Estimated Pitch and Roll
angle compared with reference -2
0 1 2 3 4 5 6 7 8 9 10
t(s)
(c) DCM Estimated Pitch angle compared
with reference. Average absolute errors and (c)
maximum error are attached with each figure Fig. 4 Orientation estimation, compared
title. between DCM’s and Quaternion’s method.
(a) DCM’s Estimated Roll, Pitch and Yaw
Notice: In (a), the Euler estimated Pitch angles compared with reference
angle starts to be wrong when it reachs 90 (b) and (c) Angular error of DCM’s method
degrees. As the co-effect, roll angle, (c), is and corresponding of Quaternion’s. Average
wrong too. Because of the quantization reason, absolute errors are attached with each figure title
not every time pitch angle goes through (p denoted for Roll, t for Pitch, s for Yaw)
singularity points, this case happens.
Notice: Error of DCM based orientation
estimation is smaller those of quaternion as
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-86-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
-20
The still limitation of this method is that
-40
measurement noise covariance of magnetic
-60
compass could not be accessed directly. Even
-80 Estimated pitch though it gives another advantage that the
Reference pitch
-100
algorithm can give result at large range of earth
0 5 10 15 20 25 30 35 40
t(s) magnetic field magnitude without initialization
(a) and calibration.
ERROR(DCM) [ Sp= 1.904 , St= 0.98226, Ss= 2.1001 ]
10
ACKNOWLEDGMENT
5
The authors would like to express financial
0 supports from NARC(Network-based
Automation Research Center), post-BK(Brain
deg
-5
Korea) 21 program and Korea Research
-10
Foundation Grant (KRF-2005-D00238)
respectively.
Error roll
-15
Error Pitch
Error Yaw
REFERENCES
-20
0 5 10 15 20 25 30 35 40
t(s)
[1] Young-Soo Suh, Sang-Kyeong Park, Hee-
(b) Jun Kang, Young-Shick Ro “Attitude
Fig. 5 DCM based Orientation estimation, Estimation Adaptively Compensating
compared with commercial product. Average External Acceleration” JSME International
absolute errors and maximum error are attached Journal, 2006, Series C, Vol.49, No 1.
with each figure title (p denoted for Roll, t for [2] Nguyen Ho Quoc Phuong, Hee-Jun Kang,
Pitch, s for Yaw) Young-Soo Suh, Young-Shick Ro, Kyu-
Notice: For the rotation only experiment, Chan Lee. “A GPS/ INS Integration System
our DCM-based estimator gives not much for Land Vehicle Application”, SICE-
difference (2 degrees absolute average error) ICASE, International Joint Conference,
2006.
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-87-
Track 2: ELECTRONICS & TELECOMMUNICATIONS
International Symposium on Electrical & Electronics Engineering 2007 - Oct 24, 25 2007 - HCM City, Vietnam
-88-