Inertial Measurement Units II: Gordon Wetzstein! Stanford University!
Inertial Measurement Units II: Gordon Wetzstein! Stanford University!
Inertial Measurement Units II: Gordon Wetzstein! Stanford University!
Gordon Wetzstein!
Stanford University!
!
wikipedia!
Lecture Overview!
oculus.com!
from lecture 2:!
vertex in clip space! vertex!
oculus.com!
from lecture 2:!
vertex in clip space! vertex!
rotation! translation!
M view = R ⋅T ( −eye )
oculus.com!
Euler angles !
θy
rotation! translation!
θx M view = R ⋅T ( −eye )
θz
( )
R = Rz ( −θ z ) ⋅ Rx ( −θ x ) ⋅ Ry −θ y
roll! pitch! yaw!
oculus.com!
Euler angles !
θy
2 important
coordinate systems: !
body/sensor world/inertial
frame! frame!
θx M view = R ⋅T ( −eye )
θz
( )
R = Rz ( −θ z ) ⋅ Rx ( −θ x ) ⋅ Ry −θ y
roll! pitch! yaw!
oculus.com!
Gyro Integration aka Dead Reckoning!
∂
θ ( t + Δt ) ≈ θ ( t ) + θ ( t ) Δt + ε , ε ∼ O ( Δt 2 )
! ∂t
want: angle at!
current time step!
= ω approximation error!!
( ) (
θ (t ) = α θ (t−1) + ω! Δt + (1− α ) atan2 a! x , a! y )
• no drift, no noise!!
Tilt from Accelerometer!
• assuming acceleration points up (i.e. no external forces), we can
compute the tilt (i.e. pitch and roll) from a 3-axis accelerometer !
⎛ 0 ⎞ ⎛ 0 ⎞
a!
â =
a! ⎜ ⎟
( )
= R ⎜ 1 ⎟ = Rz ( −θ z ) ⋅ Rx ( −θ x ) ⋅ Ry −θ y ⎜ 1 ⎟
⎜ ⎟
⎝ 0 ⎠ ⎝ 0 ⎠
⎛ − cos ( −θ ) sin ( −θ )
⎜
x z
⎞
⎟ ( ( )
θ x = −atan2 âz ,sign ây ⋅ âx2 + ây2 )
= ⎜ cos ( −θ x ) cos ( −θ z ) ⎟
⎜ ⎟ θz = −atan2 ( − â , â ) both in rad
sin ( −θ x )
x y
⎜⎝ ⎟⎠
Euler Angles and Gimbal Lock!
The Guerrilla CG Project, The Euler (gimbal lock) Explained – see: https://www.youtube.com/watch?v=zc8b2Jo7mno!
Rotations with Axis-Angle Representation
and Quaternions!
Rotations with Axis and Angle Representation!
⎛θ ⎞ ⎛θ ⎞ ⎛θ ⎞ ⎛θ ⎞
q (θ ,v ) = cos ⎜ ⎟ + i vx sin ⎜ ⎟ + j vy sin ⎜ ⎟ + k vz sin ⎜ ⎟
⎝ 2⎠ ⎝ 2⎠ ⎝ 2⎠ ⎝ 2⎠
!"
# # $ !#"# $ !#"# $ !#"# $
qw qx qy qz
Quaternions!
⎛θ ⎞ ⎛θ ⎞ ⎛θ ⎞ ⎛θ ⎞
q (θ ,v ) = cos ⎜ ⎟ + i vx sin ⎜ ⎟ + j vy sin ⎜ ⎟ + k vz sin ⎜ ⎟
⎝ 2⎠ ⎝ 2⎠ ⎝ 2⎠ ⎝ 2⎠
!"
# # $ !#"# $ !#"# $ !#"# $
qw qx qy qz
qu = 0 + i u x + j u y + k uz
!
i (q p + q p + q p − q p ) +
w x x w y z z y
j (q p − q p + q p + q p ) +
w y x z y w z x
k (q p + q p − q p + q p ) +
w z x y y x z w
Quaternion Algebra!
(t )
• last estimate q is either from gyro-only (for dead reckoning)
or from last complementary filter!
(body )
qa = 0 + ia! x + ja! y + ka! z
Tilt Correction with Quaternions!
• assume accelerometer measures gravity vector in body
(
(sensor) coordinates! a! = a! , a! , a!
x y z )
• transform vector quaternion of a! into current estimation of
world space as!
( world ) (t+Δt ) ( body ) (t+Δt )−1
qa = qω qa qω
( world )
how? get normalized vector part of vector quaternion! qa
⎛ n ⎞ (t+Δt )
qc (t+Δt )
= q ⎜ (1− α )φ , ⎟ qω 0 ≤α ≤1
⎝ n ⎠
−1
( world )
• rotation of any vector quaternion is then ! qu = qc(t+Δt )qu( body )qc(t+Δt )
Integration into Graphics Pipeline!
(t+Δt )
• compute qc via quaternion complementary filter first !
• set view matrix to M view = Rc−1 to rotate the world in front of the
virtual camera !
Head and Neck Model!
y θx θz
y
lh
ln IMU!
ln
−z x
pitch around base of neck!! roll around base of neck!!
Head and Neck Model!