Actual Issue: I have a topic published with images from a camera and another topic with details of point cloud. When I plot these two topics, there is a time lag between the two plots. Is there any method to synchronize this time lag by adjusting the time stamp of point cloud message?
I am using rosbag play for the above mentioned purpose.
Re-creating the Scenario I tried to simulate the above scenario using the below mentioned points: i. Created a subscriber node which subscribe to the topic(/point_cloud) with point cloud data. ii. Inside the callback function, I copied the message to a new pointer variable of the same type (sensor_msgs::PointCloud2) and incremented the timestamp by 3sec (The debug print shows that the timestamp has been successfully updated). iii. Then I published the modified point cloud data in a new topic(/point_cloud_new). iv. Created two instances of rviz which subscribes to the two topics, /point_cloud and /point_cloud_new respectively. v. Since the timestamp of /point_cloud_new was incremented by 3sec, I expected a 3sec delay between the two plots in the rviz. But it is not happening.
Since I am new to ROS, I am not sure whether it is the correct method to approach this issue. Please comment on the actual issue and the scenario re-created.
Please help me to sort out this issue.
Originally posted by A G on ROS Answers with karma: 18 on 2016-05-13
Post score: 0
Original comments
Comment by Thomas D on 2016-05-13:
When you play the bag file are you setting the parameter use_sim_time
to true
? That will be a required step for time synchronization when using bag files.
Comment by A G on 2016-05-14:
Yes. I set use_sim_time to true and I am using --clock option while playing the rosbag.