ceng4480 lecture 08 kalman filter
play

CENG4480 Lecture 08: Kalman Filter Bei Yu byu@cse.cuhk.edu.hk - PDF document

CENG4480 Lecture 08: Kalman Filter Bei Yu byu@cse.cuhk.edu.hk (Latest update: November 18, 2019) Fall 2019 1 / 26 Overview Introduction Complementary Filter Kalman Filter Software 2 / 26 Overview Introduction Complementary Filter


  1. CENG4480 Lecture 08: Kalman Filter Bei Yu byu@cse.cuhk.edu.hk (Latest update: November 18, 2019) Fall 2019 1 / 26

  2. Overview Introduction Complementary Filter Kalman Filter Software 2 / 26

  3. Overview Introduction Complementary Filter Kalman Filter Software 3 / 26

  4. Self Balance Vehicle / Robot ◮ http://www.segway.com/ ◮ http://wowwee.com/mip/ 3 / 26 The WowWee MiP Robot paired with WowWee’s free app creates a consumer robot with lots of potential. Relatively small in size, the WowWee MiP Robo is only 7 inches tall and has no feet. It is black and white in design with a round head and emoticon eyes. It might remind you of Disney’s Wall-E. The WowWee MiP Robot can balance and move quite well, similar to a Segway. The connection is extremely easy. To connect MiP to your mobile device you simply need to download the app. Once opened the MiP’s ID will appear on the screen and you choose how you want to control the robot.

  5. Basic Idea Motion against the tilt angle, so it can stand upright. 4 / 26

  6. IMU Board http://www.hotmcu.com/imu-10dof-l3g4200dadxl345hmc5883lbmp180-p-190.html ◮ L3G4200D: gyroscope, measure angular rate (relative value) ◮ ADXL345: accelerometer, measure acceleration 5 / 26

  7. Overview Introduction Complementary Filter Kalman Filter Software 6 / 26

  8. Complementary Filter g X now sees some gravity. X reads slightly positive. X reads slightly negative Gyro reads positive. Gyro reads negative. Accelerometer Gyroscope ◮ Give accurate reading of tilt angle ◮ Slower to respond than Gyro’s ◮ response faster ◮ but has drift over time ◮ prone to vibration/noise 6 / 26

  9. Complementary Filter (cont.) ◮ Since Gyroscope Accelerometer High Low frequency frequency ◮ Combine two sensors to find output 7 / 26

  10. Complementary Filter (cont.) Mapping Sensors Complementary Filter Y X Low-Pass Σ Filter Angle High-Pass Numeric Filter Integration Angular Velocity Read_acc(); Read_gyro(); Ayz=atan2(RwAcc[1],RwAcc[2])*180/PI; //angle by accelerometer Ayz-=offset; //adjust to correct Angy = 0.98*(Angy+GyroIN[0]*interval/1000)+0.02*Ayz; //complement filter 8 / 26

  11. Overview Introduction Complementary Filter Kalman Filter Software 9 / 26

  12. Rudolf Kalman (1930 – 2016) ◮ Born in Budapest, Hungary ◮ BS in 1953 and MS in 1954 from MIT electrical engineering ◮ PhD in 1957 from Columbia University. ◮ Famous for his co-invention of the Kalman filter – widely used in control systems to extract a signal from a series of incomplete and noisy measurements. ◮ Convince NASA Ames Research Center 1960 ◮ Kalman filter was used during Apollo program 9 / 26 He was a professor at Stanford University from 1964 until 1971, and then at the University of Florida from 1971 until 1992

  13. Problem Example 1 Self-Driving Car Location Problem 10 / 26

  14. Problem Example 1 Self-Driving Car Location Problem 10 / 26

  15. Problem Example 1 Self-Driving Car Location Problem 10 / 26

  16. Exercise: Analyse Kalman Gain What is Kalman Gain K k , if measurement noise R is very small? What if R is very big? 11 / 26

  17. Problem Example 2 Angle Measurement System x t = A t x t − 1 + B t u t + w t ◮ x t : state in time t ◮ A t : state transition matrix from time t − 1 to time t ◮ u t : input parameter vector at time t ◮ B t : control input matrix – apply the effort of u t ◮ w t : process noise, w t ∼ N ( 0 , Q t ) ∗ ∗ w t assumes zero mean multivariate normal distribution, covariance matrix Q t 12 / 26

  18. Problem Example 2 (Update on Oct. 29, 2018) Angle Measurement System x t = A t x t − 1 + B t u t + w t x t ] ⊤ : x t is current angle, while ˙ ◮ x t = [ x t , ˙ x t is current rate � 1 � ∆ t ◮ A t = 0 1 ◮ B t = [(∆ t ) 2 , ∆ t ] ⊤ 2 ◮ u t = ∆ ˙ x t 13 / 26

  19. Problem Example 2 System Measurement z t = Cx t + v t ◮ z t : measurement vector ◮ C : transformation matrix mapping state vector to measurement ◮ v t : measurement noise, v t ∼ N ( 0 , R t ) † † w t assumes zero mean multivariate normal distribution, covariance matrix R t 14 / 26

  20. Exercise In angle measurement lab, what is the transformation matrix C ? z t = Cx t + v t 15 / 26 [1, 0]

  21. Model with Uncertainty ◮ Model the measurement w. uncertainty (due to noise w t ) ◮ P k : covariance matrix of estimation x t ◮ On how much we trust our estimated value – the smaller the more we trust note: here F k = A k 16 / 26

  22. Fuse Gaussian Distributions 17 / 26

  23. Fuse Gaussian Distributions 17 / 26

  24. Exercise Given two Gaussian functions y 1 ( r ; µ 1 , σ 1 ) and y 2 ( r ; µ 2 , σ 2 ) , prove the product of these two Gaussian functions are still Gaussian. − ( r − µ 1 ) 2 − ( r − µ 2 ) 2 1 1 2 σ 2 2 σ 2 y 1 ( r ; µ 1 , σ 1 ) = y 2 ( r ; µ 2 , σ 2 ) = e e 1 2 � � 2 πσ 2 2 πσ 2 1 2 18 / 26

  25. Step 1: Prediction x − t = A t x t − 1 + B t u t (1) P − t = A t P t − 1 A ⊤ t + Q t (2) 19 / 26

  26. Step 1: Prediction x − t = A t x t − 1 + B t u t (1) P − t = A t P t − 1 A ⊤ t + Q t (2) Step 2: Measurement Update x t = x − t + K t ( z t − Cx − t ) (3) P t = P − t − K t CP − (4) t t C ⊤ + R t ) − 1 K t = P − t C ⊤ ( CP − (5) 19 / 26

  27. Basic Concepts 20 / 26

  28. More Applications: Robot Localization 21 / 26

  29. More Applications: Path Tracking 22 / 26

  30. More Applications: Object Tracking 23 / 26

  31. Overview Introduction Complementary Filter Kalman Filter Software 24 / 26

  32. C Implementation // Kalman filter module float Q_angle = 0.001; float Q_gyro = 0.003; float R_angle = 0.03; float x_angle = 0; float x_bias = 0; float P_00 = 0, P_01 = 0, P_10 = 0, P_11 = 0; float dt, y, S; float K_0, K_1; ◮ Q : ◮ R : ◮ P : 24 / 26

  33. C Implementation (cont.) float kalmanCalculate( float newAngle, float newRate, int looptime) { dt = float (looptime)/1000; x_angle += dt * (newRate - x_bias); P_00 += dt * (P_10 + P_01) + Q_angle * dt; P_01 += dt * P_11; P_10 += dt * P_11; P_11 += Q_gyro * dt; y = newAngle - x_angle; S = P_00 + R_angle; K_0 = P_00 / S; K_1 = P_10 / S; x_angle += K_0 * y; x_bias += K_1 * y; P_00 -= K_0 * P_00; P_01 -= K_0 * P_01; P_10 -= K_1 * P_00; P_11 -= K_1 * P_01; return x_angle; } 25 / 26

  34. Summary ◮ Complementary Filter ◮ Kalman Filter 26 / 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend