7 from flexbe_msgs.msg
import CommandFeedback
8 from std_msgs.msg
import Empty
13 A state that can be preempted. 14 If preempted, the state will not be executed anymore and return the outcome preempted. 17 _preempted_name =
'preempted' 23 if len(args) > 0
and type(args[0])
is list:
27 outcomes = kwargs.get(
'outcomes', [])
29 kwargs[
'outcomes'] = outcomes
31 super(PreemptableState, self).
__init__(*args, **kwargs)
38 self.
_pub = ProxyPublisher()
39 self.
_sub = ProxySubscriberCached()
41 PreemptableState.preempt =
False 48 self._pub.publish(self.
_feedback_topic, CommandFeedback(command=
"preempt"))
50 PreemptableState.preempt =
True 51 rospy.loginfo(
"--> Behavior will be preempted")
53 if PreemptableState.preempt:
55 rospy.loginfo(
"Behavior will be preempted")
58 self.service_preempt()
69 self._pub.publish(self.
_feedback_topic, CommandFeedback(command=
"preempt"))
70 PreemptableState.preempt =
True 77 PreemptableState.preempt =
False
def _notify_skipped(self)
def _preemptable_execute(self, args, kwargs)
def __init__(self, args, kwargs)
def _disable_ros_control(self)
def _enable_ros_control(self)