How To Calculate Short Distances in Real Time? - GPS Inaccurate?
I'm trying to write some code where an event is triggered once the user has taken two steps forward or in general after a short distance towards some direction is travelled (5 feet maximum I'm guessing is the average distance covered with two steps)
Is there a way to achieve that?
I know GPS is only accurate (and not even 100% accurate) with long distances or at least distances greater than 5 meters (16 feet..)
I also know that the accelerometer is highly inaccurate when it comes to tracking linear movement
So is there a way of bypassing/combining all that in order to measure short distances travelled in real time?
Or is it simply not possible with the current technology?
I'm trying to write some code where an event is triggered once the user has taken two steps forward or in general after a short distance towards some direction is travelled (5 feet maximum I'm guessing is the average distance covered with two steps)
Is there a way to achieve that?
I know GPS is only accurate (and not even 100% accurate) with long distances or at least distances greater than 5 meters (16 feet..)
I also know that the accelerometer is highly inaccurate when it comes to tracking linear movement
So is there a way of bypassing/combining all that in order to measure short distances travelled in real time?
Or is it simply not possible with the current technology?
Thanks for any helpful input!!
The true answer is that it's not possible. If you can limit your problem domain you might be able to cheat however.
If you assume that the user is holding their phone, and that they are moving with steps, you can use the accelerometer to create a pedometer, and count steps. However, if the user holds the phone level, or is in a wheelchair, or a wheeled office chair, that breaks down.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
The true answer is that it's not possible. If you can limit your problem domain you might be able to cheat however.
If you assume that the user is holding their phone, and that they are moving with steps, you can use the accelerometer to create a pedometer, and count steps. However, if the user holds the phone level, or is in a wheelchair, or a wheeled office chair, that breaks down.
hmm.. thanks for your helpful answer Duncan.. I'm guessing a pedometer is the only way to go.. but I can already see the app failing frequently with restrictions such as "holding the iPhone this way" or the pedometer losing or adding nonexistent steps due to small "accidents" by the user like changing pace, running, accidentally moving in some weird way, standing and yet moving his hand a bit etc..etc...
you can calculate the speed with the standard physics formula:
V=d/t
where d is distance you can obtain between 2 gps coords and t is time.
iOS GPS readings are neither precise enough nor accurate enough in space or in time for the OPs stated goal of detecting motion of 2 meters or less.
You could run across the room and back before the GPS detected your change of position. It might or might not report ANY change of location in that case.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
yes of course it could be used for pedestrian porpouse.
No it can't.
The OP said:
Code:
I'm trying to write some code where an event is triggered once the user has taken two steps forward or in general after a short distance towards some direction is travelled (5 feet maximum I'm guessing is the average distance covered with two steps)
The GPS in current iOS devices is not accurate or precise enough, in space or in time, for that application. It's just not.
The best accuracy I've ever seen is 19 feet, 25 or more feet is much more typical. It can take 15 seconds or more to respond to changes in location, even in "clear air" conditions.
The GPS in iPhones and iPads sucks, quite frankly.
I've tested this quite extensively. It is just not possible to use it to reliably detect changes of less than 5 feet.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
ok I know this must be basic math which for some reason I seem to have forgotten, but..
If the accelerometer can measure my acceleration from standing still to walking, can't I also use that to find the speed at which I'm moving?
And if I can find my speed, can't I use the time passed to calculate the distance travelled?
Imagine I'm doing this with the iphone in my pocket... Can I get an accurate number in regards to my acceleration?
The problem is the accelerometers only measure acceleration in the frame of reference of the phone, which could have a random relationship with the frame of reference of the person walking.
Another problem is that the process of going from acceleration to speed involves integration (adding up). And so the unavoidable offsets in the acceleration measurement add up over time to produce arbitrarily large errors in speed. This problem is compounded even more if you try to integrate from speed to position. This is the classical initial navigation problem. With an iPhone in a pocket (in a random but fixed orientation, not rolling around in there) you might be able to do inertial navigation accurate to 2 feet provided the time period over which this had to be done was fairly short, like maybe (just guessing here) 10 seconds. If the test lasts for any longer than that then you don't where you are or how fast you are going.
The problem of the random orientation of the iPhone could be solved if you don't care which direction someone moves. That is, two steps forward will be indistinguishable from two steps sideways.