Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsk_pcl_ros] ExtractIndices debug #2628

Merged
merged 8 commits into from
Sep 24, 2021
Merged
10 changes: 10 additions & 0 deletions jsk_pcl_ros/src/extract_indices_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ namespace jsk_pcl_ros
pcl_conversions::toPCL(*cloud_msg, *input);
pcl::PointIndices::Ptr indices (new pcl::PointIndices ());
pcl_conversions::toPCL(*indices_msg, *indices);

// check if input size is bigger than indices size
uint8_t data_size = static_cast<uint8_t>(input->data.size());
uint32_t point_step_size = static_cast<uint32_t>(input->point_step);
uint8_t cloud_size = data_size / point_step_size;
uint8_t indices_size = static_cast<uint8_t>(indices->indices.size());
if (cloud_size < indices_size){
NODELET_ERROR("Input index is out of expected cloud size: %d > %d", indices_size, cloud_size);
return;
}

// extract pointcloud with indices
pcl::ExtractIndices<pcl::PCLPointCloud2> extract;
Expand Down