The pointcloud_crop package is designed to crop a <sensor_msgs::PointCloud2> within a specified xyz range.
Point Cloud Library (PCL)
To install and build the package, follow these steps:
$ cd ~/{your workspace}/src
$ git clone https://github.com/mjlee111/pointcloud_crop.git
$ cd ..
$ catkin_makeTo use the package, follow these instructions:
Launch the package using the following command:
$ roslaunch pointcloud_crop crop.launchThe package supports the following parameters:
-
sub_topic: The topic name to subscribe to.
- Default:
/pointcloud
- Default:
-
pub_topic: The topic name to publish the cropped point cloud to.
- Default:
/pointcloud_crop
- Default:
-
x_min: The minimum x-range for cropping.
- Default:
-1.0[m]
- Default:
-
x_max: The maximum x-range for cropping.
- Default:
1.0[m]
- Default:
-
y_min: The minimum y-range for cropping.
- Default:
-1.0[m]
- Default:
-
y_max: The maximum y-range for cropping.
- Default:
1.0[m]
- Default:
-
z_min: The minimum z-range for cropping.
- Default:
-1.0[m]
- Default:
-
z_max: The maximum z-range for cropping.
- Default:
1.0[m]
- Default:
-
marker: Set marker for range visualization.
- Default:
false
- Default:
Below is an example of a crop.launch file, which you can use to run the package with custom parameters:
<launch>
<node pkg="pointcloud_crop" type="pointcloud_crop_node" name="pointcloud_crop_node" output="screen">
<param name="sub_topic" type="string" value="/point_cloud" />
<param name="pub_topic" type="string" value="/point_cloud_crop" />
<param name="x_min" value="-1" />
<param name="x_max" value="1" />
<param name="y_min" value="-1" />
<param name="y_max" value="1" />
<param name="z_min" value="-1"/>
<param name="z_max" value="1"/>
<param name="marker" type="bool" value="false" />
</node>
</launch>This package facilitates the cropping of point cloud data within a specified range, making it easier to focus on areas of interest in your point cloud datasets. Adjust the parameters as needed to suit your specific application requirements.