silent_state_machine.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from smach.state_machine import StateMachine
4 
5 from .preemptable_state_machine import PreemptableStateMachine
6 from flexbe_core.core.loopback_state import LoopbackState
7 import rospy
8 
9 
10 class SilentStateMachine(PreemptableStateMachine):
11  """
12  A state machine that runs in background and does not report any transition.
13  """
14 
15  def __init__(self, *args, **kwargs):
16  super(SilentStateMachine, self).__init__(*args, **kwargs)
17  self.name = None
18  self.transitions = None
19  self.autonomy = None
20  self._parent = None
21 
22  @staticmethod
23  def add(label, state, transitions = None, autonomy = None, remapping = None):
24  """
25  Add a state to the opened state machine.
26 
27  @type label: string
28  @param label: The label of the state being added.
29 
30  @param state: An instance of a class implementing the L{State} interface.
31 
32  @param transitions: A dictionary mapping state outcomes to other state
33  labels or container outcomes.
34 
35  @param autonomy: A dictionary mapping state outcomes to their required
36  autonomy level. Not relevant for this class.
37 
38  @param remapping: A dictrionary mapping local userdata keys to userdata
39  keys in the container.
40  """
41  self = StateMachine._currently_opened_container()
42 
43  # add loopback transition to loopback states
44  if isinstance(state, LoopbackState):
45  transitions[LoopbackState._loopback_name] = label
46 
47  StateMachine.add(label, state, transitions, remapping)
48 
49  state.name = label
50  state.transitions = transitions
51  state.autonomy = None
52  state._parent = self
53  state._mute = True
54 
55  def destroy(self):
56  pass
def add(label, state, transitions=None, autonomy=None, remapping=None)


flexbe_core
Author(s): Philipp Schillinger
autogenerated on Wed Jun 5 2019 21:51:59