10 from flexbe_INVALID
import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger
11 from flexbe_states.wait_state
import WaitState
12 from flexbe_states.decision_state
import DecisionState
13 from flexbe_states.log_state
import LogState
as flexbe_states__LogState
14 from flexbe_states.calculation_state
import CalculationState
17 raise ValueError(
"TODO: Remove!")
22 Created on Mon Mar 30 2020 23 @author: Philipp Schillinger 27 A more complex behavior for testing the onboard engine. 28 Note: This behavior contains intentional errors that are fixed by sent modifications. 33 super(TestBehaviorComplexSM, self).
__init__()
34 self.
name =
'Test Behavior Complex' 37 self.add_parameter(
'param',
'value_1')
52 _state_machine = OperatableStateMachine(outcomes=[
'finished',
'failed'], input_keys=[
'data'])
53 _state_machine.userdata.data = 0
63 OperatableStateMachine.add(
'Wait',
64 WaitState(wait_time=0.5),
65 transitions={
'done':
'Calculate'},
66 autonomy={
'done': Autonomy.Off})
69 OperatableStateMachine.add(
'Log Param',
70 flexbe_states__LogState(text=self.param, severity=2),
71 transitions={
'done':
'Verify Input'},
72 autonomy={
'done': Autonomy.Off})
75 OperatableStateMachine.add(
'Verify Input',
76 DecisionState(outcomes=[
'accepted',
'rejected'], conditions=
lambda x:
'accepted' if x > 3
else 'rejected'),
77 transitions={
'accepted':
'finished',
'rejected':
'failed'},
78 autonomy={
'accepted': Autonomy.Off,
'rejected': Autonomy.Off},
79 remapping={
'input_value':
'data'})
82 OperatableStateMachine.add(
'Calculate',
84 transitions={
'done':
'Log Param'},
85 autonomy={
'done': Autonomy.Off},
86 remapping={
'input_value':
'data',
'output_value':
'data'})
def _calculate(self, data)