I am using two sensors each connected to different machine (each machine separately runs Ubuntu 16.04 and ROS Kinetic). When I echo topic on these two machines, I see the time stamps in header of messages are different. Even though they are running at the same time. So I faced issues in synchronizing topics recorded on different machines.

Machine 1: sec 4583 | nsec 855689180

Machine 2: sec 1570727234 | nsec 4864000

It seems that the time stamp on machine 1 is based on sim_time. Machine 2 is showing a Posix/Unix time stamp. So on machine 1, I issued the command rosparam set /use_sim_time false. Still when I fire the node on machine 1, time stamp starts from zero which is sim_time.

What I need is to get all time stamps in unix/posix format (10 digit).

P.S. the node running on Machine 1 is OS-1 Lidar Ros Driver


The times in your machines are a bit different. Even if you convert the times it is highly possible that you still have the problem of synchronizing these two topics. One way is that look at one of the topics as the main. On the other topic subscribe to the main one and change its time as the main. Or if you are working by these two in a third machine write an interface node for both and set the time as ros::time::now().

  • $\begingroup$ This solution usually doesn't work as per two general cases: 1) ONLINE: ROS nodes/sensors running on two separate machines (mobile stations) are not able to communicate sensor data in real time, so one cannot subscribe to other one. 2) OFFLINE: when two rosbag files are collected from two machines, even processing them on a third machine, writing an interface or having one of nodes subscribed to the topic of second node won't guarantee synchronization as it actually depends on if we have issued rosbag record command on two machines at the same time or not. $\endgroup$ – fhm Nov 6 at 15:59
  • $\begingroup$ So I wish to get Posix-based stamps on two bag files recorded on two machines, with the assumption that both machines are already synced with an external NTP server. Given that, I guess the time difference on two bag file would be within ms or ns scale. Correct me please, if I am wrong. $\endgroup$ – fhm Nov 6 at 16:06
  • $\begingroup$ I had an Xtion RGBD-camera on my robot which sents its data to the ground station. On the ground station, I had faced by time error between my PC (which wants to run SLAM) and received data. By setting the received data time to the current time my problem solved. I do not have any idea about your NTP solution. I will be happy to see its result! $\endgroup$ – hosh0425 Nov 6 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.