问题描述
是否有一种方法可以同步由传感器(例如加速度)( SensorEvent.timestamp )和GPS( Location.getTime())确定的值中的时间戳。
SensorEvent.timestamp是设备启动(本地时间)以来的纳秒数。 Location.getTime()是1970年以来的毫秒(全球时间)。
我想到的一个解决方案是计算当地时间与全球(GPS)时间之间的偏差。但问题在于,地点时间是GPS信息到达设备的时间,但需要一些时间直到设备的GPS单元(不知道它是如何称呼的)计算位置并且将它转发给我的应用程序,所以我无法计算消息到达的当地时间。我已经读过某处(不记得在哪里)从消息到达的延迟直到它已经被处理了几百毫秒,所以我将始终在GPS数据和来自其他传感器的数据之间具有高偏移量,如果我为当地时间添加了当应用程序获取位置消息和位置时间戳的地方时间。
是否有办法确定处理GPS消息需要多长时间?还是有另一种方法来同步测量?
为什么我想同步值的原因是,我想应用一个过滤器(如卡尔曼滤波器)数据。为此,我希望尽可能精确地计算传感器值与gps值之间的偏移量。 秒(PPS)信号用于将测量时间链接到本地时钟。 GPS接收机在测量时切换脉冲。然后使用本地时钟为该脉冲加上时间戳。在Android手机上,这是不可用的。
除了处理和传输时间造成的延迟外,GPS软件中可能会有额外的延迟导致过滤。这种延迟甚至可能取决于使用的卫星的速度或数量。
您可以通过比较信号来校准GPS数据和传感器数据之间的延迟来自两者。例如:如果你从加速到减速,你会在手机的加速度计和GPS速度中看到这一点。不过,我怀疑你是否能够很好地准确地推迟延迟。
您甚至可以在您的卡尔曼滤波器中添加一个状态来估计延迟。
Is there a way to synchronize the timestamps in values meassured by Sensors (e.g. acceleration) (SensorEvent.timestamp) and GPS (Location.getTime()).
SensorEvent.timestamp are the nanoseconds since the device has been booted (local time). Location.getTime() are the miliseconds since1970 (global time).
One solution I had in mind was to calculate the offset between the local time and the global (GPS) time. But the problem is, that the time in Location is the time when the GPS-message arrived at the device, but it takes some time until the GPS-unit (don't know how it is called) of the device calculates the position and forwards it to my application, so I can't calculate at what local time the message arrived. I've read somewhere (can't remember where) that the delay from arrival of the message until it has been processed can be several 100 miliseconds, so I will always have a high offset between GPS-data and data from other sensors, if I algin the local time when the app gets the location-message and the timestamp in the location.
Is there a way to figure out how long it takes exactly to process the GPS-message? Or is there another way to synchronize the meassurements?
The reason why I want to synchronize the values is, that i want to apply a filter (e.g. Kalman-Filter) on the data. For this I want to calculate the offset between a sensor value and a gps-value as exact as possible.
Usually Pulse Per Second (PPS) signals are used to link the time of measurement to the local clock. The GPS receiver toggles a pulse at the moment of measurement. This pulse is then timestamped using the local clock. On Android phones, this is not available.
In addition to the delay caused by processing and transmission time, there might be additional delays caused be filtering in the GPS software. This delay may even be depending on the speed or number of satellites used.
You might be able to 'calibrate' the delay between GPS data and your sensor data by comparing signals from both. E.g.: If you go from accelerating to decelerating, you will see this clearly in you phone's accelerometer and the GPS speed. However, I doubt if you can get a good accuracy for the delay.You could even add a state in you Kalman filter which estimates the delay.
这篇关于Android:同步传感器和GPS的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!