views:

82

answers:

1

i am using cllocation.speed to get the speed of the device moving but i am getting 0 every time.....can anybody help me out with this

even i am trying speed = ([newlocation getDistanceFrom:oldlocation]/[newlocation.timeStamp timeIntervalSinceDate:oldlocation.timeStamp])

the problem is it is giving worng speed once in a while......

+1  A: 

There is a little configuration that will help you out:

  1. CLLocationManager will not send you an update unless the user moves outside a circle at their current location. You can control the radius of the circle (make it smaller) so you get more refined updates. See distanceFilter.

  2. CLLocationManager has an accuracy control, that you want to set to its finest level. See desiredAccuracy.

Your best bet is simply to continually calculate this "speed" and use a weak low-pass filter to smooth out the results.

See also this question for more information: iPhone CoreLocation: How to get the most accurate speed.

Frank Krueger