gpt4 book ai didi

java - 获取精确时间间隔的 GPS 位置

转载 作者:行者123 更新时间:2023-12-02 07:08:37 24 4
gpt4 key购买 nike

我试图在不同的间隔范围内获得尽可能精确的 GPS 位置,我几乎没有外部 GPS,10hz、5hz 和 1hz

    LocationManager locationManager = (LocationManager) 
car.this.getSystemService(car.this.LOCATION_SERVICE);

LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found

}
public void onStatusChanged(String provider, int status, Bundle extras) {}

public void onProviderEnabled(String provider) {}

public void onProviderDisabled(String provider) {}
};

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);

通过这种方式,我在匀速行驶时可以获得这样的日志更新

10hz GPS

81ms new position
79ms new position
88ms new position
96ms new position
196ms new positon
60ms new positon
256ms new position
70ms new position

5 hz GPS

187ms new...
189ms ..
275ms ..
140ms ..
180ms ..
220ms ..

所以我认为 onStatusChanged 最初比标称频率快,但随后饱和并导致大幅跳跃

如果我使用计时器,它效果很好,我每 100 毫秒(200 或 1000)就定位一次,但计时器每 10 秒关闭大约 100 毫秒

编辑:为了澄清,我想获得一个精确(或接近)100ms、200ms 或 1000ms 的位置

**更新 12-04-13

重做我的代码以使用 location.getTime() 后,这是结果,所有测试都是在室外以中/高速进行,并在每个设备上记录 10 分钟

HTC Sensation Z710e 4.0.3 Internal GPS 1HZ

Average Accuracy: 12.1m
Average intertval: 1186ms
Min: 98ms
Max: 2621ms


HTC Desire HD 4.0.4 Internal GPS 1HZ

Average Accuracy: 10.6m
Average intertval: 1211ms
Min: 144ms
Max: 2588ms


ASUS Transformer TF101 4.0.4 Internal GPS 1HZ

Average Accuracy: 18.15m
Average intertval: 1000MS
Min: 1000ms
Max: 1000ms


SAMSUNG NOTE II GT-N7100 4.1.2 Internal GPS 1HZ (Glonass)

Average Accuracy: 6.8m
Average intertval: 1000MS
Min: 1000ms
Max: 1001ms


SAMSUNG, HTC OR ASUS with external GPS 5HZ

Average Accuracy: 2.2m
Average intertval: 200MS
Min: 200ms
Max: 200ms


SAMSUNG, HTC OR ASUS with external GPS 10HZ (Glonass)

Average Accuracy: 1.6m
Average intertval: 100MS
Min: 100ms
Max: 100ms

最佳答案

收到位置时不要查看(系统)时间戳,查看位置本身的时间戳,如果它是通过 GPS 传送的,则应该正好是 1000 毫秒 (1/hz)。

GPS 接收器永远不会传送奇数毫秒,当使用 1hz 时,它们恰好位于毫秒 1000。使用location.getTime(),看看你自己。

关于java - 获取精确时间间隔的 GPS 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15800686/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com