Line 18: | Line 18: | ||
In order to achieve higher-level measurements such as 'dead reckoning' (calculation of position and orientation in 3D space), you will need to combine sensor readings. For example, an accelerometer, gyroscope, and magnetometer are commonly packaged together as an 'intertial measurement unit' (or IMU) to be used by 'quadcopter' hobbyists. This 'sensor fusion' also allows for sensors to recalibrate each other such that measurement 'drift' of certain sensors (esp. gyroscope) is minimized. This inter-recalibration can further benefit from probabilistic noise-reducing filters such as the Bayesian or Kalman filter. | In order to achieve higher-level measurements such as 'dead reckoning' (calculation of position and orientation in 3D space), you will need to combine sensor readings. For example, an accelerometer, gyroscope, and magnetometer are commonly packaged together as an 'intertial measurement unit' (or IMU) to be used by 'quadcopter' hobbyists. This 'sensor fusion' also allows for sensors to recalibrate each other such that measurement 'drift' of certain sensors (esp. gyroscope) is minimized. This inter-recalibration can further benefit from probabilistic noise-reducing filters such as the Bayesian or Kalman filter. | ||
− | + | The following video may give you a better idea of what an accelerometer can be used for. Extensive description provided at YouTube page (access by clicking on YouTube logo in lower right-hand side of video). | |
+ | <youtube>qPUylmWbKCc</youtube> | ||
<br> '''Continuous Equations''' | <br> '''Continuous Equations''' |
Revision as of 16:04, 11 November 2012
Determining Orientation from Accelerometer (alec green)
OUTLINE . introduction . continuous equations (..to be completed..) . discretization (..to be completed..) . references
Introduction
An accelerometer is useful for measuring orientation relative to Earth's surface ground ('static acceleration' due to gravitational force) or accelerating motion throughout space ('dynamic acceleration' due to non-gravitational force such as a car speeding up or a human shaking an accelerometer-clad device). However, note that accelerometers are implicity restricted to measuring acceleration, and cannot measure velocity. For example, constant nonzero velocity will produce same measurement as zero velocity.
It's important to first determine if an accelerometer is appropriate for your application. If you're not sure, you may consider other orientation/position sensing devices such as: gyroscope (angular velocity), magnetic compass (2D direction of maximum local magnetic field), magnetometer (magnitude and 3D direction of local magnetic field), GPS (rough 3D position).
In order to achieve higher-level measurements such as 'dead reckoning' (calculation of position and orientation in 3D space), you will need to combine sensor readings. For example, an accelerometer, gyroscope, and magnetometer are commonly packaged together as an 'intertial measurement unit' (or IMU) to be used by 'quadcopter' hobbyists. This 'sensor fusion' also allows for sensors to recalibrate each other such that measurement 'drift' of certain sensors (esp. gyroscope) is minimized. This inter-recalibration can further benefit from probabilistic noise-reducing filters such as the Bayesian or Kalman filter.
The following video may give you a better idea of what an accelerometer can be used for. Extensive description provided at YouTube page (access by clicking on YouTube logo in lower right-hand side of video).
Continuous Equations
It's instructive to read through pages 3-4 of [2] in order to understand how an accelerometer works on a physical level, but not necessary to interpret the analog or digital signals generated from the sensor.
Discretization
For reasons to soon be discussed, computing the above arctangent equations on an HCS12 microcontroller is non-trivial.
Based on [3], I considered two atan implementations:
- 'closed form' (finite number of terms) approximation
- lookup table (LUT) interpolation
The atan function you might normally invoke from the <math.h> library requires floating point numbers. An example implementation can be seen here [3].
Fixed-point (as opposed to floating point) processors like the HCS12 used in ECE 362 at Purdue make it difficult to deal with functions like arctangent because the dynamic range (ratio of max measureable qty : min measurable qty) is small. To make this notion explicit, suppose we are given 2 8-bit unsigned integer values 73 and 139 which we know should lie within the closed range [0,255]. Now, suppose these values represent the non-hypotenuse sides of a right triangle and we would like the calculate one of the right triangle's angles with the closed form approximation described above. One such angle could be arctan(73/139) ~= (73/139)^2 / (1+ .28125*(73/139)^2).
References
[1] Freescale Semiconductor, "±1.5g, ±6g Three Axis Low-g Micromachined Accelerometer" Freescale Datasheet. <http://www.sparkfun.com/datasheets/Components/General/MMA7361L.pdf>
[2] L. Salhuana, "Tilt Sensing Using Linear Accelerometers," Freescale Application Note. <http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf>
[3] A. Ukil et al., "Fast Computation of arctangent Functions for Embedded Applications: A Comparative Analysis," IEEE ISIE 2011. <http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5984330>
[4] "atan.c," Apple Open Source. <http://opensource.apple.com/source/Libm/Libm-315/Source/Intel/atan.c>