0
$\begingroup$

Rosanswers logo

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.


Originally posted by Anubhav Singh on ROS Answers with karma: 67 on 2020-03-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2020-03-18

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2020-03-18:
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.

Comment by Anubhav Singh on 2020-03-19:
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.

$\endgroup$

Your Answer

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