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

How to load pcd pointcloud into librviz RenderPanel?

asked 2016-01-29 18:45:41 -0500

lucasw gravatar image

updated 2020-11-21 12:05:37 -0500

I have a librviz instance running in a qt window thanks to . I would assume I use to convert the loaded pcd data into a PointCloud2, but then how do I add that to the rviz::VisualizationManager?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-01 11:16:17 -0500

lucasw gravatar image

updated 2016-02-01 15:06:25 -0500

It looks like the answer is in - I need to set the PointCloud2 Display to subscribe to a topic, then publish to that topic with the pcd converted into a ros message.

Having the same node publish and subscribe to itself within an rqt plugin, while keeping namespaces distinct from potential other instances of the same node requires a few more details, I chose to use the private node handle:

std::string name = "my_point_cloud";
std::string topic = getPrivateNodeHandle() + "/" + name;
rviz::Display*display = manager->createDisplay("rviz/PointCloud2", QString::fromStdString(name), true);
pub = getPrivateNodeHandle().advertise<pcl::PointCloud<pcl::PointXYZRGBNormal> >(name, 1);

I was hoping that I could get data directly into the custom rviz window without publishing or subscribing... it would be nice to have access controls and permissions on topics, or mark them hidden.

edit flag offensive delete link more



You could probably do something similar by writing a new display type; mostly based on the existing PointCloud2 display but with the changes you need.

ahendrix gravatar image ahendrix  ( 2016-02-01 11:32:14 -0500 )edit

I did try out processMessage() but it is protected, it may be as simple as having a subclass with a public method to access that.

lucasw gravatar image lucasw  ( 2016-02-01 13:17:59 -0500 )edit

Question Tools

1 follower


Asked: 2016-01-29 18:45:41 -0500

Seen: 774 times

Last updated: Feb 01 '16