4 from flexbe_msgs.msg
import CommandFeedback
5 from std_msgs.msg
import String
12 A state that can be locked. 13 When locked, no transition can be done regardless of the resulting outcome. 14 However, if any outcome would be triggered, the outcome will be stored 15 and the state won't be executed anymore until it is unlocked and the stored outcome is set. 19 super(LockableState, self).
__init__(*args, **kwargs)
58 if outcome
is None or outcome ==
'None':
62 if self.
parent is not None and not self.parent.transition_allowed(self.
name, outcome):
69 if target == self.
path or target ==
'':
74 found_target = self._parent.lock(target)
77 args=[target, target
if found_target
else ""]))
79 Logger.logwarn(
"Wanted to lock %s, but could not find it in current path %s." % (target, self.
path))
81 Logger.localinfo(
"--> Locking in state %s" % target)
84 if target == self.
path or (self.
_locked and target ==
''):
89 found_target = self._parent.unlock(target)
91 self._pub.publish(self.
_feedback_topic, CommandFeedback(command=
"unlock",
92 args=[target, target
if found_target
else ""]))
94 Logger.logwarn(
"Wanted to unlock %s, but could not find it in current path %s." % (target, self.
path))
96 Logger.localinfo(
"--> Unlocking in state %s" % target)
def _lockable_execute(self, args, kwargs)
def _enable_ros_control(self)
def _disable_ros_control(self)
def _execute_unlock(self, target)
def __init__(self, args, kwargs)
def _execute_lock(self, target)