47 srv_ = boost::make_shared <dynamic_reconfigure::Server<pcl_ros::VoxelGridConfig> > (nh);
49 srv_->setCallback (f);
60 boost::mutex::scoped_lock lock (
mutex_);
61 pcl::PCLPointCloud2::Ptr pcl_input(
new pcl::PCLPointCloud2);
63 impl_.setInputCloud (pcl_input);
64 impl_.setIndices (indices);
65 pcl::PCLPointCloud2 pcl_output;
66 impl_.filter (pcl_output);
74 boost::mutex::scoped_lock lock (
mutex_);
76 Eigen::Vector3f leaf_size =
impl_.getLeafSize ();
77 Eigen::Vector3f config_leaf_size;
79 config_leaf_size[0] = (config.leaf_size_x >= 0.0 ? config.leaf_size_x : config.leaf_size);
80 config_leaf_size[1] = (config.leaf_size_y >= 0.0 ? config.leaf_size_y : config.leaf_size);
81 config_leaf_size[2] = (config.leaf_size_z >= 0.0 ? config.leaf_size_z : config.leaf_size);
83 if (leaf_size != config_leaf_size) {
84 NODELET_DEBUG(
"[config_callback] Setting the downsampling leaf size to: (%f, %f, %f).",
85 config_leaf_size[0], config_leaf_size[1], config_leaf_size[2]);
86 impl_.setLeafSize(config_leaf_size[0], config_leaf_size[1], config_leaf_size[2]);
88 unsigned int minPointsPerVoxel =
impl_.getMinimumPointsNumberPerVoxel ();
89 if (minPointsPerVoxel != ((
unsigned int) config.min_points_per_voxel))
91 minPointsPerVoxel = config.min_points_per_voxel;
92 NODELET_DEBUG (
"[config_callback] Setting the minimum points per voxel to: %u.", minPointsPerVoxel);
93 impl_.setMinimumPointsNumberPerVoxel (minPointsPerVoxel);
96 double filter_min, filter_max;
97 impl_.getFilterLimits (filter_min, filter_max);
98 if (filter_min != config.filter_limit_min)
100 filter_min = config.filter_limit_min;
101 NODELET_DEBUG (
"[config_callback] Setting the minimum filtering value a point will be considered from to: %f.", filter_min);
103 if (filter_max != config.filter_limit_max)
105 filter_max = config.filter_limit_max;
106 NODELET_DEBUG (
"[config_callback] Setting the maximum filtering value a point will be considered from to: %f.", filter_max);
108 impl_.setFilterLimits (filter_min, filter_max);
110 if (
impl_.getFilterLimitsNegative () != config.filter_limit_negative)
112 impl_.setFilterLimitsNegative (config.filter_limit_negative);
113 NODELET_DEBUG (
"[%s::config_callback] Setting the filter negative flag to: %s.",
getName ().c_str (), config.filter_limit_negative ?
"true" :
"false");
116 if (
impl_.getFilterFieldName () != config.filter_field_name)
118 impl_.setFilterFieldName (config.filter_field_name);
119 NODELET_DEBUG (
"[config_callback] Setting the filter field name to: %s.", config.filter_field_name.c_str ());
virtual void filter(const PointCloud2::ConstPtr &input, const IndicesPtr &indices, PointCloud2 &output)
Call the actual filter.
pcl_ros::VoxelGrid VoxelGrid
std::string tf_input_frame_
The input TF frame the data should be transformed into, if input.header.frame_id is different...
bool child_init(ros::NodeHandle &nh, bool &has_service)
Child initialization routine.
std::string tf_output_frame_
The output TF frame the data should be transformed into, if input.header.frame_id is different...
pcl::IndicesPtr IndicesPtr
boost::shared_ptr< dynamic_reconfigure::Server< pcl_ros::VoxelGridConfig > > srv_
Pointer to a dynamic reconfigure service.
sensor_msgs::PointCloud2 PointCloud2
VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data...
void config_callback(pcl_ros::VoxelGridConfig &config, uint32_t level)
Dynamic reconfigure callback.
const std::string & getName() const
boost::mutex mutex_
Internal mutex.
void toPCL(const ros::Time &stamp, std::uint64_t &pcl_stamp)
pcl::VoxelGrid< pcl::PCLPointCloud2 > impl_
The PCL filter implementation used.
void moveFromPCL(pcl::PCLImage &pcl_image, sensor_msgs::Image &image)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
#define NODELET_DEBUG(...)