src
flexbe_states
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
)
flexbe_states.operator_decision_state.OperatorDecisionState.__init__
def __init__(self, outcomes, hint=None, suggestion=None)
Definition:
operator_decision_state.py:20
flexbe_states.operator_decision_state.OperatorDecisionState._suggestion
_suggestion
Definition:
operator_decision_state.py:23
flexbe_states.operator_decision_state.OperatorDecisionState.execute
def execute(self, userdata)
Definition:
operator_decision_state.py:25
flexbe_states.operator_decision_state.OperatorDecisionState.on_enter
def on_enter(self, userdata)
Definition:
operator_decision_state.py:29
flexbe_states.operator_decision_state.OperatorDecisionState
Definition:
operator_decision_state.py:5
flexbe_states.operator_decision_state.OperatorDecisionState._hint
_hint
Definition:
operator_decision_state.py:22
flexbe_states
Author(s): Philipp Schillinger
autogenerated on Fri Jul 21 2023 02:26:17