# Measure the length of curves via a smartphone's accelerometer

Is it possible to measure the length of curves by moving a smartphone along them and processing the accelerometer's data?

For example, measure the circumference of a circle of radius $8 \,\rm{cm}$. I've read that accelerometers have noise but I've also read that their accelerometers are very accurate. What does it mean? Can we filter out that noise? What are the types of noise in this problem?

• In practice, smartphone accelerometer data is noisy enough that double integration over even short distances, without recalibration using another reference (camera, etc.) at the endpoints or more often, very often results in garbage. “Sensor fusion” might be a useful search phrase. – hotpaw2 Feb 16 '18 at 16:34
• Thanks for your comment. "Sensor Fusion" was interesting. @hotpaw2 – HsnVahedi Feb 16 '18 at 19:30

Accelerometers and gyroscopes provide corrupted measures of the acceleration $a$ and angular velocity $\omega$. So, they need to be preprocessed in order to use them.

Firstly, measure provided by the accelerometer ($a'$) is affected by Earth gravity $g$ (in the local frame reference), a bias $b_g$ and some random noise $\eta_a$. So if the true acceleration is called $a$, one has that measure is:

$$a' = a + g + b_a + \eta_a$$

So in order to integrate accelerometer measures, one should know at least $b_a$ and $g$ in the accelerometer frame, and subtract them from $a'$. Moreover, in some datasheets you can find covariance of $\eta_a$. However, bias is time dependent term and it needs to be estimated each time we initialize the system, as well as the gravity in the local frame. In some cases, if the movement is not in gravity direction (2D movement) and gravity is aligned to some accelerometer axis (lets say $z$ axis), one can neglect $a_z$ and the knowledge of $g$ is not required (maybe it is your case).

Secondly, gyroscope is also corrupted by bias $b_g$ and noise $\eta_g$. So, if the true angular speed is $\omega$, one has that the measure is:

$$\omega' = \omega +b_g + \eta_g$$

Again, you need to know at least the gyro bias. and subtract it from the measure.

Everything becomes easier if your device has no bias or it can be neglected w.r.t $a$ and $\omega$, and your movement is 2D (gravity is always oriented in the same way).

So once that you have your corrected measures, you can integrate them to obtain the trajectory: $$R(t+\Delta t) = R(t) \exp(\omega \Delta t)$$ $$p(t+\Delta t) = p(t) +v(0) t + \frac{1}{2}R(t)a(t)t²$$ Where $R$ is the rotation matrix (see rotation matrix) and $\exp$ is the exponential map (see exponential map). $v(0)$ is the initial speed.

It can be concluded that having a known initial speed, a 2D movement, and a low corrupted gyro/accelerometer, it can be easily estimated the trajectory.

Edit: Calibration (i.e. getting $g$, $b_a$ and $b_g$) can be intermediately done if device remains static. In this case, accelerometer gives $a' = g + b_a +\eta_a$ and gyro gives $\omega' = b_g + \eta_g$

• Thanks a lot for your answer! You described (a′) and (ω′) so nicely by those equations. And that made me think better about this problem. But can you show me some evidence for those equations? I mean: Are you sure there isn't any other parameter effecting (a′) and (ω′)? – HsnVahedi Feb 16 '18 at 19:40
• @HsnVahedi, I come from Computer Vision field and I have been working with IMU (inertial measurement units) for a while. All that I have read about this has only considered bias and noise as described in my answer. You can find really good references about this topic up on the net (github.com/ethz-asl/kalibr/wiki/IMU-Noise-Model base.xsens.com/hc/en-us/articles/…) and some related questions in SE (robotics.stackexchange.com/questions/14104/…) Could you describe which is your purpose? I would be happy to help – Carlos Campos Feb 16 '18 at 20:29
• to see how you can calibrate accelerometer, see this: dsp.stackexchange.com/questions/49870/… – HsnVahedi Jun 16 '18 at 20:49