ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Publishing multiple messages on same topic at same time

asked 2022-08-27 12:21:28 -0500

morten gravatar image

I need to publish a several messages containing point clouds from a sensor at different viewpoints. Each of these point clouds is expressed locally so I was hoping I could just publish all of them individually on the same topic, with the same stamp and then it would work, i.e.

stamp = ros::Time::now();
for (const auto &cloud : point_clouds) {
  cloud.header.stamp = stamp;
  pub_cloud.publish(cloud);
}

This would save me the work of transforming them myself or from creating a topic for each point cloud. This, however doesn't really seem to be possible, as only the last message is shown in rviz, though they are all printed with rosecho.

Is this actually possible?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-27 16:35:57 -0500

If your data comes from one sensor, wouldn't each point cloud have a different timestamp? Why would you want to change their timestamp so that they are the same?

edit flag offensive delete link more

Comments

so each reading corresponds to a different viewpoint, this is to publish all clouds when the viewpoint transforms are updated. I figured the timestamp would have to be the same in order to avoid having a non-zero decay time, but this isn't really the focus here.

The main problem is there are N point clouds, each in their viewpoint frame. And I need to figure out how to publish them, obviously creating N publishers doesn't make sense. Id also prefer not to handle the transforming to world and summing myself, I figured rviz could do this. I'm just not sure how.

morten gravatar image morten  ( 2022-08-28 05:03:21 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-08-27 12:21:28 -0500

Seen: 194 times

Last updated: Aug 27 '22