Module 4 - 1D Kalman Filters For Orientation
Module 4 - 1D Kalman Filters For Orientation
1. Sensor Types
2. MEMS Accelerometers
3. MEMS Gyroscopes
4. MEMS Magnetometers
5. Accelerometer-based Euler angles estimation
6. Gyroscope-based Euler angles estimation
7. Accelerometer-Magnetometer-based Euler angles
estimation
2
Prediction
based on the
𝑋𝑘−1 𝑋𝑘−
model
Correction
Filter OUTPUT based on new Filter INPUT
𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑠 measurements 𝑀𝑒𝑎𝑠𝑢𝑟𝑒𝑚𝑒𝑛𝑡𝑠
𝑋𝑘 𝑍Ԧ𝑘
3
4
Equation 1 - State Extrapolation Equation
(or Predicted (a priori) state estimate)
5
Equation 2 - Covariance Extrapolation Equation
(or Predicted (a priori) error covariance)
6
Equation 3 – Kalman Gain Equation
7
Equation 4 – State Update Equation
8
Equation 5 – Covariance Update Equation
(or Updated (a posteriori) estimate covariance)
9
10
11
4.1
13
Then for the State Extrapolation Equation
𝑭𝑘 = 𝑭 = 1 𝑩𝑘 = 𝑩 = ∆𝑡 𝑼𝑘 = 𝜔𝑘𝑋 𝑿− 𝑋
𝑘 = 𝑿𝑘−1 + 𝜔𝑘 ∙ ∆𝑡
where 𝜃෨𝑘𝑋 denotes the angle derived from corresponding Accel measurement.
14
For the Kalman Gain Equation
𝑷−
𝑘
𝑹𝑘 = 𝑹 = 𝜎𝐴2 𝑺𝑘 = 𝑷−
𝑘 +𝑹
𝑲𝑘 = −
𝑷𝑘 + 𝑹
𝑿𝑘 = 𝑿− − − − ෨𝑋 −
𝑘 + 𝑲𝑘 ∙ 𝒀𝑘 = 𝑿𝑘 + 𝑲𝑘 𝒁𝑘 − 𝑯 ∙ 𝑿𝑘 = 𝑿𝑘 + 𝑲𝑘 𝜃𝑘 − 𝜃𝑘
𝑷𝑘 = 𝑰1𝑥1 − 𝑲𝑘 ∙ 𝑯 𝑷− −
𝑘 = 1 − 𝑲𝑘 𝑷𝑘
15
Depict initial filter parameters (Gyro std (from datasheet?) and Accel std (from meas?))
16
4.2
Beforehand we have to measure (or know) Gyro, its bias and Accel measurements
std values: 𝜎𝐺 , 𝜎𝑏 𝐺 and 𝜎𝐴
18
Then for the State Extrapolation Equation
1 −∆𝑡 ∆𝑡
𝑭𝑘 = 𝑭 = 𝑩𝑘 = 𝑩 = 𝑼𝑘 = 𝜔𝑘𝑋 𝑿−
𝑘 = 𝑭 ∙ 𝑿𝑘−1 + 𝑩 ∙ 𝑼𝑘
0 1 0
10 0 𝜎𝐺2 0
𝑷𝑘−1 = 𝑷𝑖𝑛𝑖𝑡 = 𝑸𝑘 = 𝑸 = 2 ∙ ∆𝑡 𝑷− 𝑻
𝑘 = 𝑭 ∙ 𝑷𝑘−1 ∙ 𝑭 + 𝑸
0 10 0 𝜎𝑏 𝐺
where 𝜃෨𝑘𝑋 denotes the angle derived from corresponding Accel measurement.
19
For the Kalman Gain Equation
𝑹𝑘 = 𝑹 = 𝜎𝐴2 𝑷−
𝑘 ∙𝑯
𝑻
𝑺𝑘 = 𝑯 ∙ 𝑷−
𝑘 ∙ 𝑯𝑻 + 𝑹 𝑲𝑘 =
𝑯 ∙ 𝑷− 𝑻
𝑘 ∙𝑯 +𝑹
𝑿𝑘 = 𝑿− − − − ෨𝑋 −
𝑘 + 𝑲𝑘 ∙ 𝒀𝑘 = 𝑿𝑘 + 𝑲𝑘 𝒁𝑘 − 𝑯 ∙ 𝑿𝑘 = 𝑿𝑘 + 𝑲𝑘 𝜃𝑘 − 𝜃𝑘
20
Depict initial filter parameters (Gyro std (from datasheet?) and Accel std (from meas?))
21
3.4
Practical Tasks
1. Capture Gyroscope measurements which correspond to the following test cases:
device is in level plane, wait 3-5 sec., then rotate it to 900 around X, Y or Z axis,
hold in rotated position 3-5 sec., then return back to initial position and wait for 3-5
sec. (log 1); perform the same as in test case 1 but three-four times (log 2);
2. Show the dependencies of Gyroscope vector components on time; explain the results
and prove why the plots correspond to the test cases;
3. Calculate angle values using all three methods discussed; analyze the results and
find the most accurate one;
4. Show and explain the pros and cons of angles estimation using Gyroscope
measurements only.
23