54 NODELET_ERROR (
"[%s::onInit] Need a 'search_radius' parameter to be set before continuing!",
getName ().c_str ());
59 NODELET_ERROR (
"[%s::onInit] Need a 'spatial_locator' parameter to be set before continuing!",
getName ().c_str ());
64 srv_ = boost::make_shared<dynamic_reconfigure::Server<MLSConfig> > (*pnh_);
66 srv_->setCallback (
f);
71 NODELET_DEBUG (
"[%s::onInit] Nodelet successfully created with the following parameters:\n"
72 " - use_indices : %s",
87 sub_input_filter_.subscribe (*pnh_,
"input", 1);
89 sub_indices_filter_.subscribe (*pnh_,
"indices", 1);
91 if (approximate_sync_)
93 sync_input_indices_a_ = boost::make_shared <message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<PointCloudIn, PointIndices> > >(max_queue_size_);
95 sync_input_indices_a_->connectInput (sub_input_filter_, sub_indices_filter_);
100 sync_input_indices_e_ = boost::make_shared <message_filters::Synchronizer<message_filters::sync_policies::ExactTime<PointCloudIn, PointIndices> > >(max_queue_size_);
102 sync_input_indices_e_->connectInput (sub_input_filter_, sub_indices_filter_);
117 sub_input_filter_.unsubscribe ();
118 sub_indices_filter_.unsubscribe ();
121 sub_input_.shutdown ();
130 if (pub_output_.getNumSubscribers () <= 0 && pub_normals_.getNumSubscribers () <= 0)
140 if (!isValid (cloud))
143 output.header = cloud->header;
144 pub_output_.publish (
ros_ptr(output.makeShared ()));
148 if (indices && !isValid (indices,
"indices"))
151 output.header = cloud->header;
152 pub_output_.publish (
ros_ptr(output.makeShared ()));
159 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n"
160 " - PointIndices with %zu values, stamp %f, and frame %s on topic %s received.",
162 cloud->width * cloud->height,
pcl::getFieldsList (*cloud).c_str (),
fromPCL(cloud->header).stamp.toSec (), cloud->header.frame_id.c_str (), getMTPrivateNodeHandle ().resolveName (
"input").c_str (),
163 indices->indices.size (), indices->header.stamp.toSec (), indices->header.frame_id.c_str (), getMTPrivateNodeHandle ().resolveName (
"indices").c_str ());
165 NODELET_DEBUG (
"[%s::input_callback] PointCloud with %d data points, stamp %f, and frame %s on topic %s received.",
getName ().c_str (), cloud->width * cloud->height,
fromPCL(cloud->header).stamp.toSec (), cloud->header.frame_id.c_str (), getMTPrivateNodeHandle ().resolveName (
"input").c_str ());
169 impl_.setInputCloud (
pcl_ptr(cloud));
173 indices_ptr.reset (
new std::vector<int> (indices->indices));
175 impl_.setIndices (indices_ptr);
184 output.header = cloud->header;
185 pub_output_.publish (
ros_ptr(output.makeShared ()));
186 normals->header = cloud->header;
187 pub_normals_.publish (
ros_ptr(normals));
200 if (search_radius_ != config.search_radius)
202 search_radius_ = config.search_radius;
203 NODELET_DEBUG (
"[config_callback] Setting the search radius: %f.", search_radius_);
204 impl_.setSearchRadius (search_radius_);
206 if (spatial_locator_type_ != config.spatial_locator)
208 spatial_locator_type_ = config.spatial_locator;
209 NODELET_DEBUG (
"[config_callback] Setting the spatial locator to type: %d.", spatial_locator_type_);
211 if (use_polynomial_fit_ != config.use_polynomial_fit)
213 use_polynomial_fit_ = config.use_polynomial_fit;
214 NODELET_DEBUG (
"[config_callback] Setting the use_polynomial_fit flag to: %d.", use_polynomial_fit_);
215 #if PCL_VERSION_COMPARE(<, 1, 9, 0)
216 impl_.setPolynomialFit (use_polynomial_fit_);
218 if (use_polynomial_fit_)
220 NODELET_WARN (
"[config_callback] use_polynomial_fit is deprecated, use polynomial_order instead!");
221 if (impl_.getPolynomialOrder () < 2)
223 impl_.setPolynomialOrder (2);
228 impl_.setPolynomialOrder (0);
232 if (polynomial_order_ != config.polynomial_order)
234 polynomial_order_ = config.polynomial_order;
235 NODELET_DEBUG (
"[config_callback] Setting the polynomial order to: %d.", polynomial_order_);
236 impl_.setPolynomialOrder (polynomial_order_);
238 if (gaussian_parameter_ != config.gaussian_parameter)
240 gaussian_parameter_ = config.gaussian_parameter;
241 NODELET_DEBUG (
"[config_callback] Setting the gaussian parameter to: %f.", gaussian_parameter_);
242 impl_.setSqrGaussParam (gaussian_parameter_ * gaussian_parameter_);