LazyNodelet for segmentation/SegmentDifferences

This commit is contained in:
Kentaro Wada 2017-08-22 16:48:25 +00:00 committed by Paul Bovbel
parent 3cab2abb15
commit 071de1e3b4
2 changed files with 24 additions and 5 deletions

View File

@ -81,6 +81,10 @@ namespace pcl_ros
/** \brief Nodelet initialization routine. */ /** \brief Nodelet initialization routine. */
void onInit (); void onInit ();
/** \brief LazyNodelet connection routine. */
void subscribe ();
void unsubscribe ();
/** \brief Dynamic reconfigure callback /** \brief Dynamic reconfigure callback
* \param config the config object * \param config the config object
* \param level the dynamic reconfigure level * \param level the dynamic reconfigure level

View File

@ -46,8 +46,20 @@ pcl_ros::SegmentDifferences::onInit ()
// Call the super onInit () // Call the super onInit ()
PCLNodelet::onInit (); PCLNodelet::onInit ();
pub_output_ = pnh_->advertise<PointCloud> ("output", max_queue_size_); pub_output_ = advertise<PointCloud> (*pnh_, "output", max_queue_size_);
NODELET_DEBUG ("[%s::onInit] Nodelet successfully created with the following parameters:\n"
" - max_queue_size : %d",
getName ().c_str (),
max_queue_size_);
onInitPostProcess ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void
pcl_ros::SegmentDifferences::subscribe ()
{
// Subscribe to the input using a filter // Subscribe to the input using a filter
sub_input_filter_.subscribe (*pnh_, "input", max_queue_size_); sub_input_filter_.subscribe (*pnh_, "input", max_queue_size_);
sub_target_filter_.subscribe (*pnh_, "target", max_queue_size_); sub_target_filter_.subscribe (*pnh_, "target", max_queue_size_);
@ -69,11 +81,14 @@ pcl_ros::SegmentDifferences::onInit ()
sync_input_target_e_->connectInput (sub_input_filter_, sub_target_filter_); sync_input_target_e_->connectInput (sub_input_filter_, sub_target_filter_);
sync_input_target_e_->registerCallback (bind (&SegmentDifferences::input_target_callback, this, _1, _2)); sync_input_target_e_->registerCallback (bind (&SegmentDifferences::input_target_callback, this, _1, _2));
} }
}
NODELET_DEBUG ("[%s::onInit] Nodelet successfully created with the following parameters:\n" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
" - max_queue_size : %d", void
getName ().c_str (), pcl_ros::SegmentDifferences::unsubscribe ()
max_queue_size_); {
sub_input_filter_.unsubscribe ();
sub_target_filter_.unsubscribe ();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////