isar 1.25.9__py3-none-any.whl → 1.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of isar might be problematic. Click here for more details.
- isar/apis/models/start_mission_definition.py +55 -108
- isar/apis/robot_control/robot_controller.py +5 -4
- isar/apis/schedule/scheduling_controller.py +4 -32
- isar/apis/security/authentication.py +2 -2
- isar/config/settings.env +1 -3
- isar/config/settings.py +5 -5
- isar/models/communication/message.py +0 -4
- isar/models/communication/queues/queue_utils.py +27 -0
- isar/models/communication/queues/queues.py +23 -5
- isar/robot/robot.py +91 -0
- isar/robot/robot_start_mission.py +73 -0
- isar/robot/robot_status.py +46 -0
- isar/robot/robot_task_status.py +92 -0
- isar/script.py +7 -0
- isar/services/utilities/scheduling_utilities.py +15 -26
- isar/state_machine/state_machine.py +94 -183
- isar/state_machine/states/blocked_protective_stop.py +7 -19
- isar/state_machine/states/idle.py +12 -54
- isar/state_machine/states/monitor.py +43 -90
- isar/state_machine/states/offline.py +8 -33
- isar/state_machine/states/paused.py +1 -1
- isar/state_machine/states_enum.py +0 -2
- isar/state_machine/transitions/fail_mission.py +13 -0
- isar/state_machine/transitions/finish_mission.py +39 -0
- isar/state_machine/transitions/pause.py +24 -0
- isar/state_machine/transitions/resume.py +27 -0
- isar/state_machine/transitions/start_mission.py +73 -0
- isar/state_machine/transitions/stop.py +33 -0
- isar/state_machine/transitions/utils.py +10 -0
- isar/storage/slimm_storage.py +2 -2
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/METADATA +2 -3
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/RECORD +40 -30
- robot_interface/models/mission/task.py +1 -1
- robot_interface/telemetry/mqtt_client.py +0 -1
- robot_interface/telemetry/payloads.py +3 -3
- robot_interface/utilities/json_service.py +1 -1
- isar/state_machine/states/initialize.py +0 -70
- isar/state_machine/states/initiate.py +0 -111
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/LICENSE +0 -0
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/WHEEL +0 -0
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/entry_points.txt +0 -0
- {isar-1.25.9.dist-info → isar-1.26.0.dist-info}/top_level.txt +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
isar/__init__.py,sha256=cH8p8bVveu3FUL6kBhldcSlLaoHgD82Kd0-SwSNfGXw,87
|
|
2
2
|
isar/modules.py,sha256=BeBg2kJi1q-7DzupOM3jFloeMScRk7qkNog9-yGwV5c,7355
|
|
3
|
-
isar/script.py,sha256=
|
|
3
|
+
isar/script.py,sha256=kRpe9Rz8rkqfVW05MSK2Tf4kfv6wgvLBN2oZMacC7-4,6157
|
|
4
4
|
isar/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
isar/apis/api.py,sha256=ARf7-GsjTSqWj9UOSiEJ1YnSF-fH7Tr0-mkkfL10MZ4,12620
|
|
6
6
|
isar/apis/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
isar/apis/models/models.py,sha256=HzLaWhjAv0uJRBWipIgYg_F75eaQ5jl9Pi4UnYbDJ-M,1749
|
|
8
|
-
isar/apis/models/start_mission_definition.py,sha256=
|
|
9
|
-
isar/apis/robot_control/robot_controller.py,sha256=
|
|
8
|
+
isar/apis/models/start_mission_definition.py,sha256=tinAv7U-5GUS6Tj01wuOAzNk2HZWE2iV0wZNdEkhQnU,6351
|
|
9
|
+
isar/apis/robot_control/robot_controller.py,sha256=D8LVMU8TRLohn1nlw2NQXjOxYmzjsOwjm_kr6f-h2VY,1259
|
|
10
10
|
isar/apis/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
isar/apis/schedule/scheduling_controller.py,sha256=
|
|
11
|
+
isar/apis/schedule/scheduling_controller.py,sha256=YXD9YJA9wgydXrE2qexKjaFmCp97CtCElK7Tm29Z2_I,8558
|
|
12
12
|
isar/apis/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
isar/apis/security/authentication.py,sha256=
|
|
13
|
+
isar/apis/security/authentication.py,sha256=kGveLAKqEwpP7eNNRbBUv7R1PHFJRWgh4uDujEPhcmo,1991
|
|
14
14
|
isar/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
isar/config/configuration_error.py,sha256=rO6WOhafX6xvVib8WxV-eY483Z0PpN-9PxGsq5ATfKc,46
|
|
16
16
|
isar/config/log.py,sha256=zHFLmGWQRn8TrcsxUS6KHpJt2JE86kYazU7b-bkcN9o,2285
|
|
17
17
|
isar/config/logging.conf,sha256=mYO1xf27gAopEMHhGzY7-mwyfN16rwRLkPNMvy3zn2g,1127
|
|
18
|
-
isar/config/settings.env,sha256=
|
|
19
|
-
isar/config/settings.py,sha256=
|
|
18
|
+
isar/config/settings.env,sha256=cLIlcXTM8x0N-6XjXmC0Qclx5dfDC6myqa25tvVwmRw,500
|
|
19
|
+
isar/config/settings.py,sha256=dMkFGNvD26ElHo42O_w6Lrk1VBkf2l5Ksbuo93ZIpOE,12867
|
|
20
20
|
isar/config/certs/ca-cert.pem,sha256=qoNljfad_qcMxhXJIUMLd7nT-Qwf_d4dYSdoOFEOE8I,2179
|
|
21
21
|
isar/config/keyvault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
isar/config/keyvault/keyvault_error.py,sha256=zvPCsZLjboxsxthYkxpRERCTFxYV8R5WmACewAUQLwk,41
|
|
@@ -42,13 +42,18 @@ isar/mission_planner/sequential_task_selector.py,sha256=66agRPHuJnEa1vArPyty4muT
|
|
|
42
42
|
isar/mission_planner/task_selector_interface.py,sha256=pnLeaGPIuyXThcflZ_A7YL2b2xQjFT88hAZidkMomxU,707
|
|
43
43
|
isar/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
isar/models/communication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
isar/models/communication/message.py,sha256=
|
|
45
|
+
isar/models/communication/message.py,sha256=ge2EdUXRnYkiEu5TIAYJFQET_5w-N8MRgc2Y31vetno,155
|
|
46
46
|
isar/models/communication/queues/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
isar/models/communication/queues/queue_io.py,sha256=AnHWUCkZ0tunkxKKeBarq-OUkRM97IaMfA-a1pmf1cQ,394
|
|
48
48
|
isar/models/communication/queues/queue_timeout_error.py,sha256=rF8TlNF7RHS_ueTZ5mp7aFkhLY1j0dcwMwH-Ba6lVpE,45
|
|
49
|
-
isar/models/communication/queues/
|
|
49
|
+
isar/models/communication/queues/queue_utils.py,sha256=2y8rXAMUTH9T82UKMbU3EbI-QIAjBEEqrhWco2UyxJs,708
|
|
50
|
+
isar/models/communication/queues/queues.py,sha256=xWpNtlURLbzWTCyPxvAkdkBXy4OYi2Y6yZbyrpDOWsk,1784
|
|
50
51
|
isar/models/communication/queues/status_queue.py,sha256=-6MDxrZ9dUIJgOMAluSJDyaM50xE1ylhoJZOnPIw8hs,483
|
|
51
52
|
isar/models/mission_metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
+
isar/robot/robot.py,sha256=9cUGjPoFCBFsWk6BXKugJR3aTjTV8VpFaeNN4viK1wU,3428
|
|
54
|
+
isar/robot/robot_start_mission.py,sha256=lw5X1fQt5pG8VhtBjwjl1fUfC4FHIS0g7ygZyGaWGfE,2776
|
|
55
|
+
isar/robot/robot_status.py,sha256=0RjMLC1I-x5u0WYgvLtxqt-XI0AmNP0WfO7bY_q-aW0,1541
|
|
56
|
+
isar/robot/robot_task_status.py,sha256=6M4r2MO4Ja3kFlKLUA1F1DP-x14TLW8Z7Ide9VRTzNs,3196
|
|
52
57
|
isar/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
58
|
isar/services/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
59
|
isar/services/auth/azure_credentials.py,sha256=9PlwGe5FrPRbW2dp0go7LMp8_l_FRvL8xOXotXwzRDo,364
|
|
@@ -62,25 +67,30 @@ isar/services/service_connections/stid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
|
|
|
62
67
|
isar/services/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
68
|
isar/services/utilities/queue_utilities.py,sha256=Pw3hehSwkXJNeDv-bDVDfs58VOwtt3i5hpiJ2ZpphuQ,1225
|
|
64
69
|
isar/services/utilities/robot_utilities.py,sha256=4-ob4kcIiRN_GXFDBMwBadfbwpYqKEkyzyC40wzvmko,555
|
|
65
|
-
isar/services/utilities/scheduling_utilities.py,sha256=
|
|
70
|
+
isar/services/utilities/scheduling_utilities.py,sha256=e74IxP8xjbUbxDeed56bY09tqGSm4tFf-12RbilM67M,8095
|
|
66
71
|
isar/services/utilities/threaded_request.py,sha256=py4G-_RjnIdHljmKFAcQ6ddqMmp-ZYV39Ece-dqRqjs,1874
|
|
67
72
|
isar/state_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
-
isar/state_machine/state_machine.py,sha256=
|
|
69
|
-
isar/state_machine/states_enum.py,sha256=
|
|
73
|
+
isar/state_machine/state_machine.py,sha256=Wwo1ibXRrQDIx82hMTZr71zph6WR4HZaTmmYQ5ZFeQk,16847
|
|
74
|
+
isar/state_machine/states_enum.py,sha256=uqa3VD2Ig0PR5xG7s4-q5OLWiGdvEn-KYClv3KpRJ68,276
|
|
70
75
|
isar/state_machine/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
|
-
isar/state_machine/states/blocked_protective_stop.py,sha256=
|
|
72
|
-
isar/state_machine/states/idle.py,sha256=
|
|
73
|
-
isar/state_machine/states/
|
|
74
|
-
isar/state_machine/states/initiate.py,sha256=xtKopnU5Ug_0PAV3yFm0v8O7DCa5CwGE4vN_7qahA0A,4139
|
|
75
|
-
isar/state_machine/states/monitor.py,sha256=5BpEO-yzVE_yJc6POdvcECOXyQDXMiijVry4C0s6tIw,9759
|
|
76
|
+
isar/state_machine/states/blocked_protective_stop.py,sha256=jOX1dx9cXTd80H8nKuugrmhDsqhxxyxOrdfDelWhk_E,1856
|
|
77
|
+
isar/state_machine/states/idle.py,sha256=dFqVjdoiRi0yXl2PYhcz6KtKsf-ewBukndJgxiid1ZQ,2185
|
|
78
|
+
isar/state_machine/states/monitor.py,sha256=b3EQzpPm3mvOZ2KvQSgF_vWqr5aRzpJhX7SFLRfERms,7771
|
|
76
79
|
isar/state_machine/states/off.py,sha256=jjqN_oJMpBtWuY7hP-c9f0w3p2CYCfe-NpmYHHPnmyI,544
|
|
77
|
-
isar/state_machine/states/offline.py,sha256=
|
|
78
|
-
isar/state_machine/states/paused.py,sha256=
|
|
80
|
+
isar/state_machine/states/offline.py,sha256=yRrO_qs7_eMfW78t0Gq_1Pk0hmTES7hCdaglOeeW0p4,1188
|
|
81
|
+
isar/state_machine/states/paused.py,sha256=C2frJtFck6v6cGyun0EBr_cViNMhmVZMMxbBS5zA5gA,993
|
|
79
82
|
isar/state_machine/states/stop.py,sha256=LRhqhqHuElrsrwJJnxI9gLqSGuzuik8BT2V2GO4fvOs,3098
|
|
83
|
+
isar/state_machine/transitions/fail_mission.py,sha256=_6HqBMALDinFZ4yh5GMpeqqgV5tw5i8OVMj5UDdqesg,495
|
|
84
|
+
isar/state_machine/transitions/finish_mission.py,sha256=TRQrk7HdllmAkwsp25HRZAFAk46Y1hLx3jmkIAKrHDI,1442
|
|
85
|
+
isar/state_machine/transitions/pause.py,sha256=nhCaFfaeao7qjIl7oCYBu9lDEG0NJfUhpgvk-NxxsgM,879
|
|
86
|
+
isar/state_machine/transitions/resume.py,sha256=GlG2mOjtyt1jyFTlH-s8q9e0vpHZp2evXQsmzUk9A-4,988
|
|
87
|
+
isar/state_machine/transitions/start_mission.py,sha256=CfFhH1RJlbhzoeTL99WOrbMVBk9Tui1Y1mKZbGMhA1I,2505
|
|
88
|
+
isar/state_machine/transitions/stop.py,sha256=uRDmn1UGxCmTWgxslJc6epzoiYIlCLLYDGoaCcnnYkM,1090
|
|
89
|
+
isar/state_machine/transitions/utils.py,sha256=Wa72Ocq4QT1E6qkpEJZQ3h5o33pGvx7Tlkt2JZ2Grbk,314
|
|
80
90
|
isar/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
81
91
|
isar/storage/blob_storage.py,sha256=L885tgwHeeIp8raIz20Hhbc1IMsQP0wK6HOX9I4sZlw,3199
|
|
82
92
|
isar/storage/local_storage.py,sha256=Bnmoi5gyN8r-oRh0aHrOdGqaH3JqRScFKMRXYojW5kY,1855
|
|
83
|
-
isar/storage/slimm_storage.py,sha256=
|
|
93
|
+
isar/storage/slimm_storage.py,sha256=4UON1tcrP-p1w1atDqtdCmKwmfj9dwwuCIt18d8adZk,9031
|
|
84
94
|
isar/storage/storage_interface.py,sha256=DYDry4I7aZpDHJhsBF6s8zrgokFAc7fdKJKfA8AvL7o,828
|
|
85
95
|
isar/storage/uploader.py,sha256=LrbGlAGoqspWtSjmZcfvbRL3_khCnLWwa64XhqUrsr4,6543
|
|
86
96
|
isar/storage/utilities.py,sha256=fitsdQ1ox5gr9fk9VuSk_iTBiEAIS8NZAnHabUZORh0,3173
|
|
@@ -96,20 +106,20 @@ robot_interface/models/inspection/inspection.py,sha256=Q8vyiTMV2Ws1B4N10kQ3C1AZk
|
|
|
96
106
|
robot_interface/models/mission/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
107
|
robot_interface/models/mission/mission.py,sha256=GR_X9-dIf-15oogfv_c6JNIKnTIk5u80rWLNUk95xm0,738
|
|
98
108
|
robot_interface/models/mission/status.py,sha256=48y8HEiT7QQbMLBUBYxXR92iZOrnBOukPZ7o09CCR1Q,686
|
|
99
|
-
robot_interface/models/mission/task.py,sha256=
|
|
109
|
+
robot_interface/models/mission/task.py,sha256=0yDg940gOTTxbpFeh9K5iIbBSf10v16PPTy-iOBJvDQ,4896
|
|
100
110
|
robot_interface/models/robots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
101
111
|
robot_interface/models/robots/battery_state.py,sha256=ktOtJ8ltdK0k_i7BoqYfhc5dbOzIG6Oo-uWC67fCWio,98
|
|
102
112
|
robot_interface/models/robots/media.py,sha256=8A-CuuubfngzPprs6zWB9hSaqe3jzgsE8rcCzRX2Uto,227
|
|
103
113
|
robot_interface/models/robots/robot_model.py,sha256=-0jNKWPcEgtF_2klb1It3u0SCoAR0hSW9nce58Zq0Co,417
|
|
104
114
|
robot_interface/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
105
|
-
robot_interface/telemetry/mqtt_client.py,sha256=
|
|
106
|
-
robot_interface/telemetry/payloads.py,sha256=
|
|
115
|
+
robot_interface/telemetry/mqtt_client.py,sha256=ueXdtIFNCwciTj4spvdJj9emd-IOmUuJjpsXQSSWZPY,2987
|
|
116
|
+
robot_interface/telemetry/payloads.py,sha256=m55aFrIczI-PDwQXvsFA6M7YNCTy83w7Ff-HIaZNbwI,2329
|
|
107
117
|
robot_interface/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
108
|
-
robot_interface/utilities/json_service.py,sha256=
|
|
118
|
+
robot_interface/utilities/json_service.py,sha256=qkzVkb60Gi_pto-b5n1vNzCrQze2yqgIJqSLNLYj1Fg,1034
|
|
109
119
|
robot_interface/utilities/uuid_string_factory.py,sha256=_NQIbBQ56w0qqO0MUDP6aPpHbxW7ATRhK8HnQiBSLkc,76
|
|
110
|
-
isar-1.
|
|
111
|
-
isar-1.
|
|
112
|
-
isar-1.
|
|
113
|
-
isar-1.
|
|
114
|
-
isar-1.
|
|
115
|
-
isar-1.
|
|
120
|
+
isar-1.26.0.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
|
|
121
|
+
isar-1.26.0.dist-info/METADATA,sha256=1cEBoi0ANb-6GLPmaXcIh8tcoSkuHOcojfqYQkrDgF8,30579
|
|
122
|
+
isar-1.26.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
123
|
+
isar-1.26.0.dist-info/entry_points.txt,sha256=TFam7uNNw7J0iiDYzsH2gfG0u1eV1wh3JTw_HkhgKLk,49
|
|
124
|
+
isar-1.26.0.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
|
|
125
|
+
isar-1.26.0.dist-info/RECORD,,
|
|
@@ -7,11 +7,11 @@ from pydantic import BaseModel, Field
|
|
|
7
7
|
from robot_interface.models.exceptions.robot_exceptions import ErrorMessage
|
|
8
8
|
from robot_interface.models.inspection.inspection import (
|
|
9
9
|
Audio,
|
|
10
|
+
GasMeasurement,
|
|
10
11
|
Image,
|
|
11
12
|
Inspection,
|
|
12
13
|
ThermalImage,
|
|
13
14
|
ThermalVideo,
|
|
14
|
-
GasMeasurement,
|
|
15
15
|
Video,
|
|
16
16
|
)
|
|
17
17
|
from robot_interface.models.mission.status import TaskStatus
|
|
@@ -4,10 +4,10 @@ from typing import List, Optional, Union
|
|
|
4
4
|
|
|
5
5
|
from alitra import Pose
|
|
6
6
|
|
|
7
|
-
from robot_interface.models.robots.battery_state import BatteryState
|
|
8
|
-
from robot_interface.models.mission.status import RobotStatus, MissionStatus, TaskStatus
|
|
9
|
-
from robot_interface.models.mission.task import TaskTypes
|
|
10
7
|
from robot_interface.models.exceptions.robot_exceptions import ErrorReason
|
|
8
|
+
from robot_interface.models.mission.status import MissionStatus, RobotStatus, TaskStatus
|
|
9
|
+
from robot_interface.models.mission.task import TaskTypes
|
|
10
|
+
from robot_interface.models.robots.battery_state import BatteryState
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@dataclass
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import time
|
|
3
|
-
from typing import TYPE_CHECKING, Callable, Optional
|
|
4
|
-
|
|
5
|
-
from injector import inject
|
|
6
|
-
from transitions import State
|
|
7
|
-
|
|
8
|
-
from isar.services.utilities.threaded_request import (
|
|
9
|
-
ThreadedRequest,
|
|
10
|
-
ThreadedRequestNotFinishedError,
|
|
11
|
-
)
|
|
12
|
-
from robot_interface.models.exceptions.robot_exceptions import (
|
|
13
|
-
ErrorMessage,
|
|
14
|
-
RobotException,
|
|
15
|
-
RobotInitializeException,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if TYPE_CHECKING:
|
|
19
|
-
from isar.state_machine.state_machine import StateMachine
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class Initialize(State):
|
|
23
|
-
@inject
|
|
24
|
-
def __init__(self, state_machine: "StateMachine") -> None:
|
|
25
|
-
super().__init__(name="initialize", on_enter=self.start, on_exit=self.stop)
|
|
26
|
-
self.state_machine: "StateMachine" = state_machine
|
|
27
|
-
|
|
28
|
-
self.logger = logging.getLogger("state_machine")
|
|
29
|
-
self.initialize_thread: Optional[ThreadedRequest] = None
|
|
30
|
-
|
|
31
|
-
def start(self) -> None:
|
|
32
|
-
self.state_machine.update_state()
|
|
33
|
-
self._run()
|
|
34
|
-
|
|
35
|
-
def stop(self) -> None:
|
|
36
|
-
if self.initialize_thread:
|
|
37
|
-
self.initialize_thread.wait_for_thread()
|
|
38
|
-
self.initialize_thread = None
|
|
39
|
-
|
|
40
|
-
def _run(self) -> None:
|
|
41
|
-
transition: Callable
|
|
42
|
-
while True:
|
|
43
|
-
if not self.initialize_thread:
|
|
44
|
-
self.initialize_thread = ThreadedRequest(
|
|
45
|
-
self.state_machine.robot.initialize
|
|
46
|
-
)
|
|
47
|
-
self.initialize_thread.start_thread(
|
|
48
|
-
name="State Machine Initialize Robot"
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
try:
|
|
52
|
-
self.initialize_thread.get_output()
|
|
53
|
-
|
|
54
|
-
except ThreadedRequestNotFinishedError:
|
|
55
|
-
time.sleep(self.state_machine.sleep_time)
|
|
56
|
-
continue
|
|
57
|
-
|
|
58
|
-
except (RobotInitializeException, RobotException) as e:
|
|
59
|
-
self.state_machine.current_task.error_message = ErrorMessage(
|
|
60
|
-
error_reason=e.error_reason, error_description=e.error_description
|
|
61
|
-
)
|
|
62
|
-
self.logger.error(
|
|
63
|
-
f"Failed to initialize robot because: {e.error_description}"
|
|
64
|
-
)
|
|
65
|
-
transition = self.state_machine.initialization_failed # type: ignore
|
|
66
|
-
break
|
|
67
|
-
|
|
68
|
-
transition = self.state_machine.initialization_successful # type: ignore
|
|
69
|
-
break
|
|
70
|
-
transition()
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import time
|
|
3
|
-
from typing import TYPE_CHECKING, Any, Callable, Optional
|
|
4
|
-
|
|
5
|
-
from transitions import State
|
|
6
|
-
|
|
7
|
-
from isar.config.settings import settings
|
|
8
|
-
from isar.services.utilities.threaded_request import (
|
|
9
|
-
ThreadedRequest,
|
|
10
|
-
ThreadedRequestNotFinishedError,
|
|
11
|
-
)
|
|
12
|
-
from robot_interface.models.exceptions.robot_exceptions import (
|
|
13
|
-
ErrorMessage,
|
|
14
|
-
RobotException,
|
|
15
|
-
RobotInfeasibleMissionException,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if TYPE_CHECKING:
|
|
19
|
-
from isar.state_machine.state_machine import StateMachine
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class Initiate(State):
|
|
23
|
-
def __init__(self, state_machine: "StateMachine") -> None:
|
|
24
|
-
super().__init__(name="initiate", on_enter=self.start, on_exit=self.stop)
|
|
25
|
-
self.state_machine: "StateMachine" = state_machine
|
|
26
|
-
self.initiate_failure_counter: int = 0
|
|
27
|
-
self.initiate_failure_counter_limit: int = (
|
|
28
|
-
settings.INITIATE_FAILURE_COUNTER_LIMIT
|
|
29
|
-
)
|
|
30
|
-
self.logger = logging.getLogger("state_machine")
|
|
31
|
-
|
|
32
|
-
self.initiate_thread: Optional[ThreadedRequest] = None
|
|
33
|
-
|
|
34
|
-
def start(self) -> None:
|
|
35
|
-
self.state_machine.update_state()
|
|
36
|
-
self._run()
|
|
37
|
-
|
|
38
|
-
def stop(self) -> None:
|
|
39
|
-
self.initiate_failure_counter = 0
|
|
40
|
-
if self.initiate_thread:
|
|
41
|
-
self.initiate_thread.wait_for_thread()
|
|
42
|
-
self.initiate_thread = None
|
|
43
|
-
|
|
44
|
-
def _run(self) -> None:
|
|
45
|
-
transition: Callable
|
|
46
|
-
while True:
|
|
47
|
-
if self.state_machine.should_stop_mission():
|
|
48
|
-
transition = self.state_machine.stop # type: ignore
|
|
49
|
-
break
|
|
50
|
-
|
|
51
|
-
if not self.initiate_thread:
|
|
52
|
-
self._run_initiate_thread(
|
|
53
|
-
initiate_function=self.state_machine.robot.initiate_mission,
|
|
54
|
-
function_argument=self.state_machine.current_mission,
|
|
55
|
-
thread_name="State Machine Initiate Mission",
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
try:
|
|
59
|
-
self.initiate_thread.get_output()
|
|
60
|
-
transition = self.state_machine.initiated # type: ignore
|
|
61
|
-
break
|
|
62
|
-
except ThreadedRequestNotFinishedError:
|
|
63
|
-
time.sleep(self.state_machine.sleep_time)
|
|
64
|
-
continue
|
|
65
|
-
|
|
66
|
-
except RobotInfeasibleMissionException as e:
|
|
67
|
-
self.state_machine.current_mission.error_message = ErrorMessage(
|
|
68
|
-
error_reason=e.error_reason, error_description=e.error_description
|
|
69
|
-
)
|
|
70
|
-
self.logger.warning(
|
|
71
|
-
f"Failed to initiate mission "
|
|
72
|
-
f"{str(self.state_machine.current_mission.id)[:8]} because: "
|
|
73
|
-
f"{e.error_description}"
|
|
74
|
-
)
|
|
75
|
-
transition = self.state_machine.initiate_failed # type: ignore
|
|
76
|
-
break
|
|
77
|
-
|
|
78
|
-
except RobotException as e:
|
|
79
|
-
self.initiate_thread = None
|
|
80
|
-
self.initiate_failure_counter += 1
|
|
81
|
-
self.logger.warning(
|
|
82
|
-
f"Initiating failed #: {str(self.initiate_failure_counter)} "
|
|
83
|
-
f"because: {e.error_description}"
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
if self.initiate_failure_counter >= self.initiate_failure_counter_limit:
|
|
87
|
-
self.state_machine.current_task.error_message = ErrorMessage(
|
|
88
|
-
error_reason=e.error_reason,
|
|
89
|
-
error_description=e.error_description,
|
|
90
|
-
)
|
|
91
|
-
self.logger.error(
|
|
92
|
-
f"Mission will be cancelled after failing to initiate "
|
|
93
|
-
f"{self.initiate_failure_counter_limit} times because: "
|
|
94
|
-
f"{e.error_description}"
|
|
95
|
-
)
|
|
96
|
-
transition = self.state_machine.initiate_failed # type: ignore
|
|
97
|
-
break
|
|
98
|
-
|
|
99
|
-
time.sleep(self.state_machine.sleep_time)
|
|
100
|
-
|
|
101
|
-
transition()
|
|
102
|
-
|
|
103
|
-
def _run_initiate_thread(
|
|
104
|
-
self, initiate_function: Callable, function_argument: Any, thread_name: str
|
|
105
|
-
) -> None:
|
|
106
|
-
self.initiate_thread = ThreadedRequest(request_func=initiate_function)
|
|
107
|
-
|
|
108
|
-
self.initiate_thread.start_thread(
|
|
109
|
-
function_argument,
|
|
110
|
-
name=thread_name,
|
|
111
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|