How to calculate the movement of the phone in the vertical direction from rest?

I am developing an application using the Android OS, for which I need to know how I can calculate the movement of the device in the vertical direction.

For example, the device is at rest (point A), the user takes it in his hand (point B), now there is a change in height between point A and point B, how would I calculate this?

I already looked at articles about sensors and accelerometers, but I could not find anything that could help me with this. Does anyone have any idea?

+6
android accelerometer sensor compass-geolocation
Jun 09 2018-11-11T00:
source share
3 answers

If you integrate acceleration twice, you get a position, but the error is terrible. In practice, this is useless. Here is an explanation of why (Google Tech Talk) at 23:20. I highly recommend this video.

Now you do not need anything, and this is a completely different story. linear acceleration is available after sensor fusion, as described in the video. See "Sensor". TYPE_LINEAR_ACCELERATION on SensorEvent . I would first try a high-pass filter to detect a sudden increase in linear acceleration along the vertical axis.

I do not know if this is good for your application.

+5
Jun 09 2018-11-11T00:
source share

In fact, you can set (only) the vertical position without measuring acceleration over time. This is achieved by measuring the angle between the direction to the center of the earth and the direction to the magnetic north pole.

This changes (significantly) when the height (height) of the phone changes. You can use accelerometer and magnetometer to get two float arrays [3], treat them as vectors, make them unit vectors, and then the angle between any two unit vectors - arccos (AxM).

Pay attention to the point product, i.e. math.acos(A[0]*B[0]+A[1]*B[1]+A[2]*B[2]) Any change in this angle corresponds to a change in height. Also note that this will need to be calibrated to real units, and the ratio of the change in angle to height will differ at different longitudes; But this is a method of obtaining the absolute value of the height; although, of course, the angle also becomes distorted during acceleration or in the presence of nearby magnets :)

+3
Jan 21 '14 at 2:20
source share
  • you can match it with a magnetic field sensor in microTesla

  • You can use dist = the integral of the acceleration summation integral ~ sigma = the integral of speed + constant

0
Dec 06 '13 at
source share



All Articles