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

How to visualize a message of type sensor_msgs/PointCloud2[] in Rviz?

asked 2020-03-18 08:18:09 -0600

updated 2020-03-18 08:21:46 -0600

Hey guys, I hope you all are doing well. I am facing a problem related to visualizing a topic in Rviz. So, I have a custom message of type sensor_msgs/PointCloud2[]. I have created an instance of this message type and pushing sensor_msgs/PointCloud2 data to it and eventually publishing the final message/array on a topic, let's suppose /topic_name. My question is:

How to visualize it inside Rviz?

I can see the data by running rostopic echo /topic_name, but unfortunately can't see the topic name under topic section of PointCloud2 display in Rviz. I would really appreciate your help on this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-03-18 10:28:28 -0600

gvdhoorn gravatar image

As you're using a custom message, you can't use the built-in displays, as they don't work with your message, only with the standard message set.

I believe you have two options:

  1. write a new RViz display plugin which can consume your custom message (possibly extending the current PointCloud2 display)
  2. use an intermediate node to "unpack" your list of PointCloud2 into separate messages and then republish those

Option 2 would incur lots of overhead, but would allow the use of the built-in display plugin for PointCloud2.

Option 1 would require you to write your own RViz display plugin, which comes with its own form of overhead.

edit flag offensive delete link more

Comments

What you encounter is actually why the recommendation is to try and use standard messages as much as possible.

If you created your custom message because the PointCloud2s in the list "belong together", then perhaps looking into wiki/message_filters (ExactTime or ApproximateTime) may help here.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-18 10:30:46 -0600 )edit

Thank you so much for your answer. And, it completely make sense. What I did is create an object of type pcl.PointCloud_PointXYZRGB() and make elements of my array of type PointCloud2 as its points using .from_list method . Then convert the PCL data to ROS messages and eventually publish it on a topic of type PointCloud2.

Anubhav Singh gravatar image Anubhav Singh  ( 2020-03-19 10:49:28 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-18 08:18:09 -0600

Seen: 1,225 times

Last updated: Mar 18 '20