0

Is it possible to calculate small distances with CoreMotion?

For example a user moves his iOS device up or down, left and right and facing the device in front of him (landscape).

Raptor
  • 53,206
  • 45
  • 230
  • 366
tapmonkey
  • 141
  • 2
  • 9
  • possible duplicate of [Getting displacement from accelerometer data with Core Motion](http://stackoverflow.com/questions/4449565/getting-displacement-from-accelerometer-data-with-core-motion) – Raptor May 12 '14 at 06:04
  • @Raptor that question is about AR. This question is nothing to do with AR. – Fogmeister May 12 '14 at 06:32
  • You can still get the data from gyroscope with Core Motion framework. You can still apply the codes in that answer. – Raptor May 12 '14 at 07:01
  • No, you can't. The only way to accurately get location (like in the question) is to include an external reference (like the camera). – Fogmeister May 12 '14 at 07:05
  • @Raptor the link to the answers do not provide a solution to calculate for example the amount of centimeters a user is moving his/her device left or right. I think Fogmeister explains why. – tapmonkey May 12 '14 at 07:29
  • possible duplicate of [Indoor Positioning System based on Gyroscope and Accelerometer](http://stackoverflow.com/questions/7499959/indoor-positioning-system-based-on-gyroscope-and-accelerometer) – Ali May 12 '14 at 09:44

1 Answers1

4

EDIT

Link as promised...

https://www.youtube.com/watch?v=C7JQ7Rpwn2k position stuff starts at about 23 minutes in.

His summary...

The best thing to do is to try and not use position in your app.

There is a video that I will find to show you. But short answer... No. The margin for error is too great and the integration that you have to do (twice) just amplifies this error.

At best you will end up with the device telling you it is slowly moving in one direction all the time.

At worst it could think it's hurtling around the planet.

2020 Update

So, iOS has added the measure app that does what the OP wanted. And uses a combination of accelerometer and gyroscope and magnetometer in the phone along with ARKit to get the external reference that I was talking about in this answer.

I’m not 100% certain but if you wanted to do something like the OP was asking you should be able to dig into ARKit and find some apis in there that do what you want.

Fogmeister
  • 76,236
  • 42
  • 207
  • 306
  • In a comment in my question you mentioned to include an external reference... like the camera, any useful resources on this I would appreciate. – tapmonkey May 12 '14 at 07:57
  • I have never looked in to this but for that you ARE looking at using AR libraries. The way AR works (when they use things like markers to place objects) is to use the size of the marker image to infer the distance from it. Only by using an external frame of reference can you get this. The camera can get an external frame of reference because it can "see" its surroundings. However, I've never done anything like this. – Fogmeister May 12 '14 at 08:00
  • 2
    For instance, use the camera to looks at the surroundings. Then in the next frame you can do the same and then compare the images to see how the camera has moved relative to its surroundings. Then combine this with the CoreMotion data to infer relative position. etc... – Fogmeister May 12 '14 at 08:01