37 #if BOOST_VERSION < 106000 // since 1.60.0, boost uses placeholders namesapce for _1,_2... 38 #ifndef BOOST_PLAEHOLDERS 39 #define BOOST_PLAEHOLDERS 42 namespace placeholders
55 #endif // BOOST_PLAEHOLDERS 56 #endif // BOOST_VERSION < 106000 60 void Nodelet::onInit()
65 pnh_->param(
"always_subscribe", always_subscribe_,
false);
66 pnh_->param(
"verbose_connection", verbose_connection_,
false);
67 if (!verbose_connection_)
69 nh_->param(
"verbose_connection", verbose_connection_,
false);
72 ever_subscribed_ =
false;
73 timer_ = nh_->createWallTimer(
ros::WallDuration(5), &Nodelet::warnNeverSubscribedCallback,
this,
77 void Nodelet::onInitPostProcess()
79 if (always_subscribe_)
87 if (!ever_subscribed_)
95 if (verbose_connection_)
97 NODELET_INFO(
"New connection or disconnection is detected");
99 if (!always_subscribe_)
101 boost::mutex::scoped_lock lock(connection_mutex_);
104 if (pub.getNumSubscribers() > 0)
106 if (!ever_subscribed_)
108 ever_subscribed_ =
true;
112 if (verbose_connection_)
124 if (verbose_connection_)
136 if (verbose_connection_)
138 NODELET_INFO(
"New image connection or disconnection is detected");
140 if (!always_subscribe_)
142 boost::mutex::scoped_lock lock(connection_mutex_);
147 if (!ever_subscribed_)
149 ever_subscribed_ =
true;
153 if (verbose_connection_)
165 if (verbose_connection_)
177 cameraConnectionBaseCallback();
182 cameraConnectionBaseCallback();
185 void Nodelet::cameraConnectionBaseCallback()
187 if (verbose_connection_)
189 NODELET_INFO(
"New image connection or disconnection is detected");
191 if (!always_subscribe_)
193 boost::mutex::scoped_lock lock(connection_mutex_);
196 if (pub.getNumSubscribers() > 0)
198 if (!ever_subscribed_)
200 ever_subscribed_ =
true;
204 if (verbose_connection_)
216 if (verbose_connection_)
#define NODELET_WARN(...)
Demo code to calculate moments.
const std::string & getName() const
#define NODELET_INFO(...)
uint32_t getNumSubscribers() const