IPhone CoreLocation: how to get maximum speed

I'm experimenting with adding GPS features to my iPhone app. This is a training application that will be used while walking or running. Therefore, I want to use GPS in order to show the speed at which a person moves in Mph and minute / mile.

How do I configure CLLocationManager to get the best results? What should I set for the desired quality and distance?

I tried:

distanceFilter = 10 and the desired value: kCLLocationAccuracyNearestTenMeters

and reading

CLLocation.speed Property

Testing while driving in my car accuracy seems good compared to a car speedometer, although it takes some time to update. I understand that an update delay may well be the time it takes to request a GPS location, but I'm not sure that changing these two options will give better results.

Should I use kCLLocationAccuracyBest and another value for distanceFilter?

I am interested in hearing from others using CoreLocation to get speed. What do you do to get more accurate results?

+6
iphone cocoa-touch core-location
source share
2 answers

For best results, you should use kCLLocationAccuracyBest. What you put in your remote filter depends on what error you are ready to deliver. Basically, you have to make decisions based on accuracy and availability. That is, during periods when the answer is not available with the best accuracy, what will you show?

One approach is to allow the phone to receive less accurate answers and, using the forecast of what happened the last time you had the information with the best accuracy, see if it makes sense to make sense.

That is, suppose I'm running 6 miles per hour north. You plot me by point-to-point, point-B, point-C ... then you will get a low-precision answer (maybe kCLLocationAccuracyNearest100Meters.) Look at the place where it says I’m figuring out, “could I get this spot from point-C, if I continued my current path, making reasonable adjustments for possible speed changes? " If so, then the new point is within limits. (If not, throw it away.) Then project from point-C onto my last known speed and find out where you think I'm probably ballistic. Save it as a ballistic dot-D.

Of course, you use the accelerometer to get some inertial feeling, how did I go, right? So, you can’t know the direction (you don’t know how the phone is pointing), but you can make a reasonable punch from a distance.

Using all this information, speak up the most likely place where, in your opinion, I probably am.

NOTE. When testing, do not just enter coverage areas with a good cell. See how your app works in the hills, away from cell phones. Many people enjoy cycling and running through these areas!

+5
source share

Disclaimer: I played a little with CoreLocation, I did not test the accuracy very accurately.

I expect you to get the most accurate results using the default values ​​for distanceFilter and wishAccuracy. Less frequent updates will allow you less data to work with.

One problem you are likely to encounter is when the location fix is ​​lost for a while and then returns. A naive approach based on connecting to a point to determine the distance traveled will tend to underestimate the runner’s actual speed. Instead of using CLLocation.speed, you can get better results by calculating the speed based on some heuristic approximation of the line that the runner really follows.

+3
source share

All Articles