isar 1.25.9__py3-none-any.whl → 1.26.1__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 -112
- isar/apis/robot_control/robot_controller.py +5 -4
- isar/apis/schedule/scheduling_controller.py +6 -57
- isar/apis/security/authentication.py +2 -2
- isar/config/settings.env +1 -3
- isar/config/settings.py +6 -6
- isar/models/communication/message.py +0 -4
- isar/models/communication/queues/events.py +57 -0
- isar/models/communication/queues/queue_utils.py +32 -0
- isar/models/communication/queues/status_queue.py +7 -5
- isar/modules.py +26 -13
- isar/robot/robot.py +124 -0
- isar/robot/robot_start_mission.py +73 -0
- isar/robot/robot_status.py +49 -0
- isar/robot/robot_stop_mission.py +72 -0
- isar/robot/robot_task_status.py +92 -0
- isar/script.py +14 -7
- isar/services/utilities/scheduling_utilities.py +21 -30
- isar/state_machine/state_machine.py +70 -212
- isar/state_machine/states/blocked_protective_stop.py +10 -30
- isar/state_machine/states/idle.py +45 -67
- isar/state_machine/states/monitor.py +129 -139
- isar/state_machine/states/offline.py +12 -33
- isar/state_machine/states/paused.py +6 -3
- isar/state_machine/states/stop.py +29 -58
- 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 +40 -0
- isar/state_machine/transitions/utils.py +10 -0
- isar/storage/slimm_storage.py +2 -2
- isar/storage/uploader.py +5 -5
- {isar-1.25.9.dist-info → isar-1.26.1.dist-info}/METADATA +5 -19
- {isar-1.25.9.dist-info → isar-1.26.1.dist-info}/RECORD +45 -34
- {isar-1.25.9.dist-info → isar-1.26.1.dist-info}/WHEEL +1 -1
- 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/models/communication/queues/queues.py +0 -19
- 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.1.dist-info}/entry_points.txt +0 -0
- {isar-1.25.9.dist-info → isar-1.26.1.dist-info/licenses}/LICENSE +0 -0
- {isar-1.25.9.dist-info → isar-1.26.1.dist-info}/top_level.txt +0 -0
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
from queue import Queue
|
|
2
|
-
|
|
3
|
-
from isar.config.settings import settings
|
|
4
|
-
from isar.models.communication.queues.queue_io import QueueIO
|
|
5
|
-
from isar.models.communication.queues.status_queue import StatusQueue
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Queues:
|
|
9
|
-
def __init__(self) -> None:
|
|
10
|
-
self.start_mission: QueueIO = QueueIO(input_size=1, output_size=1)
|
|
11
|
-
self.stop_mission: QueueIO = QueueIO(input_size=1, output_size=1)
|
|
12
|
-
self.pause_mission: QueueIO = QueueIO(input_size=1, output_size=1)
|
|
13
|
-
self.resume_mission: QueueIO = QueueIO(input_size=1, output_size=1)
|
|
14
|
-
self.single_action: QueueIO = QueueIO(input_size=1, output_size=1)
|
|
15
|
-
self.upload_queue: Queue = Queue(maxsize=10)
|
|
16
|
-
self.state: StatusQueue = StatusQueue()
|
|
17
|
-
|
|
18
|
-
if settings.MQTT_ENABLED:
|
|
19
|
-
self.mqtt_queue: Queue = Queue()
|
|
@@ -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
|