0
$\begingroup$

Rosanswers logo

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?


Originally posted by somebodyus on ROS Answers with karma: 113 on 2014-11-11

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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

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


Originally posted by dornhege with karma: 31395 on 2014-11-11

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by somebodyus on 2014-11-11:
How to do that?

My code:

sensor_msgs::PointCloud2 psbmsg;

pcl::toROSMsg(cloud_processed, psbmsg);

pub.publish(psbmsg);

Comment by dornhege on 2014-11-11:
psbmsg.header = input_cloud.header;

Comment by somebodyus on 2014-11-11:
Still doesn't work...

rostopic echo /publishedTopic

WARNING: no messages received and simulated time is active.

Is /clock being published?

Comment by somebodyus on 2014-11-11:
Thank you very much. It works.

It should be psbmsg.header = submsg.header;

$\endgroup$
0
$\begingroup$

Rosanswers logo

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....


Originally posted by Wolf with karma: 7555 on 2014-11-11

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by somebodyus on 2014-11-11:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.