iphone - Why is my CLLocation speed so inaccurate? -
I am playing a bit with the iPhone SDK and I want to show the current speed in my application. There are so many apps that can actually be accurate, especially for low speed like running or biking. The best I've seen is Runkeypair.
But, in my application, the speed is absolutely wrong. It is always zero at low speeds, and at high speeds it shows some values but they are seldom updated and are not really useful
- (zero) locationManager:. (CLLocationManager *) Manager didUpdateToLocation: (CLLocation *) newLocation fromLocation: (CLLocation *) oldLocation {if (newLocation.timestamp> oldLocation.timestamp & amp; newLocation.verticalAccuracy> 0.0f & amp; ; 500.0f; // GPS active newLocation.horizontalAccuracy & lC & amp; kCLLocationAccuracyHundredMeters & amp;; // Good quality GPS signals //newLocation.speed> 1.0f & amp; / Enough movment for precise speed and course measurement // GPS active //newLocation.horizontalAccuracy & lt Old location! = Zero) // Old location is zero on first reading {Dual speed = (NewLocation.speed * 3.6); [Self updateDisplayPeople Speed: Speed]; // double direction = new location Noise; }}
Has anyone code worked for it? Or can you tell me, wrongly with me?
After
I will try the following.
Remember that you must install the distanceFilter and the necessaryAccuracy as necessary for your scenario: the pedestrian is not like traveling etc. Besides, if you request high accuracy from GPS, then you Always have to leave the very first place provided by GPS and use the second place as the starting point. Citing Apple Documents:
You should assign a value to this property that is appropriate for your usage scenario. In other words, if you need only the current location within a few kilometers, then you should not specify the KCL LaunchexCCC for accuracy. Determining a location with greater accuracy requires more time and more power. When requesting high accuracy location data, the initial event distributed by the location service may not have the accuracy you requested. The location service delivers the initial event as soon as possible. This accuracy continues to detect the location with your request and saves the necessary additional events, as long as the data is available.
Here's my suggestion.
First update the location using GPS using at least one second interval. The speed value below this interval is useless because it is measured in meters per second and due to the previous discussion, you can not get a valid update in less than the second time with high accuracy.
Second, use only meaningful values for location coordinates: You should leave values with negative horizontal accuracy.
Third, you can calculate the distance by yourself: Calculate the difference between the previous good location and the previous good location and then split it by using getDistanceFrom () then the remaining seconds of the location update By the number it will give you distance in meters per second. I will try to do this and compare results to Apple's speed.
Comments
Post a Comment