Subclassing the nodelet::Loader class

asked 2018-09-10 19:12:58 -0600

KenYN gravatar image

I can use bond::Bond to set up a watchdog so that if we get a crash in a linked node we get a notification to perhaps reconnect subscriptions, etc.

However, in a nodelet situation we have multiple nodelets within a single node, so creating a watchdog for every single nodelet seems a waste of resources, so ideally I would like to customise nodelet::Loader to add something like:

 void Loader::reloadAll (const std::string & name)
 {
   boost::mutex::scoped_lock lock (lock_);
   Impl::M_stringToNodelet::iterator it = impl_->nodelets_.begin();
   for (; it != impl_->nodelets_.end(); ++it)
   {
     it->second->reload();
   }
 }

Then each nodelet can implement the reload() API to refresh its subscriptions, etc.

How can I do this, or is there another way? nodelet::LoaderROS already uses bond, so can we leverage that somehow?

edit retag flag offensive close merge delete