Robotics StackExchange | Archived questions

Publishing multiple messages on same topic at same time

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?

Asked by morten on 2022-08-27 12:21:28 UTC

Comments

Answers

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?

Asked by Rodolfo8 on 2022-08-27 16:35:57 UTC

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.

Asked by morten on 2022-08-28 05:03:21 UTC