Robotics StackExchange | Archived questions

Ros on two machines, different time stamps

I have two ROSBAG recorded on two different machines (ROS kinetic Ubuntu 16.04) at the same time. I need to synchronize messages of two bag files in order to be able to manipulate the data, I am using message_filters/sync_policies/approximate_time.h. However, I get no output from approximate synchronizer which I guess is due to different ROS stamps on these two machines. Here is a sample frame stamp from two machines:

Machine 1:

sec 4583 | nsec 855689180

Machine 2:

sec 1570727234 | nsec 4864000

While I know the format for machine 2, I am not sure what format is the time being written on Machine 1, but I need to synchronize these two. My first question is that if chrony can solve this issue? I tried checking the time difference by the command chronyc tracking, yet it looks good to me:

System time : 0.000291987 seconds fast of NTP time.

If chrony wouldn't be helpful, how can I get these two machines clocks under the same format.

Asked by zlg9 on 2019-11-01 15:54:39 UTC

Comments

Answers

Machine 1:

sec 4583 | nsec 855689180

Machine 2:

sec 1570727234 | nsec 4864000

It would appear likely that "machine 1" was running with use_sim_time set to true while "machine 2" was using the regular system (wall) clock.

Were you running a simulation on "machine 1"?

Asked by gvdhoorn on 2019-11-02 08:43:06 UTC

Comments

@gvdhoorn This is the scenario: I got two LiDARs on two different machines, each machine runs its own ROS Kinetic on Ubuntu 16.04. So on each machine I recorded rosbag including /points_raw topic. The time stamp you see above is for when I play those two rosbag files on a third machine and echo /points_raw. Since those two bag files have been recorded for the same duration of time, I expected to get close enough time stamps and under the same format, so that I can sync two topics.

Asked by zlg9 on 2019-11-02 10:01:53 UTC

I checked /use_sim_time param, it was not configured at all. So I issued roscore command, then set /use_sim_time to false and then fired up my sensor again. I checked the time stamp of the generated topic, still the short one which is sim_time. How can I eliminate this time format ?

Asked by zlg9 on 2019-11-03 10:02:24 UTC

ros::Time() gets its clock from the system clock, unless use_sim_time is set to true. The first thing I would check is whether Machine 1 has a properly functioning system clock. Is it an embedded platform? Some other special clock configuration (ie: external, GPS synced, battery backed RTC, etc)?

What is the output of lsb_release -a and uname -rmvp on Machine 1 and Machine 2?

Asked by gvdhoorn on 2019-11-04 02:49:24 UTC