priority_container.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import traceback
00003 import smach
00004 
00005 from smach.state_machine import StateMachine
00006 
00007 from flexbe_core.core.operatable_state_machine import OperatableStateMachine
00008 
00009 
00010 class PriorityContainer(OperatableStateMachine):
00011     """
00012     A state machine that is always executed alone when becoming active.
00013     """
00014     active_container = None
00015     
00016     def __init__(self, conditions=dict(), *args, **kwargs):
00017         super(PriorityContainer, self).__init__(*args, **kwargs)
00018 
00019         self._parent_active_container = None
00020 
00021     def execute(self, *args, **kwargs):
00022         if PriorityContainer.active_container != self._get_path():
00023             self._parent_active_container = PriorityContainer.active_container
00024             PriorityContainer.active_container = self._get_path()
00025 
00026         outcome = OperatableStateMachine.execute(self, *args, **kwargs)
00027 
00028         if outcome != self._loopback_name:
00029             PriorityContainer.active_container = self._parent_active_container
00030 
00031         return outcome


flexbe_core
Author(s): Philipp Schillinger
autogenerated on Thu Jun 6 2019 19:32:27