本文整理汇总了C++中image_transport::SubscriberFilter::unsubscribe方法的典型用法代码示例。如果您正苦于以下问题:C++ SubscriberFilter::unsubscribe方法的具体用法?C++ SubscriberFilter::unsubscribe怎么用?C++ SubscriberFilter::unsubscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image_transport::SubscriberFilter
的用法示例。
在下文中一共展示了SubscriberFilter::unsubscribe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disconnectCb
void disconnectCb()
{
num_subs--;
if(num_subs <= 0)
{
color_image_sub_.unsubscribe();
pc_sub_.unsubscribe();
}
}
示例2: connectCallback
// Connection callback that unsubscribes from the tracker if no one is subscribed.
void connectCallback(message_filters::Subscriber<CameraInfo> &sub_cam,
message_filters::Subscriber<GroundPlane> &sub_gp,
image_transport::SubscriberFilter &sub_col,
image_transport::SubscriberFilter &sub_dep,
image_transport::ImageTransport &it) {
if(!pub_message.getNumSubscribers() && !pub_result_image.getNumSubscribers() && !pub_centres.getNumSubscribers() && !pub_detected_persons.getNumSubscribers()) {
ROS_DEBUG("Upper Body Detector: No subscribers. Unsubscribing.");
sub_cam.unsubscribe();
sub_gp.unsubscribe();
sub_col.unsubscribe();
sub_dep.unsubscribe();
} else {
ROS_DEBUG("Upper Body Detector: New subscribers. Subscribing.");
sub_cam.subscribe();
sub_gp.subscribe();
sub_col.subscribe(it,sub_col.getTopic().c_str(),1);
sub_dep.subscribe(it,sub_dep.getTopic().c_str(),1);
}
}
示例3: connectCb
// Handles (un)subscribing when clients (un)subscribe
void DisparityWideNodelet::connectCb()
{
boost::lock_guard<boost::mutex> lock(connect_mutex_);
if (pub_disparity_.getNumSubscribers() == 0)
{
sub_l_image_.unsubscribe();
sub_l_info_ .unsubscribe();
sub_r_image_.unsubscribe();
sub_r_info_ .unsubscribe();
}
else if (!sub_l_image_.getSubscriber())
{
ros::NodeHandle &nh = getNodeHandle();
// Queue size 1 should be OK; the one that matters is the synchronizer queue size.
/// @todo Allow remapping left, right?
image_transport::TransportHints hints("raw", ros::TransportHints(), getPrivateNodeHandle());
sub_l_image_.subscribe(*it_, "left_wide/image_rect", 1, hints);
sub_l_info_ .subscribe(nh, "left_wide/camera_info", 1);
sub_r_image_.subscribe(*it_, "right/image_rect", 1, hints);
sub_r_info_ .subscribe(nh, "right/camera_info", 1);
}
}
示例4: disconnectCallback
/// Unsubscribe from camera topics if possible.
void disconnectCallback()
{
if (sub_counter_ > 0)
{
ROS_INFO("[fiducials] Unsubscribing from camera topics");
color_camera_image_sub_.unsubscribe();
color_camera_info_sub_.unsubscribe();
sub_counter_--;
ROS_INFO("[fiducials] %i subscribers on camera topics [OK]", sub_counter_);
}
}
示例5: disconnectCallback
/// Unsubscribe from camera topics if possible.
void disconnectCallback()
{
sub_counter_--;
if (sub_counter_ == 0)
{
ROS_DEBUG("[all_camera_viewer] Unsubscribing from camera topics");
if (use_right_color_camera_)
{
right_color_camera_image_sub_.unsubscribe();
right_camera_info_sub_.unsubscribe();
}
if (use_left_color_camera_)
{
left_color_camera_image_sub_.unsubscribe();
left_camera_info_sub_.unsubscribe();
}
if (use_tof_camera_)
{
tof_camera_grey_image_sub_.unsubscribe();
}
}
}
示例6: connectCallback
// Connection callback that unsubscribes from the tracker if no one is subscribed.
void connectCallback(ros::Subscriber &sub_msg,
ros::NodeHandle &n,
string gp_topic,
string img_topic,
Subscriber<GroundPlane> &sub_gp,
Subscriber<CameraInfo> &sub_cam,
image_transport::SubscriberFilter &sub_col,
image_transport::ImageTransport &it){
if(!pub_message.getNumSubscribers() && !pub_result_image.getNumSubscribers() && !pub_detected_persons.getNumSubscribers()) {
ROS_DEBUG("HOG: No subscribers. Unsubscribing.");
sub_msg.shutdown();
sub_gp.unsubscribe();
sub_cam.unsubscribe();
sub_col.unsubscribe();
} else {
ROS_DEBUG("HOG: New subscribers. Subscribing.");
if(strcmp(gp_topic.c_str(), "") == 0) {
sub_msg = n.subscribe(img_topic.c_str(), 1, &imageCallback);
}
sub_cam.subscribe();
sub_gp.subscribe();
sub_col.subscribe(it,sub_col.getTopic().c_str(),1);
}
}