iPhone CoreLocation:如何获得最准确的速度 [英] iPhone CoreLocation: How to get the most accurate speed

查看:99
本文介绍了iPhone CoreLocation:如何获得最准确的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将GPS功能添加到我的iPhone应用程序。这是一个锻炼应用程序,将在步行或跑步时使用。所以我想使用GPS的是显示的速度,人在Mph和分钟/英里移动。



我应该如何配置CLLocationManager,最好的结果?我应该如何设置desiredAccuracy和distanceFilter?



我尝试过:



distanceFilter = 10 and desiredAccuracy = kCLLocationAccuracyNearestTenMeters



并阅读



CLLocation.speed属性



在我的汽车驾驶测试,准确度似乎比汽车车速表好,虽然它需要一段时间来更新。我意识到,更新延迟很可能是查询GPS位置所需的时间,但我不知道如果改变以上两个参数会给更好的结果。



我应该使用kCLLocationAccuracyBest和一些其他值为distanceFilter?



我有兴趣听到别人使用CoreLocation获得速度。

解决方案

为了获得最佳效果,应该使用kCLLocationAccuracyBest。你把你的距离过滤器取决于你愿意放置哪些故障。基本上,你将必须根据准确性与可用性做出决策。也就是说,在没有最佳准确度答案的期间,您将显示什么?



一种方法是让手机提供不太准确的答案,



也就是说,假设我以6英里/小时的速度慢跑北方。你沿着点A,点B,点C绘制我...然后你得到一个低精度的答案(也许kCLLocationAccuracyNearest100Meters。)看看它说,我的地方,并找出我可以得到了如果我继续沿着我的当前路径,对点C的点,对速度的可能变化进行合理的调整?如果是这样,那么新点在可能性的范围之内。 (如果没有,然后抛弃它。)然后从点C以我最后知道的速度项目,并计算出你认为我可能是,弹道的地方。保存为弹道点D。



当然,你使用加速度计得到某种惯性的感觉,我走了,对吧?所以,你不能知道方向(你不知道手机指向什么方式),但你可以在远处做出合理的刺。



使用所有这些信息,绘制你认为我可能是最可能的地方。



注意:测试时,不要只是在良好的小区覆盖区域。查看您的应用在山上的运行情况,远离手机。很多人喜欢自行车&慢跑这些区域!


I'm experimenting with adding the GPS functionality to my iPhone app. It's a workout app that will be used while walking or running. So what I want to use GPS for is to show the speed that the person is moving in Mph and minute/mile.

How should I configure the CLLocationManager so I get the best possible results? What should I set desiredAccuracy and distanceFilter?

I've tried with:

distanceFilter = 10 and desiredAccuracy = kCLLocationAccuracyNearestTenMeters

and reading

CLLocation.speed property

Testing while driving around in my car the accuracy seems good compared to the car speedometer although it takes a while to update. I realize that the update delay may very well be the time it takes to query the GPS location, but I'm not sure if changing the above two parameters would give better results.

Should I use kCLLocationAccuracyBest and some other value for distanceFilter?

I'm interested to hear from others using CoreLocation to get speed. What are you doing to get more accurate results?

解决方案

For best results, you should use kCLLocationAccuracyBest. What you put into your distance filter depends on up with which faults you're willing to put. Basically, you're going to have to make decisions based on accuracy vs availability. That is, during periods when a best-accuracy answer is not available, what will you display?

One approach is to let the phone deliver less-accurate answers and, using a projection of what was happening the last time you had best-accuracy information, see if what you have makes sense.

That is, suppose I'm jogging at 6mph to the North. You plot me along point-A, point-B, point-C... then you get a low-accuracy answer (maybe kCLLocationAccuracyNearest100Meters.) Look at the spot where it says I am and figure out "could I have gotten to that spot from point-C if I'd continued along my current path, making reasonable adjustments for possible changes in speed?" If so, then the new point is within the realm of possibility. (If not, then toss it out.) Then project from point-C at my last-known speed and figure out where you think I probably am, ballistically. Save that as ballistic-point-D.

Of course, you're using the accelerometer to get some sort of inertial sense of which way I went, right? So, you can't know direction (you don't know what way the phone is pointing), but you can make a reasonable stab at distance.

Using all this information, plot the most likely spot where you think I probably am.

NOTE: When testing, don't just drive in good-cell coverage areas. See how your app performs out in the hills, away from cell phones. A lot of people like to bike & jog those areas!

这篇关于iPhone CoreLocation:如何获得最准确的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆