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 speed
attribute 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 !
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.