6 from flexbe_msgs.msg
import CommandFeedback, OutcomeRequest
9 from diagnostic_msgs.msg
import DiagnosticArray, DiagnosticStatus
14 A state to monitor a custom set of conditions. 15 For each conditions, an outcome is added or mapped which will be returned if the condition is not met. 19 super(MonitoringState, self).
__init__(*args, **kwargs)
21 outcomes = kwargs.get(
'outcomes', [])
23 self._outcome_list.remove(
'loopback')
38 self.
_sub = ProxySubscriberCached()
47 for status
in diag_msg.status:
48 if not status.name
in self._monitored_keys.keys():
continue 49 if status.level == DiagnosticStatus.WARN:
51 if not status.name +
"_warn" in self.
_sent_keys:
52 self._sent_keys.append(status.name +
"_warn")
53 Logger.logwarn(
"%s: %s" % (status.name, status.message))
54 if status.level == DiagnosticStatus.ERROR:
55 if not status.name +
"_err" in self.
_sent_keys:
56 self._sent_keys.append(status.name +
"_err")
57 Logger.logerr(
"%s: %s" % (status.name, status.message))
58 new_status = status.name
75 oc = outcome
if not outcome
is None else key
77 if not oc
in self._outcomes:
78 self.register_outcomes([oc])
79 self._outcome_list.append(oc)
98 return self._parent._get_path() +
"/" + self.
name
def _enable_ros_control(self)
def force_monitoring(self)
def _disable_ros_control(self)
def monitor(self, key, outcome=None)
def __init__(self, args, kwargs)
def _monitoring_execute(self, args, kwargs)