Subclassing the nodelet::Loader class

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

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

Comments

Hi, I'm currently working on something similar to this where we want a watchdog node/nodelet that can kill and restart nodes/nodelets when they stop responding or die for whatever reason. Have you come across a solution?

yassie gravatar image yassie  ( 2022-01-14 05:10:21 -0500 )edit