Esempio n. 1
0
 def __init__(self, label=None, input_keys=[], output_keys=[], io_keys=[]):
     """Initialise a Container.
     """
     Task.__init__(self, label=label, input_keys=input_keys, output_keys=output_keys, io_keys=io_keys)
     ContainerMixin.__init__(self)
     self._tasks = []
     self._remappings = []
     self._block_on_preempt = []
Esempio n. 2
0
 def __init__(self, sleep_duration, label=None, succeed=True):
     Task.__init__(self, label=label)
     
     # Write-once
     self._sleep_duration = rospy.Duration(sleep_duration) if isinstance(sleep_duration, (int, long, float)) else sleep_duration
     self._sleep_rate = rospy.Rate(1000.0)
     self._result = Task.SUCCEEDED if succeed else Task.ABORTED
     
     # Mutable
     self._preempt_requested = False
     self._parent_cb = None
Esempio n. 3
0
    def __init__(self, sleep_duration, label=None, succeed=True):
        Task.__init__(self, label=label)

        # Write-once
        self._sleep_duration = rospy.Duration(sleep_duration) if isinstance(
            sleep_duration, (int, long, float)) else sleep_duration
        self._sleep_rate = rospy.Rate(1000.0)
        self._result = Task.SUCCEEDED if succeed else Task.ABORTED

        # Mutable
        self._preempt_requested = False
        self._parent_cb = None
Esempio n. 4
0
 def __init__(self, state, label=None, success_outcomes=['success'], should_block=False):
     """Initialise a StateTask.
     
     state: State to wrap as a Task.
     success_outcomes: list of outcomes to be considered successful; any other outcomes will be unsuccessful
     should_block: true if the Task should block until a result is received, rather than returning a Deferred object
     """
     Task.__init__(self, label=label)
     
     # Write-once
     self._state = state
     self._should_block = should_block
     self._success_outcomes = success_outcomes
     self._thread = None
     
     # Mutable
     self._parent_cb = None
Esempio n. 5
0
    def __init__(self,
                 state,
                 label=None,
                 success_outcomes=['success'],
                 should_block=False):
        """Initialise a StateTask.
        
        state: State to wrap as a Task.
        success_outcomes: list of outcomes to be considered successful; any other outcomes will be unsuccessful
        should_block: true if the Task should block until a result is received, rather than returning a Deferred object
        """
        Task.__init__(self, label=label)

        # Write-once
        self._state = state
        self._should_block = should_block
        self._success_outcomes = success_outcomes
        self._thread = None

        # Mutable
        self._parent_cb = None
Esempio n. 6
0
    def __init__(
            self,
            topic_name,
            topic_spec,
            label=None,
            # Receive Policy
            exec_cb=None,
            exec_cb_args=[],
            exec_cb_kwargs={},
            exec_key=None,
            exec_slots=[],
            # Keys
            input_keys=[],
            output_keys=[]):

        Task.__init__(self,
                      label=label,
                      input_keys=input_keys,
                      output_keys=output_keys)

        self._topic_name = topic_name
        self._topic_spec = topic_spec

        self._exec_cb = exec_cb
        self._exec_cb_args = exec_cb_args
        self._exec_cb_kwargs = exec_cb_kwargs

        self._exec_cb_input_keys = input_keys
        self._exec_cb_output_keys = output_keys

        self._exec_key = exec_key
        if exec_key is not None:
            self.register_output_keys([exec_key])

        self._exec_slots = exec_slots
        self.register_output_keys(exec_slots)

        self._sub = rospy.Subscriber(topic_name, topic_spec, self._recv_cb)
        self._last_msg = None
Esempio n. 7
0
    def __init__(
        self,
        topic_name,
        topic_spec,
        label=None,
        # Receive Policy
        exec_cb=None,
        exec_cb_args=[],
        exec_cb_kwargs={},
        exec_key=None,
        exec_slots=[],
        # Keys
        input_keys=[],
        output_keys=[]
        ):
        
        Task.__init__(self, label=label, input_keys=input_keys, output_keys=output_keys)
        
        self._topic_name = topic_name
        self._topic_spec = topic_spec
        
        self._exec_cb = exec_cb
        self._exec_cb_args = exec_cb_args
        self._exec_cb_kwargs = exec_cb_kwargs
        
        self._exec_cb_input_keys = input_keys
        self._exec_cb_output_keys = output_keys

        self._exec_key = exec_key
        if exec_key is not None:
            self.register_output_keys([exec_key])

        self._exec_slots = exec_slots
        self.register_output_keys(exec_slots)
        
        self._sub = rospy.Subscriber(topic_name, topic_spec, self._recv_cb)
        self._last_msg = None
Esempio n. 8
0
 def __init__(self, value, label=None, key="data"):
     """Initialise a SetUserDataTask.
     """
     Task.__init__(self, label=label, output_keys=[key])
     self._key = key
     self._value = value
Esempio n. 9
0
 def __init__(self, output_key, label=None):
     Task.__init__(self, label=label)
     self._output_key = output_key
Esempio n. 10
0
 def __init__(self, msg, label=None):
     Task.__init__(self, label=label)
     self._msg = msg
Esempio n. 11
0
 def __init__(self, task, label=None):
     Task.__init__(self, label=label)
     assert (task is not None)
     self._task = task
Esempio n. 12
0
 def __init__(self, label=None):
     """Initialise a FalseTask.
     """
     Task.__init__(self, label=label)
Esempio n. 13
0
 def __init__(self, value, label=None, key="data"):
     """Initialise a SetUserDataTask.
     """
     Task.__init__(self, label=label, output_keys=[key])
     self._key = key
     self._value = value
Esempio n. 14
0
 def __init__(self, output_key, label=None):
     Task.__init__(self, label=label)
     self._output_key = output_key
Esempio n. 15
0
 def __init__(self, msg, label=None):
     Task.__init__(self, label=label)
     self._msg = msg
Esempio n. 16
0
 def __init__(self, task, label=None):
     Task.__init__(self, label=label)
     assert(task is not None)
     self._task = task
Esempio n. 17
0
 def __init__(self, label=None):
     """Initialise a FalseTask.
     """
     Task.__init__(self, label=label)