Professional Documents
Culture Documents
Better Motion Control Using Accelerometer/gyroscope Sensor Fusion
Better Motion Control Using Accelerometer/gyroscope Sensor Fusion
Where were we
http://mylifewithandroid.blogspot.com/"#$$/$#/my) presentation)about)motion.html
'cceleration
'cceleration caused by the change of direction 'cceleration caused by the change of (elocity
($ d* (" (" ($
d*
V a= t
'ccelerometer data is a (ector% ha(ing - a,es .,%y%/0 1his (ector has the following components:
Gra(ity acceleration
Pointing toward the center of the +arth *alue of about $# m/s" 1hat2s what we measure when the accelerometer is used to calculate tilt 'dded to the gra(ity acceleration 4!isturbs5 tilt measurement in gaming .swift mo(ements cause acceleration0 6 hence the reason for gyroscopes 7an be used for mo(ement detection
&easured acceleration
'bsolute (alue
,% y% /: acceleration (ector components g 6 (alue of the gra(ity acceleration .can be appro,imated as $#0
a= x + y + z g
2 2 2
7onclusions:
Power consumption is a problem Some neat functionality can be implemented by doing pattern recognition on the acceleration (ector2s absolute (alue 9n general case the gra(ity and motion acceleration components cannot be separated You can try to use an additional sensor like the gyro to help the separation
Gyroscope
*ery new phenomenon as gyroscopes suitable for consumer electronic de(ices appeared (ery recently :irst appearance: Wii &otion Plus accessory% "##; <une :irst 'ndroid smart phone: =e,us S .end of "#$#0 Pros:
=ot sensiti(e to gra(ity 7urrently supported only by high)end 'ndroid phones !rift problems .more about that later0
7ons:
7ompass
&easures the de(ice orientation wrt. the magnetic (ector of the +arth
9t has a component that points to the magnetic =orth pole 6 that2s what we use for orientation Beware of the / component> .also called magnetic inclination0. 9f the de(ice is not held hori/ontally% the downward (ector element influences the measurement
Pros:
7an be used to deduce gra(ity% not sensiti(e to motion acceleration Widely a(ailable in 'ndroid de(ices ?e@uires calibration Sensiti(e to metal ob3ects% magnetic fields .e.g. electric motors0
7ons:
Gyroscope
&easures rotation around - a,es &ore e,actly: measures rotation speed .angular (elocity0 around the a,es
v x= t
= v x t
' =+
!rift
=oise
1he accelerometer has no accumulated error but has the gra(ity component problem 1he gyro has accumulated error but is not sensiti(e to gra(ity
Sensor fusion: the use of multiple sensors so that they compensate each other2s wea8nesses
'ccelerometer)gyro fusion
Ase the (irtual sensors that calculate gra(ity and linear acceleration from multiple sensors Process raw accelerometer and gyroscope data to yield the motion information you need
*irtual sensors
Gra(ity and motion acceleration deduced from the accelerometer and the gyroscope ?oll/pitch/yaw from the compass !rift)compensated gyroscope
!rift)compensated gyroscope
Sensor fusion co)processing pro(ided by the phone is not precise enough or can ha(e undesirable properties .li8e auto)calibration in =e,us S0 *irtual sensors are not a(ailable .is there any such case with gyro)e@uipped phone 0 Bou would li8e to understand how it wor8s and what to e,pect from built)in sensor fusion <ust for the fun of it :)0
What we want
?emember: accelerometer measures the sum of gra(ity and motion acceleration Cills two use cases:
9f you need de(ice tilt% the motion acceleration component corrupts the measurement 9f you want motion acceleration% it is impossible to subtract the gra(ity acceleration in a general case
Separate gra(ity and motion acceleration with the help of the gyroscope
9dea
9dea in words
Pic8 a reliable gra(ity (ector measurement .ma8e sure that there2s no motion then0 9f you detect motion .more about later0% rotate the pre(ious gra(ity (ector using the gyroscope data and use it as gra(ity (ector estimation Subtract this gra(ity (ector estimation from the measured acceleration 6 this yields the motion acceleration
1he gra(ity (ector estimation has to be updated time to time as rotation angle errors accumulate 9f we detect an acceleration measurement where there is no motion acceleration% we can ta8e it as new reliable gra(ity (ector estimation ?emember slide DE: if the absolute (alue of the accelerometer output is close to the +arth2s gra(ity% we can assume that there2s no motion F the gra(ity (ector estimation can be updated with the current accelerometer output
9mplementation
=ow what
?ecogni/ing motion
?ecord acceleration pattern of reference motion and compare with these references 7on(ert from acceleration domain to something more intuiti(e li8e (elocity
'ccelerometer/gyroscope bias will become linearly growing drift after you integrate the acceleration signal>
7utting corners
7onclusions
+ach sensor has strengths and wea8nesses 7ombine them and they compensate each other Some sensor fusion is already built)in 9f not F don2t worry% come up with your own% it2s fun> &otion recognition based on -! linear acceleration signal is much more e,act than doing the same from $! signal
Guestions