test_behavior_log_sm.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 ###########################################################
4 # WARNING: Generated code! #
5 # ************************** #
6 # Manual changes may get lost if file is generated again. #
7 # Only code inside the [MANUAL] tags will be kept. #
8 ###########################################################
9 
10 from flexbe_core import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger
11 from flexbe_states.log_state import LogState as flexbe_states__LogState
12 from flexbe_states.wait_state import WaitState
13 # Additional imports can be added inside the following tags
14 # [MANUAL_IMPORT]
15 
16 # [/MANUAL_IMPORT]
17 
18 
19 '''
20 Created on Mon Mar 30 2020
21 @author: Philipp Schillinger
22 '''
23 class TestBehaviorLogSM(Behavior):
24  '''
25  Simple behavior for testing the onboard engine.
26  '''
27 
28 
29  def __init__(self):
30  super(TestBehaviorLogSM, self).__init__()
31  self.name = 'Test Behavior Log'
32 
33  # parameters of this behavior
34 
35  # references to used behaviors
36 
37  # Additional initialization code can be added inside the following tags
38  # [MANUAL_INIT]
39 
40  # [/MANUAL_INIT]
41 
42  # Behavior comments:
43 
44 
45 
46  def create(self):
47  # x:30 y:365, x:130 y:365
48  _state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
49 
50  # Additional creation code can be added inside the following tags
51  # [MANUAL_CREATE]
52 
53  # [/MANUAL_CREATE]
54 
55 
56  with _state_machine:
57  # x:30 y:40
58  OperatableStateMachine.add('Log',
59  flexbe_states__LogState(text="Test data", severity=2),
60  transitions={'done': 'Wait'},
61  autonomy={'done': Autonomy.Off})
62  # x:30 y:90
63  OperatableStateMachine.add('Wait',
64  WaitState(wait_time=1.0),
65  transitions={'done': 'finished'},
66  autonomy={'done': Autonomy.Off})
67 
68 
69  return _state_machine
70 
71 
72  # Private functions can be added inside the following tags
73  # [MANUAL_FUNC]
74 
75  # [/MANUAL_FUNC]


flexbe_onboard
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:43