50 if (!
pnh_->getParam (
"model_type", model_type))
52 NODELET_ERROR (
"[%s::onInit] Need a 'model_type' parameter to be set before continuing!",
getName ().c_str ());
57 bool copy_all_data =
false;
60 bool copy_all_fields =
true;
62 pnh_->getParam (
"copy_all_data", copy_all_data);
63 pnh_->getParam (
"copy_all_fields", copy_all_fields);
70 NODELET_DEBUG (
"[%s::onInit] Nodelet successfully created with the following parameters:\n"
71 " - model_type : %d\n"
72 " - copy_all_data : %s\n"
73 " - copy_all_fields : %s",
75 model_type, (copy_all_data) ?
"true" :
"false", (copy_all_fields) ?
"true" :
"false");
78 impl_.setModelType (model_type);
79 impl_.setCopyAllFields (copy_all_fields);
80 impl_.setCopyAllData (copy_all_data);
94 sub_indices_filter_.subscribe (*pnh_,
"indices", max_queue_size_);
96 sub_model_.subscribe (*pnh_,
"model", max_queue_size_);
98 if (approximate_sync_)
100 sync_input_indices_model_a_ = boost::make_shared <message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<PointCloud2, PointIndices, ModelCoefficients> > > (max_queue_size_);
101 sync_input_indices_model_a_->connectInput (sub_input_filter_, sub_indices_filter_, sub_model_);
106 sync_input_indices_model_e_ = boost::make_shared <message_filters::Synchronizer<message_filters::sync_policies::ExactTime<PointCloud2, PointIndices, ModelCoefficients> > > (max_queue_size_);
107 sync_input_indices_model_e_->connectInput (sub_input_filter_, sub_indices_filter_, sub_model_);
121 sub_input_filter_.unsubscribe ();
122 sub_model_.unsubscribe ();
131 if (pub_output_.getNumSubscribers () <= 0)
134 if (!isValid (model) || !isValid (indices) || !isValid (cloud))
141 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n"
142 " - PointIndices with %zu values, stamp %f, and frame %s on topic %s received.\n"
143 " - ModelCoefficients with %zu values, stamp %f, and frame %s on topic %s received.",
145 cloud->width * cloud->height,
pcl::getFieldsList (*cloud).c_str (), cloud->header.stamp.toSec (), cloud->header.frame_id.c_str (), pnh_->resolveName (
"input").c_str (),
146 indices->indices.size (), indices->header.stamp.toSec (), indices->header.frame_id.c_str (), pnh_->resolveName (
"inliers").c_str (),
147 model->values.size (), model->header.stamp.toSec (), model->header.frame_id.c_str (), pnh_->resolveName (
"model").c_str ());
149 tf_input_orig_frame_ = cloud->header.frame_id;
153 vindices.reset (
new std::vector<int> (indices->indices));
156 computePublish (cloud, vindices);