This commit is contained in:
matlabbe
2020-07-07 13:55:42 -04:00
parent 9ef1c1a609
commit c3c76a8bd3
3 changed files with 20 additions and 5 deletions
+14 -1
View File
@@ -19,10 +19,23 @@
<remap from="rgb/image" to="rgb/image_out"/>
<remap from="depth/image" to="depth/image_out"/>
<remap from="rgb/camera_info" to="rgb/camera_info_out"/>
<remap from="cloud" to="/voxel_cloud" />
<remap from="cloud" to="/voxel_cloud_xyzrgb" />
<param name="voxel_size" type="double" value="0.02"/>
<param name="decimation" type="int" value="2"/>
<param name="noise_filter_radius" type="double" value="0.05"/>
<param name="normal_k" type="int" value="6"/>
</node>
<node pkg="nodelet" type="nodelet" name="points_xyz" args="load rtabmap_ros/point_cloud_xyz camera_nodelet_manager">
<remap from="depth/image" to="depth/image_out"/>
<remap from="depth/camera_info" to="rgb/camera_info_out"/>
<remap from="cloud" to="/voxel_cloud_xyz" />
<param name="voxel_size" type="double" value="0.02"/>
<param name="decimation" type="int" value="2"/>
<param name="noise_filter_radius" type="double" value="0.05"/>
<param name="normal_k" type="int" value="6"/>
</node>
</group>
+3 -2
View File
@@ -291,10 +291,11 @@ private:
if(indices->size() && voxelSize_ > 0.0)
{
pclCloud = rtabmap::util3d::voxelize(pclCloud, indices, voxelSize_);
pclCloud->is_dense = true;
}
// Do radius filtering after voxel filtering ( a lot faster)
if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
{
if(pclCloud->is_dense)
{
@@ -310,7 +311,7 @@ private:
}
sensor_msgs::PointCloud2 rosCloud;
if(pclCloud->size() && (normalK_ > 0 || normalRadius_ > 0.0f))
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && (normalK_ > 0 || normalRadius_ > 0.0f))
{
//compute normals
pcl::PointCloud<pcl::Normal>::Ptr normals = rtabmap::util3d::computeNormals(pclCloud, normalK_, normalRadius_);
+3 -2
View File
@@ -470,10 +470,11 @@ private:
if(indices->size() && voxelSize_ > 0.0)
{
pclCloud = rtabmap::util3d::voxelize(pclCloud, indices, voxelSize_);
pclCloud->is_dense = true;
}
// Do radius filtering after voxel filtering ( a lot faster)
if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
{
if(pclCloud->is_dense)
{
@@ -489,7 +490,7 @@ private:
}
sensor_msgs::PointCloud2 rosCloud;
if(pclCloud->size() && (normalK_ > 0 || normalRadius_ > 0.0f))
if(!pclCloud->empty() && (pclCloud->is_dense || !indices->empty()) && (normalK_ > 0 || normalRadius_ > 0.0f))
{
//compute normals
pcl::PointCloud<pcl::Normal>::Ptr normals = rtabmap::util3d::computeNormals(pclCloud, normalK_, normalRadius_);