Skip to content

Commit

Permalink
Use a shared_ptr for the dynamic reconfigure pointer, and create it w…
Browse files Browse the repository at this point in the history
…ith the private node handle so that the parameters for the dynamic reconfigure server are in the private namespace and two image publishers can coexist in the same manager #357
  • Loading branch information
lucasw committed Apr 25, 2019
1 parent 8051b97 commit 3427b70
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions image_publisher/src/nodelet/image_publisher_nodelet.cpp
Expand Up @@ -48,7 +48,8 @@ using namespace boost::assign;
namespace image_publisher {
class ImagePublisherNodelet : public nodelet::Nodelet
{
dynamic_reconfigure::Server<image_publisher::ImagePublisherConfig> srv;
typedef dynamic_reconfigure::Server<image_publisher::ImagePublisherConfig> ReconfigureServer;
boost::shared_ptr<ReconfigureServer> srv;

image_transport::CameraPublisher pub_;

Expand Down Expand Up @@ -184,9 +185,10 @@ class ImagePublisherNodelet : public nodelet::Nodelet

timer_ = nh_.createTimer(ros::Duration(1), &ImagePublisherNodelet::do_work, this);

dynamic_reconfigure::Server<image_publisher::ImagePublisherConfig>::CallbackType f =
srv.reset(new ReconfigureServer(getPrivateNodeHandle()));
ReconfigureServer::CallbackType f =
boost::bind(&ImagePublisherNodelet::reconfigureCallback, this, _1, _2);
srv.setCallback(f);
srv->setCallback(f);
}
};
}
Expand Down

0 comments on commit 3427b70

Please sign in to comment.