Question

I'm currently working on a health/fitness application that is supposed to track the instantaneous speed of the user during an exercise (running, biking, whatever ...). The application must be able to give real-time instructions, so the speed must be as accurate as possible and refreshed quite frequently.

I already have found a good tutorial here, in which the current speed is calculated using distance and time, and averaged with the 3 previously calculated speeds. This seems to do the job if I change some defines, but the entire code is kind of complex for something so simple. Also, I know that CLLocation class has a speedattribute that delivers the same information.

So my question is : Which way is the most accurate to get an instantaneous speed ? Or in other words, is CLLocation's speed attribute enough for this kind of usage ?

Thanks !

Was it helpful?

Solution

The best value you can get is the GPS speed. So make sure you have set GPS to AccuracyBest and read the CLLocation speed attribute.

The slower you move the inacurate it is, like an all GPS devices. For automotive typical velocity you can expect 0.1 km/h accuracy.

OTHER TIPS

From Apple Reference

speed
The instantaneous speed of the device in meters per second.

@property(readonly, NS_NONATOMIC_IPHONEONLY) CLLocationSpeed speed
Discussion
This value reflects the instantaneous speed of the device in the direction of its current heading. A negative value indicates an invalid speed. Because the actual speed can change many times between the delivery of subsequent location events, you should use this property for informational purposes only.

Special Considerations
In iOS, this property is declared as nonatomic. In OS X, it is declared as atomic.

Availability
Available in OS X v10.7 and later.
Declared In
CLLocation.h

Does not sound like Apple considers it to be accurate. Nor is it.

EDIT -- Here's a related question same problem and some suggestions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top