Complete the code to include the header file for point cloud processing in ROS.
#include [1]
The header <pcl/point_cloud.h> is needed to work with point clouds in ROS.
Complete the code to declare a pointer to a PointCloud of type PointXYZ.
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new [1]);We create a new PointCloud object of type PointXYZ to initialize the pointer.
Fix the error in the code to convert a ROS PointCloud2 message to a PCL PointCloud.
pcl::fromROSMsg([1], *cloud);The function fromROSMsg takes a sensor_msgs::PointCloud2 message, usually named cloud_msg.
Fill both blanks to filter points in the cloud by their z coordinate.
pcl::PassThrough<pcl::PointXYZ> pass; pass.setInputCloud(cloud); pass.setFilterFieldName([1]); pass.setFilterLimits([2], 10.0); pass.filter(*filtered_cloud);
We filter points by the z coordinate, setting the lower limit to 5.0.
Fill all three blanks to create a voxel grid filter and downsample the point cloud.
pcl::VoxelGrid<pcl::PointXYZ> sor; sor.setInputCloud([1]); sor.setLeafSize([2], [3], [3]); sor.filter(*downsampled_cloud);
The input cloud is cloud. The leaf size is set to 0.1 for x, y, and z to downsample evenly.
