ROS time stamp and sync

1.

https://answers.ros.org/question/189867/what-is-the-timestamp/

 

In ROS messages timestamp is taken from your system, which is unix epoch time.

Check Unix epoch time here.

For synchronisation look message_filters

Documentaiton of the datatypes are at: http://wiki.ros.org/rospy/Overview/Time and http://wiki.ros.org/rospy/Overview/Time

link

Comments

Also, if the workstation and the device are significantly off, you can sync the two with chrony. Just mentioning because it took me too long to figure out...

 

2.

The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).

Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038).

 

3.

https://blog.csdn.net/zyh821351004/article/details/47758433

最近做ekfslam,有两个数据输入/odom 与/ img信息,刚开始这两个都是通过rosbag包回放,分别有两个toptic订阅回调函数触发不同的处理.

这在后面处理的时候又需要对这两数据进行相应的时间同步,我之前采用的是odom建立vector向量表存储(频率比图像快),后面以img数据为准,

从img的时间戳搜索最近的odom. 然后再将这两数据传入ekfslam进行预测与更新. 而我这种处理方式又必须得考虑类成员与多线程(topic消息机制)

存在成员变量在过程中强行覆盖的问题.

    今天与根哥讨论,建议我用消息同步的方式进行回调同步处理. 我这就参考wiki试着开干了.

    通过对多输入通道的输入topic的时间戳分析,进行同步,将同步的所有消息以一个回调的方式触发,

方式一: 全局变量形式  : TimeSynchronizer

步骤:

     1.   message_filter ::subscriber 分别订阅不同的输入topic

     2.  TimeSynchronizer<Image,CameraInfo>   定义时间同步器;

    3.  sync.registerCallback      同步回调

     4.  void callback(const ImageConstPtr&image,const CameraInfoConstPtr& cam_info)     带多消息的消息同步自定义回调函数

相应的API  message_filters::TimeSynchronizer

 

4

https://blog.csdn.net/bluewhalerobot/article/details/80429714

这里的程序tf时间戳用的是当前时间,也就是处理这个位置信息时的时间。但是如果我们的机器人性能比较弱,可能处理这个位置信息的时间和位置信息实际产生的时间差挺多。这样当其他数据需要坐标系转换的时候,就会采用错误的tf数据从而产生误差。我们以具体的数字为例
比如我们现在在1s的时刻得到小海龟的位置是(0,0), 小海龟在以1m/s的速度沿X轴直线运动。我们的小海龟性能很弱。消息处理的时间和实际位置消息产生的时间差了1s。我们现在通过超声波测量到了小海龟前面1m处有一个障碍物。我们想知道这个障碍物在world坐标系下的坐标。我们首先找到当前时刻附近的tf变换,但是这个tf变换实际上是根据1s之前小海龟的位置计算的,当时小海龟的位置是(-1,0)。所以根据这个tf变换我们计算出这个障碍物的位置坐标是(0,0)。如果用这个数据去做路径规划,肯定出现的是错误的结果。

当然上面是一个夸张的例子,但是实际确实会因此引入误差。那么正确的做法是什么呢?
以消息产生的时间戳作为tf变换的时间戳。因为坐标变换是根据消息计算出来的,所以其有效的时刻就应该是消息有效的时刻。

posted @ 2018-08-06 11:55  ofsource  阅读(2278)  评论(0编辑  收藏  举报