Ask Your Question
0

Ros on two machines, different time stamps

asked 2019-11-01 15:54:39 -0600

zlg9 gravatar image

updated 2019-11-02 10:06:47 -0600

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-02 08:43:06 -0600

gvdhoorn gravatar image

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"?

edit flag offensive delete link more

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.

zlg9 gravatar imagezlg9 ( 2019-11-02 10:01:53 -0600 )edit

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 ?

zlg9 gravatar imagezlg9 ( 2019-11-03 09:02:24 -0600 )edit

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?

gvdhoorn gravatar imagegvdhoorn ( 2019-11-04 01:49:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-11-01 15:54:39 -0600

Seen: 27 times

Last updated: Nov 02