Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-27-2012, 07:16 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 11
NiMa is on a distinguished road
Default 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?

Thanks for any helpful input!!

Last edited by NiMa; 01-27-2012 at 07:21 AM.
NiMa is offline   Reply With Quote
Old 01-27-2012, 07:34 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by NiMa View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-27-2012, 08:01 AM   #3 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 11
NiMa is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
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...
NiMa is offline   Reply With Quote
Old 01-27-2012, 11:04 AM   #4 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 11
NiMa is on a distinguished road
Default

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?
NiMa is offline   Reply With Quote
Old 01-27-2012, 01:19 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 15
mercury841 is on a distinguished road
Default

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.
mercury841 is offline   Reply With Quote
Old 01-27-2012, 01:24 PM   #6 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by mercury841 View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-27-2012, 01:27 PM   #7 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 15
mercury841 is on a distinguished road
Default

yes of course it could be used for pedestrian porpouse.
mercury841 is offline   Reply With Quote
Old 01-27-2012, 02:11 PM   #8 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by mercury841 View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-28-2012, 06:25 AM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by NiMa View Post
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.
RLScott is offline   Reply With Quote
Reply

Bookmarks

Tags
accelerometer, accuracy, gps

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 410
10 members and 400 guests
Atatator, condor304, FrankWeller, imac74, MAMN84, mraalex, n00b, PowerGoofy, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,123
Posts: 402,908
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:57 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0