operator_decision_state.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from flexbe_core import EventState, Logger
4 
5 '''
6 Created on 12.12.2013
7 
8 @author: Philipp Schillinger
9 '''
10 
11 class OperatorDecisionState(EventState):
12  '''
13  Implements a state where the operator has to manually choose an outcome.
14  Autonomy Level of all outcomes should be set to Full, because this state is not able to choose an outcome on its own.
15  Only exception is the suggested outcome, which will be returned immediately by default.
16  This state can be used to create alternative execution paths by setting the suggestion to High autonomy instead of Full.
17 
18  -- outcomes string[] A list of all possible outcomes of this state.
19  -- hint string Text displayed to the operator to give instructions how to decide.
20  -- suggestion string The outcome which is suggested. Will be returned if the level of autonomy is high enough.
21 
22  '''
23 
24 
25  def __init__(self, outcomes, hint=None, suggestion=None):
26  '''
27  Constructor
28  '''
29  super(OperatorDecisionState, self).__init__(outcomes=outcomes)
30 
31  self._hint = hint
32  self._suggestion = suggestion
33  self._my_outcomes = outcomes
34 
35 
36  def execute(self, userdata):
37  '''
38  Execute this state
39  '''
40  if self._suggestion is not None and self._my_outcomes.count(self._suggestion) > 0:
41  return self._suggestion
42 
43 
44  def on_enter(self, userdata):
45  if self._hint is not None:
46  Logger.loghint(self._hint)
def __init__(self, outcomes, hint=None, suggestion=None)


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Wed Jun 5 2019 21:52:08