74

I am developing an Android App to track indoor position. My phone is an Google Nexus S using two sensors, the first being an Accelerometer and the second being a Gyroscope.

My idea is that from a starting reference point (a known GPS position), using the 2 sensors (accelerometer for motion and Gyro for directions) track the phone when moving. And display on a map when the user is going.

But the problem is that i have no idea how to combine both of these sensors to give me an actual position?

I have read some article on internet that talk about "kalman filter" and after some more research i found out that that filter is very very complex /too much for me) especially to code it in java for Android (cpu killer)

Does someone has some experience that he can share with me about indoor positioning system using Gyro and accelerometer?

Alexis
  • 1,539
  • 4
  • 18
  • 22

5 Answers5

71

Gyros and accelerometers are not enough.

You get position by integrating the linear acceleration twice but the error is horrible. It is useless in practice.

Here is an explanation by (Google Tech Talk) at 23:20. I highly recommend this video.

As for indoor positioning, I have found these useful:

I have no idea how these methods would perform in real-life applications or how to turn them into a nice Android app.

A similar question is Calculating distance within a building.

Ali
  • 51,545
  • 25
  • 157
  • 246
  • 2
    yep I also found those documents, but they don't explained HOE they achieve to do such things most of those paper just nice result on a path track on a 2D map. But no code? no complete calculation? – Alexis Sep 24 '11 at 01:04
  • @ina Well, yes, a slightly updated answer is [here](http://stackoverflow.com/a/7835988/341970). – Ali Feb 14 '12 at 09:45
  • I just got this project started. We'll look onto it further. But thanks to the video – Jayson Ragasa Jul 05 '12 at 15:36
  • The 1 degree offset in gravity compentsation leading to 8.5m error in the first second seems intutively very wrong to me. If I set my selfmade drones to hover at 1 degree offset thrust vector they would not at all drift 8 meters in the first second. 10-50cm would seem more likely to me. Can anyone confirm the calculations in the video? – Soren Havelund Welling May 22 '18 at 08:29
  • 1
    @Soren You are right, the error in the first second would be "only" 8.6 cm. We have a_error=[cos(1 degree)-1, sin(1 degree)]·9.8 m s^-2. Then calculate 0.5·a_error·t^2 – AvD Jan 03 '19 at 16:42
  • 1
    @AvD Indeed, it is ca. 8.5cm according to my own calculations too. The formulas are correct in the video, but they messed up the m vs. cm conversion somewhere. The guy says 8.5 meters when it is 8.5 centimeters in reality. Keep in mind though that this error is growing in a *parabolic* rate, so in 10 seconds it becomes ca. 8.5 meters. :( – Ali Jan 03 '19 at 17:42
7

I think this is a great post answering your question. This kalman filter combine data from accelerometers and gyros. Hope it helps.

Allen Jee
  • 679
  • 2
  • 7
  • 13
  • Chrome warns that the link hosts malware. Is the same content available elsewhere? – Tom Jun 13 '13 at 11:32
  • Thanks for the remind. I update the link. As the post works well when I made the comment, could you cancel your down-vote? @Tom – Allen Jee Jun 14 '13 at 02:34
1

I think it is too late for answer this question, but now, there is a good solution called iBeacon technology.

You can scan iBeacon devices by your smartphone, and you can get the rssi from iBeacon. So, you can calculate your position by those rssi.

Stanley Ko
  • 2,754
  • 3
  • 28
  • 50
  • Not really, iBeacons do indeed have the rssi information but it isn't so accurate, any object moving by can and will interfer with the signal, therefore not so trustable. Still, it is possible to use as range powers, as it's done natively (immediate, near, far and unknown). – Samuel Cortez Jul 17 '17 at 23:22
  • @Samuel Cortez 3 With RSSI, you can get inaccurate position like "You are nearby bookstore". And if you need more accurate position, you can use three or more beacon to use triangulation. As you mentioned, rssi is inaccurate. So you need to use filter (eg. low pass) to get clear signal. – Stanley Ko Jul 18 '17 at 02:37
  • iBeacon trilateration is a terrible idea and doesn't work in practice. However, you can use iBeacons as pretty key chains after failing to realize your trilateration dreams. Everything @Samuel said is right. – nurettin Dec 20 '17 at 11:27
  • @nurettin Well, with extended kalman filter, it worked in practice. Believe me, I worked for the iBeacon manufacturing company. GPS in your phone is inaccurate too, but with extended kalman filter in GPS chip, it works. Only problem was people doesn't want that. And scanning bluetooth consumes too much battery. – Stanley Ko Dec 21 '17 at 01:42
  • @StanleyKou Thanks, I looked it up, the extended kalman filter method really exists and there are papers which confirm that it works (trilateration doesn't work, but circle intersection method works) – nurettin Dec 21 '17 at 05:51
1

To track indoor position starting from some reference point, only gyro and accelerometer is not enough. With accelerometer you can calculate speed, with gyro you can get direction of the mobile device, but to calculate indoor position you also need to have direction of movement, so for this case you need to use magnetic sensor. Such approach is called Dead Reckoning method and it's quite complex to combine all 3 sensors to get appropriate indoor position. Kalman filters allow you to smooth your measurement and filter some noise, but it's not the method to calculate indoor position. If you want to get indoor position you can try iBeacon approach and Trilateration method, there are some libraries (like this one) that already has this functionality, so you can try to investigate this method from such libs.

Dr.Lean
  • 171
  • 5
1

For some other interesting reading on emerging indoor positioning technologies, check out this blog post from Qubulus. There are several startups and research projects trying to find a good replacement for GPS indoors. Attempts range from Dead Reckoning, to QR Codes, to light pulses, to radio fingerprinting. It looks like any viable solution will combine multiple technologies (similar to how most smartphones rely on A-GPS, where the satellite signal is assisted by cell tower multilateration).

Best of luck with your application!

endolith
  • 21,410
  • 30
  • 114
  • 183
nicksuch
  • 1,464
  • 11
  • 11