diff --git a/src/capabilities/server.py b/src/capabilities/server.py index f1f649c..0cadf42 100644 --- a/src/capabilities/server.py +++ b/src/capabilities/server.py @@ -624,6 +624,10 @@ def __stop_capability(self, name): capability = self.__capability_instances[name] rdepends = get_reverse_depends(name, self.__capability_instances.values()) for cap in rdepends: + if cap.state in ['stopping', 'terminated']: + # It is possible that this cap was stopped by another cap in this list + continue + rospy.loginfo("Capability '{0}' being stopped because its dependency '{1}' is being stopped.".format(cap.name, name)) self.__stop_capability(cap.interface) capability.stopped() self.__launch_manager.stop_capability_provider(capability.pid)