Ask Your Question
1

How to publish topic with old rosbag time?

asked 2014-11-11 09:50:19 -0500

somebodyus gravatar image

I first set /use_sim_time to true. Then play the ros bag file. My code subscribe the point cloud in the bag. After some processing, my code publish the processed point cloud. However, the rviz can only display the point cloud in the bag. It can't display the processed point cloud. I guess the processed point cloud use the current time and the rviz use the old time, so the processed point cloud can not be displayed. So, how to publish the processed point cloud using the old bag time?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-11-11 09:54:28 -0500

dornhege gravatar image

Your guess and proposed solution is the right way to go.

However, this is in your code, so you have to do that.

edit flag offensive delete link more

Comments

How to do that?

My code:

sensor_msgs::PointCloud2 psbmsg;

pcl::toROSMsg(cloud_processed, psbmsg);

pub.publish(psbmsg);

somebodyus gravatar image somebodyus  ( 2014-11-11 09:55:24 -0500 )edit

psbmsg.header = input_cloud.header;

dornhege gravatar image dornhege  ( 2014-11-11 10:00:35 -0500 )edit

Still doesn't work...

rostopic echo /publishedTopic

WARNING: no messages received and simulated time is active.

Is /clock being published?

somebodyus gravatar image somebodyus  ( 2014-11-11 10:09:25 -0500 )edit

Thank you very much. It works.

It should be psbmsg.header = submsg.header;

somebodyus gravatar image somebodyus  ( 2014-11-11 10:24:42 -0500 )edit
1

answered 2014-11-11 09:59:42 -0500

Wolf gravatar image

updated 2014-11-11 10:02:29 -0500

First, as mentioned, set /use_sim_time to true.

Then use

rosbag play --clock your_bag_file.bag

to have it publishing to /clock topic...

All nodes started later will believe it is "old rosbag time", ros::Time::now() etc. in your nodes will return rosbag time....

edit flag offensive delete link more

Comments

Yes. I have done that. The rviz use the old time, so it can correctly display the old point cloud topic in the bag. However, it can't display the processed point cloud.

somebodyus gravatar image somebodyus  ( 2014-11-11 10:01:50 -0500 )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: 2014-11-11 09:50:19 -0500

Seen: 1,375 times

Last updated: Nov 11 '14