7 from flexbe_msgs.msg
import CommandFeedback
8 from std_msgs.msg
import String
13 A state that can be locked. 14 When locked, no transition can be done regardless of the resulting outcome. 15 However, if any outcome would be triggered, the outcome will be stored 16 and the state won't be executed anymore until it is unlocked and the stored outcome is set. 20 super(LockableState, self).
__init__(*args, **kwargs)
32 self.
_pub = ProxyPublisher()
33 self.
_sub = ProxySubscriberCached()
62 if outcome
is None or outcome ==
'None':
65 if not self.
_parent is None and not self._parent.transition_allowed(self.
name, outcome):
73 if target == self.
_get_path()
or target ==
'':
78 found_target = self._parent.lock(target)
80 self._pub.publish(self.
_feedback_topic, CommandFeedback(command=
"lock", args=[target, target
if found_target
else ""]))
82 rospy.logwarn(
"--> Wanted to lock %s, but could not find it in current path %s.", target, self.
_get_path())
84 rospy.loginfo(
"--> Locking in state %s", target)
93 found_target = self._parent.unlock(target)
95 self._pub.publish(self.
_feedback_topic, CommandFeedback(command=
"unlock", args=[target, target
if found_target
else ""]))
97 rospy.logwarn(
"--> Wanted to unlock %s, but could not find it in current path %s.", target, self.
_get_path())
99 rospy.loginfo(
"--> 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)