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


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:46