priority_container.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from flexbe_core.core.operatable_state_machine import OperatableStateMachine
3 
4 
6  """
7  A state machine that is always executed alone when becoming active.
8  """
9 
10  active_container = None
11 
12  def __init__(self, conditions=dict(), *args, **kwargs):
13  super(PriorityContainer, self).__init__(*args, **kwargs)
15 
16  def execute(self, *args, **kwargs):
17  if (PriorityContainer.active_container is None
18  or not all(p == PriorityContainer.active_container.split('/')[i]
19  for i, p in enumerate(self.path.split('/')))):
20  self._parent_active_container = PriorityContainer.active_container
21  PriorityContainer.active_container = self.path
22 
23  outcome = OperatableStateMachine.execute(self, *args, **kwargs)
24 
25  if outcome is not None:
26  PriorityContainer.active_container = self._parent_active_container
27 
28  return outcome
def __init__(self, conditions=dict(), args, kwargs)


flexbe_core
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:39