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

Revision history [back]

It looks like the answer is in http://answers.ros.org/question/191721/librviz-display-sensor_msgslaserscan/ - 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.

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.

It looks like the answer is in http://answers.ros.org/question/191721/librviz-display-sensor_msgslaserscan/ - 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);
display->subProp("Topic")->setValue(QString::fromStdString(topic));

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.