isar 1.30.4__py3-none-any.whl → 1.30.5__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.

@@ -19,10 +19,10 @@ class StartMissionResponse(BaseModel):
19
19
 
20
20
 
21
21
  class ControlMissionResponse(BaseModel):
22
- mission_id: str
23
- mission_status: str
24
- task_id: str
25
- task_status: str
22
+ mission_id: Optional[str]
23
+ mission_status: Optional[str]
24
+ task_id: Optional[str]
25
+ task_status: Optional[str]
26
26
 
27
27
 
28
28
  class RobotInfoResponse(BaseModel):
@@ -22,6 +22,7 @@ from isar.models.communication.queues.queue_timeout_error import QueueTimeoutErr
22
22
  from isar.services.utilities.queue_utilities import QueueUtilities
23
23
  from isar.state_machine.states_enum import States
24
24
  from robot_interface.models.mission.mission import Mission
25
+ from robot_interface.models.mission.status import MissionStatus
25
26
 
26
27
 
27
28
  class SchedulingUtilities:
@@ -253,13 +254,21 @@ class SchedulingUtilities:
253
254
 
254
255
  Raises
255
256
  ------
256
- HTTTPException 408 Request timeout
257
+ HTTPException 503 Service Unavailable
258
+ The request was understood, but attempting to stop the mission failed
259
+ HTTPException 408 Request timeout
257
260
  If there is a timeout while communicating with the state machine
258
261
  """
259
262
  try:
260
263
  stop_mission_response: ControlMissionResponse = self._send_command(
261
264
  True, self.api_events.stop_mission
262
265
  )
266
+ if stop_mission_response.mission_status != MissionStatus.Cancelled.value:
267
+ error_message = "Failed to stop mission"
268
+ self.logger.error(error_message)
269
+ raise HTTPException(
270
+ status_code=HTTPStatus.SERVICE_UNAVAILABLE, detail=error_message
271
+ )
263
272
  except QueueTimeoutError:
264
273
  error_message = "Internal Server Error - Failed to stop mission"
265
274
  self.logger.error(error_message)
@@ -54,7 +54,7 @@ class OngoingMission:
54
54
  self._run()
55
55
 
56
56
  def stop(self) -> None:
57
- self.state_machine.mission_ongoing = False
57
+ return
58
58
 
59
59
  def _check_and_handle_stop_mission_event(self, event: Queue) -> bool:
60
60
  if check_for_event(event):
@@ -194,6 +194,7 @@ class StateMachine(object):
194
194
  self.current_task = None
195
195
  self.send_task_status()
196
196
  self.current_mission = None
197
+ self.mission_ongoing = False
197
198
 
198
199
  def start_mission(self, mission: Mission):
199
200
  """Starts a scheduled mission."""
@@ -316,17 +317,13 @@ class StateMachine(object):
316
317
  self.logger.info("Mission overview:\n%s", log_statement)
317
318
 
318
319
  def _make_control_mission_response(self) -> ControlMissionResponse:
319
- if self.current_mission is None:
320
- raise ValueError("No current mission is set")
321
-
322
- if self.current_task is None:
323
- raise ValueError("No current task is set")
324
-
325
320
  return ControlMissionResponse(
326
- mission_id=self.current_mission.id,
327
- mission_status=self.current_mission.status,
328
- task_id=self.current_task.id,
329
- task_status=self.current_task.status,
321
+ mission_id=self.current_mission.id if self.current_mission else None,
322
+ mission_status=(
323
+ self.current_mission.status if self.current_mission else None
324
+ ),
325
+ task_id=self.current_task.id if self.current_task else None,
326
+ task_status=self.current_task.status if self.current_task else None,
330
327
  )
331
328
 
332
329
  def _queue_empty_response(self) -> None:
@@ -39,9 +39,9 @@ class Stopping(State):
39
39
  if error_message is not None:
40
40
  self.logger.warning(error_message.error_description)
41
41
  if self.stopping_return_home_mission:
42
- self.state_machine.return_home_mission_stopped() # type: ignore
42
+ self.state_machine.return_home_mission_stopping_failed() # type: ignore
43
43
  else:
44
- self.state_machine.mission_stopped() # type: ignore
44
+ self.state_machine.mission_stopping_failed() # type: ignore
45
45
  return True
46
46
  return False
47
47
 
@@ -1,6 +1,9 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
- from isar.models.communication.queues.queue_utils import trigger_event_without_data
3
+ from isar.models.communication.queues.queue_utils import (
4
+ check_for_event_without_consumption,
5
+ trigger_event_without_data,
6
+ )
4
7
 
5
8
  if TYPE_CHECKING:
6
9
  from isar.state_machine.state_machine import StateMachine
@@ -39,11 +42,51 @@ def stop_mission_cleanup(state_machine: "StateMachine") -> bool:
39
42
  return True
40
43
 
41
44
 
45
+ def stop_mission_failed(state_machine: "StateMachine") -> bool:
46
+ stopped_mission_response: ControlMissionResponse = (
47
+ state_machine._make_control_mission_response()
48
+ )
49
+ state_machine.events.api_requests.stop_mission.output.put(stopped_mission_response)
50
+ return True
51
+
52
+
42
53
  def stop_return_home_mission_cleanup(state_machine: "StateMachine") -> bool:
43
54
  if state_machine.current_mission is None:
44
55
  state_machine._queue_empty_response()
45
56
  state_machine.reset_state_machine()
46
57
  return True
47
58
 
59
+ if not check_for_event_without_consumption(
60
+ state_machine.events.api_requests.start_mission.input
61
+ ):
62
+ state_machine.current_mission.status = MissionStatus.Cancelled
63
+
64
+ for task in state_machine.current_mission.tasks:
65
+ if task.status in [
66
+ TaskStatus.NotStarted,
67
+ TaskStatus.InProgress,
68
+ TaskStatus.Paused,
69
+ ]:
70
+ task.status = TaskStatus.Cancelled
71
+
72
+ stopped_mission_response: ControlMissionResponse = (
73
+ state_machine._make_control_mission_response()
74
+ )
75
+ state_machine.events.api_requests.stop_mission.output.put(
76
+ stopped_mission_response
77
+ )
78
+
48
79
  state_machine._finalize()
49
80
  return True
81
+
82
+
83
+ def stop_return_home_mission_failed(state_machine: "StateMachine") -> bool:
84
+ if check_for_event_without_consumption(
85
+ state_machine.events.api_requests.start_mission.input
86
+ ):
87
+ return True
88
+ stopped_mission_response: ControlMissionResponse = (
89
+ state_machine._make_control_mission_response()
90
+ )
91
+ state_machine.events.api_requests.stop_mission.output.put(stopped_mission_response)
92
+ return True
@@ -15,7 +15,9 @@ from isar.state_machine.transitions.functions.start_mission import (
15
15
  )
16
16
  from isar.state_machine.transitions.functions.stop import (
17
17
  stop_mission_cleanup,
18
+ stop_mission_failed,
18
19
  stop_return_home_mission_cleanup,
20
+ stop_return_home_mission_failed,
19
21
  trigger_stop_mission_event,
20
22
  )
21
23
  from isar.state_machine.transitions.functions.utils import def_transition
@@ -56,6 +58,18 @@ def get_mission_transitions(state_machine: "StateMachine") -> List[dict]:
56
58
  "dest": state_machine.await_next_mission_state,
57
59
  "before": def_transition(state_machine, stop_mission_cleanup),
58
60
  },
61
+ {
62
+ "trigger": "mission_stopping_failed",
63
+ "source": state_machine.stopping_state,
64
+ "dest": state_machine.monitor_state,
65
+ "before": def_transition(state_machine, stop_mission_failed),
66
+ },
67
+ {
68
+ "trigger": "return_home_mission_stopping_failed",
69
+ "source": state_machine.stopping_state,
70
+ "dest": state_machine.returning_home_state,
71
+ "before": def_transition(state_machine, stop_return_home_mission_failed),
72
+ },
59
73
  {
60
74
  "trigger": "return_home_mission_stopped",
61
75
  "source": state_machine.stopping_state,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: isar
3
- Version: 1.30.4
3
+ Version: 1.30.5
4
4
  Summary: Integration and Supervisory control of Autonomous Robots
5
5
  Author-email: Equinor ASA <fg_robots_dev@equinor.com>
6
6
  License: Eclipse Public License version 2.0
@@ -4,7 +4,7 @@ isar/script.py,sha256=0oUUfytKDOsWrPv4iWemTWl5L3Ug66mQsbvqGqQrVWk,6050
4
4
  isar/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  isar/apis/api.py,sha256=2hggLxcdsHqTYDAfVUMwMIBgpuB-0ba2HWMscHkRGzA,15072
6
6
  isar/apis/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- isar/apis/models/models.py,sha256=HzLaWhjAv0uJRBWipIgYg_F75eaQ5jl9Pi4UnYbDJ-M,1749
7
+ isar/apis/models/models.py,sha256=NWXTe5SheVj3QXklWZ1FMliZVHdS4Rjfuin5O4N9MTM,1789
8
8
  isar/apis/models/start_mission_definition.py,sha256=S87i_vrgXTY1nTMTiXMJAnx_q5uVxuiRNcrQrAYWKeo,6152
9
9
  isar/apis/robot_control/robot_controller.py,sha256=7EVukShJDhYez12wYeGWZXH-BrfQ4Wu2so0-fSWN2Zo,1277
10
10
  isar/apis/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -67,13 +67,13 @@ isar/services/service_connections/stid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
67
67
  isar/services/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  isar/services/utilities/queue_utilities.py,sha256=Pw3hehSwkXJNeDv-bDVDfs58VOwtt3i5hpiJ2ZpphuQ,1225
69
69
  isar/services/utilities/robot_utilities.py,sha256=J3miRs0t74HNBoMIzVMceMCibp5DozP9Ai1_i7B3kWI,573
70
- isar/services/utilities/scheduling_utilities.py,sha256=SVmpAuU7101FVUx6x4tcMDrxYaWBPhgOkntFxX_d6Zc,10179
70
+ isar/services/utilities/scheduling_utilities.py,sha256=4HoUl0WQc7RE9Vx4wZmpX9czgcF7xJg_Pn2hwtSju10,10702
71
71
  isar/services/utilities/threaded_request.py,sha256=py4G-_RjnIdHljmKFAcQ6ddqMmp-ZYV39Ece-dqRqjs,1874
72
72
  isar/state_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- isar/state_machine/state_machine.py,sha256=onPjxGqDGSSvjHxCosKxIyiTw0X01FLwJX9rJArqfXg,13152
73
+ isar/state_machine/state_machine.py,sha256=yRNjzheKZ9PqNQ1G-ZHb8VmYEXTR9XqaJQn_3191Rcw,13157
74
74
  isar/state_machine/states_enum.py,sha256=Z3dO6k6JmQAZ1lzcR58oVCxoCky_-ZS9MaL3RSaNbZ4,434
75
75
  isar/state_machine/generic_states/idle.py,sha256=T_LSadQ8Eu9egYPgL43WKDYv27MwFu-dqIxDazVE_KU,4359
76
- isar/state_machine/generic_states/ongoing_mission.py,sha256=NTYQIddTG0Nsq_ZjcWWBSe9KsQp_7zQcKH_0HYW18SQ,10850
76
+ isar/state_machine/generic_states/ongoing_mission.py,sha256=P3jikXYcpYgvkuwjGGi9krjnUVEVqUwvM_RHeQbN9wc,10814
77
77
  isar/state_machine/generic_states/robot_unavailable.py,sha256=pHmed1uRPwCWAR4uBJmdnxi9WX8veTbGG9ephmROhm0,1851
78
78
  isar/state_machine/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
79
  isar/state_machine/states/await_next_mission.py,sha256=U0oGi-O05S-ZvdhpQRuirrY3ZBbblURo5U95PsscMlQ,573
@@ -84,9 +84,9 @@ isar/state_machine/states/offline.py,sha256=vZnBMVDnehZ-0gPsHNVRpZtb8OBBFkeEnq2o
84
84
  isar/state_machine/states/paused.py,sha256=IgnWBM6WXj3wjFZMARAPWIpzWGyUSW35DVBvNHuiNP8,1460
85
85
  isar/state_machine/states/returning_home.py,sha256=BBQo3PoNP-THlvJa5gQr0fNBhInh_Ox1L2OeH8evUq8,638
86
86
  isar/state_machine/states/robot_standing_still.py,sha256=RbOZSiQz72tWAJID5ksgzcb4lND6OniiG35IE1wMUHk,579
87
- isar/state_machine/states/stopping.py,sha256=Y44kEw-xB9_63eP6utAMY0RegrIz_1nL5cSI3cfaXEg,2838
87
+ isar/state_machine/states/stopping.py,sha256=yJE7KT1aGo_qd1VTETfg1rTrlM-hKKQYKQp7xu4py_Y,2854
88
88
  isar/state_machine/states/unknown_status.py,sha256=tOwfHW_4bKKkUTpKD7qc5gIwGT_fTXaCNxXcogGw-wo,2416
89
- isar/state_machine/transitions/mission.py,sha256=Sb_D9i1orV_I_eCDI0c8ZvhCU89peUqTfHI5-G36d08,4905
89
+ isar/state_machine/transitions/mission.py,sha256=_aaHLUXeomHa_m-9pStBQrWmKupsJqb-jC4BDQDBI6o,5490
90
90
  isar/state_machine/transitions/return_home.py,sha256=LeOMnckUUQYzBYRidD2ge6M0KdxGDTgo-ioXR7_9r8A,2714
91
91
  isar/state_machine/transitions/robot_status.py,sha256=c1ceyWRGCtx-KTDtxHXRD7oPbt8TQ2ej24A0wyim8vc,2720
92
92
  isar/state_machine/transitions/functions/fail_mission.py,sha256=_6HqBMALDinFZ4yh5GMpeqqgV5tw5i8OVMj5UDdqesg,495
@@ -96,7 +96,7 @@ isar/state_machine/transitions/functions/resume.py,sha256=9KQjH_6YBGyxFhb7G5dgDe
96
96
  isar/state_machine/transitions/functions/return_home.py,sha256=UlniwYvpz74hxqgN0TyVv3LCmiMsqsosKEtEGLqkNj0,1139
97
97
  isar/state_machine/transitions/functions/robot_status.py,sha256=xhKZ5u_X8uDvnhvGnAIABuKaPXeVqFjkgj4H2Om-j_A,1013
98
98
  isar/state_machine/transitions/functions/start_mission.py,sha256=ricRfhLH1_lNpqWxneMZcm7ps2YfY6sQGHkiT0Glf6M,2564
99
- isar/state_machine/transitions/functions/stop.py,sha256=aIj3EPnpgNLdsJwOK1ehhI1TpenQa9JjBxZH0Nm6dLg,1649
99
+ isar/state_machine/transitions/functions/stop.py,sha256=JK4hjGc3QtgSzvCWeOr1YG61SH1QOhmVNjw_jOnahQg,3123
100
100
  isar/state_machine/transitions/functions/utils.py,sha256=Wa72Ocq4QT1E6qkpEJZQ3h5o33pGvx7Tlkt2JZ2Grbk,314
101
101
  isar/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  isar/storage/blob_storage.py,sha256=Qci6bO508nlTHKPuPtVU5QcvGA4T7mv8cFrKWRcfw4g,3226
@@ -104,7 +104,7 @@ isar/storage/local_storage.py,sha256=Bnmoi5gyN8r-oRh0aHrOdGqaH3JqRScFKMRXYojW5kY
104
104
  isar/storage/storage_interface.py,sha256=DYDry4I7aZpDHJhsBF6s8zrgokFAc7fdKJKfA8AvL7o,828
105
105
  isar/storage/uploader.py,sha256=HAC3ssuPQCQ1xH4aTQfHIaq-ZoEzKwONWmsAOpNXOzw,9523
106
106
  isar/storage/utilities.py,sha256=oLH0Rp7UtrQQdilfITnmXO1Z0ExdeDhBImYHid55vBA,3449
107
- isar-1.30.4.dist-info/licenses/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
107
+ isar-1.30.5.dist-info/licenses/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
108
108
  robot_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
109
  robot_interface/robot_interface.py,sha256=Miout0IRX7QniUNu_upyNzkB8KDUWin7GGCqIeMh83E,8195
110
110
  robot_interface/test_robot_interface.py,sha256=FV1urn7SbsMyWBIcTKjsBwAG4IsXeZ6pLHE0mA9EGGs,692
@@ -128,8 +128,8 @@ robot_interface/telemetry/payloads.py,sha256=PpvmV7XeGgfhc_aRUYFOdwBTwV2x8TwTBIN
128
128
  robot_interface/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  robot_interface/utilities/json_service.py,sha256=qkzVkb60Gi_pto-b5n1vNzCrQze2yqgIJqSLNLYj1Fg,1034
130
130
  robot_interface/utilities/uuid_string_factory.py,sha256=_NQIbBQ56w0qqO0MUDP6aPpHbxW7ATRhK8HnQiBSLkc,76
131
- isar-1.30.4.dist-info/METADATA,sha256=SaISJES198lknEfIqlqwrZ1CZe4A0vzi_mKYuu1fZrU,31063
132
- isar-1.30.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
133
- isar-1.30.4.dist-info/entry_points.txt,sha256=TFam7uNNw7J0iiDYzsH2gfG0u1eV1wh3JTw_HkhgKLk,49
134
- isar-1.30.4.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
135
- isar-1.30.4.dist-info/RECORD,,
131
+ isar-1.30.5.dist-info/METADATA,sha256=y-vfw6eUN7tOlQjfzG_dD2App6B4A5u2zeSRCC8yGM0,31063
132
+ isar-1.30.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
133
+ isar-1.30.5.dist-info/entry_points.txt,sha256=TFam7uNNw7J0iiDYzsH2gfG0u1eV1wh3JTw_HkhgKLk,49
134
+ isar-1.30.5.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
135
+ isar-1.30.5.dist-info/RECORD,,
File without changes