I used code here for 3D mapping using 2D lidar. I want to try to implement the passthrough filter for removing outliers in the obtain points. I tried to replace the cloud with scan3dMsg in pass.setInputCloud (cloud);
and result for the program to error. Does someone what should I replace cloudwith?
pcl::PassThrough<pcl::PointXYZ> pass;
pass.setInputCloud (cloud);
pass.setFilterFieldName ("z");
pass.setFilterLimits (0.0, 1.0);
//pass.setFilterLimitsNegative (true);
pass.filter (*cloud_filtered);
Take a look at the pcl documentation.
setInputCloud
is looking for something with typepcl::PointCloud<pcl::PointXYZ>::Ptr
andscan3dMsg
is a ros message type. If you want to use this you'll need to first convert the ROS message to a pcl type, which you've asked about in another question; so I won't re-paste my answer here.All of that being said, you shouldn't be using
PointCloud
messages at all these days as it's deprecated. There are packages that supportPointCloud2
, non-EOL distros, and do exactly what you're trying to do in less steps: laser_geometry