PCL provides several ways of visualizing point clouds. The first and simplest is through the basic cloud viewer, which is capable of representing any sort of PCL point cloud in a 3D viewer, while at the same time providing a set of callbacks for user interaction. In the following example, we will create a small node that will subscribe to sensor_msgs/PointCloud2 and the node will display sensor_msgs/PointCloud2 using cloud_viewer (basic) from the library. The code for this example can be found in the chapter10_tutorials/src source directory, and it is named pcl_visualize.cpp:
#include <iostream> #include <ros/ros.h> #include <pcl/visualization/cloud_viewer.h> #include <sensor_msgs/PointCloud2.h> #include <pcl_conversions/pcl_conversions.h> ...