rainbow-rb-sdk 0.0.9.dev5__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.
- rainbow/rb_sdk/__init__.py +42 -0
- rainbow/rb_sdk/amr.py +57 -0
- rainbow/rb_sdk/amr_sdk/__init__.py +0 -0
- rainbow/rb_sdk/amr_sdk/amr_accessory.py +200 -0
- rainbow/rb_sdk/amr_sdk/amr_capability.py +391 -0
- rainbow/rb_sdk/amr_sdk/amr_control.py +995 -0
- rainbow/rb_sdk/amr_sdk/amr_file.py +162 -0
- rainbow/rb_sdk/amr_sdk/amr_localization.py +407 -0
- rainbow/rb_sdk/amr_sdk/amr_map.py +664 -0
- rainbow/rb_sdk/amr_sdk/amr_move.py +732 -0
- rainbow/rb_sdk/amr_sdk/amr_program.py +125 -0
- rainbow/rb_sdk/amr_sdk/amr_setting.py +600 -0
- rainbow/rb_sdk/amr_sdk/amr_status.py +123 -0
- rainbow/rb_sdk/amr_sdk/schema/__init__.py +0 -0
- rainbow/rb_sdk/base.py +517 -0
- rainbow/rb_sdk/base_sdk/__init__.py +0 -0
- rainbow/rb_sdk/base_sdk/base_schema.py +7 -0
- rainbow/rb_sdk/manipulate.py +51 -0
- rainbow/rb_sdk/manipulate_sdk/__init__.py +0 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_config.py +1362 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_get_data.py +149 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_io.py +1057 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_move.py +1649 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_point.py +138 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_program.py +772 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_service.py +761 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_smbc.py +144 -0
- rainbow/rb_sdk/manipulate_sdk/manipulate_state.py +181 -0
- rainbow/rb_sdk/manipulate_sdk/schema/__init__.py +0 -0
- rainbow/rb_sdk/manipulate_sdk/schema/manipulate_config_schema.py +132 -0
- rainbow/rb_sdk/manipulate_sdk/schema/manipulate_io_schema.py +41 -0
- rainbow/rb_sdk/manipulate_sdk/schema/manipulate_move_schema.py +19 -0
- rainbow/rb_sdk/manipulate_sdk/schema/manipulate_program_schema.py +35 -0
- rainbow/rb_sdk/program_sdk/__init__.py +0 -0
- rainbow/rb_sdk/program_sdk/program.py +757 -0
- rainbow/rb_sdk/rby1.py +18 -0
- rainbow/rb_sdk/rby1_sdk/__init__.py +21 -0
- rainbow/rb_sdk/rby1_sdk/base.py +8 -0
- rainbow/rb_sdk/rby1_sdk/client.py +111 -0
- rainbow/rb_sdk/rby1_sdk/config.py +9 -0
- rainbow/rb_sdk/rby1_sdk/control.py +64 -0
- rainbow/rb_sdk/rby1_sdk/exceptions.py +10 -0
- rainbow/rb_sdk/rby1_sdk/state.py +40 -0
- rainbow/rb_sdk/schema/__init__.py +0 -0
- rainbow/rb_sdk/schema/amr_schema.py +0 -0
- rainbow/rb_sdk/schema/base_schema.py +0 -0
- rainbow/rb_sdk/schema/manipulate_schema.py +52 -0
- rainbow/rb_sdk/schema/program_schema.py +51 -0
- rainbow_rb_sdk-0.0.9.dev5.dist-info/METADATA +137 -0
- rainbow_rb_sdk-0.0.9.dev5.dist-info/RECORD +52 -0
- rainbow_rb_sdk-0.0.9.dev5.dist-info/WHEEL +5 -0
- rainbow_rb_sdk-0.0.9.dev5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Rainbow Robotics SDK package.
|
|
2
|
+
|
|
3
|
+
이 패키지는 문서 빌드 중에 종속성을 방지하기 위해 lazy import를 사용하여 선택된 SDK 진입점을 제공합니다.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
__all__ = ["RBAmrSDK", "RBManipulateSDK", "RBBaseSDK", "RBRby1SDK"]
|
|
11
|
+
|
|
12
|
+
# 타입체커/IDE(자동완성)용: 여기서는 import 해도 런타임에 실행되지 않음
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from .amr import RBAmrSDK
|
|
15
|
+
from .base import RBBaseSDK
|
|
16
|
+
from .manipulate import RBManipulateSDK
|
|
17
|
+
from .rby1 import RBRby1SDK
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def __getattr__(name: str):
|
|
21
|
+
if name == "RBManipulateSDK":
|
|
22
|
+
from .manipulate import RBManipulateSDK # noqa: PLC0415
|
|
23
|
+
return RBManipulateSDK
|
|
24
|
+
|
|
25
|
+
if name == "RBBaseSDK":
|
|
26
|
+
from .base import RBBaseSDK # noqa: PLC0415
|
|
27
|
+
return RBBaseSDK
|
|
28
|
+
|
|
29
|
+
if name == "RBAmrSDK":
|
|
30
|
+
from .amr import RBAmrSDK # noqa: PLC0415
|
|
31
|
+
return RBAmrSDK
|
|
32
|
+
|
|
33
|
+
if name == "RBRby1SDK":
|
|
34
|
+
from .rby1 import RBRby1SDK # noqa: PLC0415
|
|
35
|
+
return RBRby1SDK
|
|
36
|
+
|
|
37
|
+
raise AttributeError(name)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __dir__() -> list[str]:
|
|
41
|
+
# dir(rb_sdk) 결과가 __all__과 일치하게 (IDE/REPL 친화)
|
|
42
|
+
return sorted(__all__)
|
rainbow/rb_sdk/amr.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from rainbow.rb_sdk.amr_sdk.amr_capability import RBAmrCapabilitySDK
|
|
4
|
+
from rainbow.rb_sdk.amr_sdk.amr_program import RBAmrProgramSDK
|
|
5
|
+
|
|
6
|
+
from .amr_sdk.amr_control import RBAmrControlSDK
|
|
7
|
+
from .amr_sdk.amr_file import RBAmrFileSDK
|
|
8
|
+
from .amr_sdk.amr_localization import RBAmrLocalizationSDK
|
|
9
|
+
from .amr_sdk.amr_map import RBAmrMapSDK
|
|
10
|
+
from .amr_sdk.amr_move import RBAmrMoveSDK
|
|
11
|
+
from .amr_sdk.amr_setting import RBAmrSettingSDK
|
|
12
|
+
from .amr_sdk.amr_status import RBAmrStatusSDK
|
|
13
|
+
from .base import RBBaseSDK
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RBAmrSDK(RBBaseSDK):
|
|
17
|
+
"""Rainbow Robotics AMR SDK"""
|
|
18
|
+
|
|
19
|
+
move: RBAmrMoveSDK
|
|
20
|
+
"""AMR 이동 관련 SDK 집합"""
|
|
21
|
+
|
|
22
|
+
control: RBAmrControlSDK
|
|
23
|
+
"""AMR 제어 관련 SDK 집합"""
|
|
24
|
+
|
|
25
|
+
localization: RBAmrLocalizationSDK
|
|
26
|
+
"""AMR 위치 추정 관련 SDK 집합"""
|
|
27
|
+
|
|
28
|
+
map: RBAmrMapSDK
|
|
29
|
+
"""AMR 맵 관련 SDK 집합"""
|
|
30
|
+
|
|
31
|
+
setting: RBAmrSettingSDK
|
|
32
|
+
"""AMR 설정 관련 SDK 집합"""
|
|
33
|
+
|
|
34
|
+
file: RBAmrFileSDK
|
|
35
|
+
"""AMR 파일 관련 SDK 집합"""
|
|
36
|
+
|
|
37
|
+
status: RBAmrStatusSDK
|
|
38
|
+
"""AMR 상태 관련 SDK 집합"""
|
|
39
|
+
|
|
40
|
+
capability: RBAmrCapabilitySDK
|
|
41
|
+
"""AMR 기능 관련 SDK 집합"""
|
|
42
|
+
|
|
43
|
+
program: RBAmrProgramSDK
|
|
44
|
+
"""AMR 프로그램 관련 SDK 집합"""
|
|
45
|
+
|
|
46
|
+
def __init__(self):
|
|
47
|
+
super().__init__(server="amr")
|
|
48
|
+
|
|
49
|
+
self.move = RBAmrMoveSDK()
|
|
50
|
+
self.control = RBAmrControlSDK()
|
|
51
|
+
self.localization = RBAmrLocalizationSDK()
|
|
52
|
+
self.map = RBAmrMapSDK()
|
|
53
|
+
self.setting = RBAmrSettingSDK()
|
|
54
|
+
self.file = RBAmrFileSDK()
|
|
55
|
+
self.status = RBAmrStatusSDK()
|
|
56
|
+
self.capability = RBAmrCapabilitySDK()
|
|
57
|
+
self.program = RBAmrProgramSDK()
|
|
File without changes
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import uuid
|
|
3
|
+
from contextlib import suppress
|
|
4
|
+
from time import time
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestLiftPower import RequestLiftPowerT
|
|
8
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseLiftPower import ResponseLiftPowerT
|
|
9
|
+
from rainbow.rb_schemas.sdk import FlowManagerArgs
|
|
10
|
+
from rainbow.rb_utils.parser import t_to_dict
|
|
11
|
+
|
|
12
|
+
from rainbow.rb_sdk.base import RBBaseSDK
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class RBAmrAccessorySDK(RBBaseSDK):
|
|
16
|
+
""" Rainbow Robotics AMR Accessory SDK """
|
|
17
|
+
|
|
18
|
+
async def _accessory_flow_manager_solver(self, robot_model: str, req_id: str, flow_manager_args: FlowManagerArgs | None = None):
|
|
19
|
+
"""
|
|
20
|
+
Accessory flow manager solver for AMR.
|
|
21
|
+
"""
|
|
22
|
+
if flow_manager_args is None:
|
|
23
|
+
return None
|
|
24
|
+
|
|
25
|
+
done_event = asyncio.Event()
|
|
26
|
+
state: dict[str, Any] = {
|
|
27
|
+
"finished": False,
|
|
28
|
+
"error": "",
|
|
29
|
+
"last_seen": time.monotonic(),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def all_stop(*, flow_manager_args: FlowManagerArgs | None = None):
|
|
33
|
+
"""모든 프로세스 정지"""
|
|
34
|
+
with suppress(Exception):
|
|
35
|
+
self.zenoh_client.query_one("muscat/stop", payload={})
|
|
36
|
+
if flow_manager_args is not None:
|
|
37
|
+
flow_manager_args.done()
|
|
38
|
+
|
|
39
|
+
async def _on_status(*, obj_payload=None, unsubscribe=None, **_):
|
|
40
|
+
if state["finished"] or obj_payload is None:
|
|
41
|
+
return
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
flow_manager_args.ctx.check_stop()
|
|
45
|
+
state["last_seen"] = time.monotonic()
|
|
46
|
+
|
|
47
|
+
obj = t_to_dict(obj_payload)
|
|
48
|
+
print(f"FLOW MANAGER ACCESSORY STATUS >>>>>>>>>>> {obj.get('mapState').get('mapId')} {req_id} {obj.get('mapState').get('mapResult')} ", flush=True)
|
|
49
|
+
|
|
50
|
+
# if obj.get("mapState").get("mapId") != req_id:
|
|
51
|
+
# raise RuntimeError("Map ID Mismatch")
|
|
52
|
+
|
|
53
|
+
# if obj.get("mapState").get("mapResult") == "success":
|
|
54
|
+
# print("Map Flow Manager SOLVER DONE", flush=True)
|
|
55
|
+
# flow_manager_args.done()
|
|
56
|
+
# state["finished"] = True
|
|
57
|
+
# if unsubscribe is not None:
|
|
58
|
+
# unsubscribe()
|
|
59
|
+
# done_event.set()
|
|
60
|
+
# elif obj.get("mapState").get("mapResult") == "fail":
|
|
61
|
+
# raise RuntimeError("Map Load Fail")
|
|
62
|
+
# elif obj.get("mapState").get("mapResult") == "cancel":
|
|
63
|
+
# raise RuntimeError("Map Load Cancel")
|
|
64
|
+
except Exception as e:
|
|
65
|
+
state["finished"] = True
|
|
66
|
+
state["error"] = str(e)
|
|
67
|
+
if unsubscribe is not None:
|
|
68
|
+
unsubscribe()
|
|
69
|
+
done_event.set()
|
|
70
|
+
|
|
71
|
+
async def _watchdog():
|
|
72
|
+
timeout_sec = 2.0
|
|
73
|
+
interval_sec = 0.5
|
|
74
|
+
while not state["finished"]:
|
|
75
|
+
await asyncio.sleep(interval_sec)
|
|
76
|
+
if state["finished"]:
|
|
77
|
+
return
|
|
78
|
+
if time.monotonic() - state["last_seen"] > timeout_sec:
|
|
79
|
+
state["finished"] = True
|
|
80
|
+
state["error"] = "Map Load Fail (Timeout)"
|
|
81
|
+
done_event.set()
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
# sub_handle = self.zenoh_client.subscribe(
|
|
85
|
+
# f"amr/{robot_model}/status",
|
|
86
|
+
# _on_status,
|
|
87
|
+
# flatbuffer_obj_t=StatusT,
|
|
88
|
+
# options=SubscribeOptions(
|
|
89
|
+
# dispatch="queue",
|
|
90
|
+
# overflow=OverflowPolicy.LATEST_ONLY,
|
|
91
|
+
# parse_dict_payload=False,
|
|
92
|
+
# ),
|
|
93
|
+
# )
|
|
94
|
+
watchdog_task = asyncio.create_task(_watchdog())
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
await done_event.wait()
|
|
99
|
+
if state["error"] != "":
|
|
100
|
+
raise RuntimeError(state["error"])
|
|
101
|
+
except asyncio.CancelledError:
|
|
102
|
+
pass
|
|
103
|
+
except Exception as e:
|
|
104
|
+
all_stop(flow_manager_args=flow_manager_args)
|
|
105
|
+
raise RuntimeError(str(e)) from e
|
|
106
|
+
finally:
|
|
107
|
+
watchdog_task.cancel()
|
|
108
|
+
try:
|
|
109
|
+
await watchdog_task
|
|
110
|
+
except asyncio.CancelledError:
|
|
111
|
+
print("WATCHDOG CANCELLED", flush=True)
|
|
112
|
+
# sub_handle.close()
|
|
113
|
+
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
def set_lift_power(self, robot_model: str, switch: bool, req_id: str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseLiftPowerT:
|
|
117
|
+
"""
|
|
118
|
+
[Lift 전원 제어]
|
|
119
|
+
- robot_model: 로봇 모델
|
|
120
|
+
- switch: 리프트 전원 스위치 (True: ON, False: OFF)
|
|
121
|
+
- req_id: 요청 ID (선택 사항)
|
|
122
|
+
- flow_manager_args: 플로우 매니저 인자 (선택 사항)
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
if req_id is None:
|
|
126
|
+
req_id = str(uuid.uuid4())
|
|
127
|
+
|
|
128
|
+
# 1) RequestLiftPower 객체 생성
|
|
129
|
+
req = RequestLiftPowerT()
|
|
130
|
+
req.id = req_id
|
|
131
|
+
req.switch = switch
|
|
132
|
+
|
|
133
|
+
# 2) 요청 전송
|
|
134
|
+
result = self.zenoh_client.query_one(
|
|
135
|
+
f"amr/{robot_model}/accessory/lift",
|
|
136
|
+
flatbuffer_req_obj=req,
|
|
137
|
+
flatbuffer_res_T_class=ResponseLiftPowerT,
|
|
138
|
+
flatbuffer_buf_size=2048,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
# 3) 결과 처리 및 반환
|
|
142
|
+
if result.get("obj_payload") is None:
|
|
143
|
+
raise RuntimeError("Call Lift Power failed: obj_payload is None")
|
|
144
|
+
|
|
145
|
+
if flow_manager_args is not None:
|
|
146
|
+
print(result["dict_payload"].get("result"))
|
|
147
|
+
if result["dict_payload"].get("result") == "reject":
|
|
148
|
+
raise RuntimeError(result["dict_payload"].get("message"))
|
|
149
|
+
|
|
150
|
+
self._run_coro_blocking(
|
|
151
|
+
self._accessory_flow_manager_solver(
|
|
152
|
+
robot_model=robot_model,
|
|
153
|
+
req_id=req_id,
|
|
154
|
+
flow_manager_args=flow_manager_args,
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
return result["obj_payload"]
|
|
158
|
+
|
|
159
|
+
# def set_foot_pose(self, robot_model: str, foot_pose: FootPoseT, req_id: str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseFootPoseT:
|
|
160
|
+
# """
|
|
161
|
+
# [Foot Pose 제어]
|
|
162
|
+
# - robot_model: 로봇 모델
|
|
163
|
+
# - foot_pose: 발 포즈 정보
|
|
164
|
+
# - req_id: 요청 ID (선택 사항)
|
|
165
|
+
# - flow_manager_args: 플로우 매니저 인자 (선택 사항)
|
|
166
|
+
# """
|
|
167
|
+
|
|
168
|
+
# if req_id is None:
|
|
169
|
+
# req_id = str(uuid.uuid4())
|
|
170
|
+
|
|
171
|
+
# # 1) RequestFootMove 객체 생성
|
|
172
|
+
# req = RequestFootMoveT()
|
|
173
|
+
# req.id = req_id
|
|
174
|
+
# req.pose = foot_pose
|
|
175
|
+
|
|
176
|
+
# # 2) 요청 전송
|
|
177
|
+
# result = self.zenoh_client.query_one(
|
|
178
|
+
# f"amr/{robot_model}/accessory/foot",
|
|
179
|
+
# flatbuffer_req_obj=req,
|
|
180
|
+
# flatbuffer_res_T_class=ResponseFootMoveT,
|
|
181
|
+
# flatbuffer_buf_size=2048,
|
|
182
|
+
# )
|
|
183
|
+
|
|
184
|
+
# # 3) 결과 처리 및 반환
|
|
185
|
+
# if result.get("obj_payload") is None:
|
|
186
|
+
# raise RuntimeError("Call Foot Pose failed: obj_payload is None")
|
|
187
|
+
|
|
188
|
+
# if flow_manager_args is not None:
|
|
189
|
+
# print(result["dict_payload"].get("result"))
|
|
190
|
+
# if result["dict_payload"].get("result") == "reject":
|
|
191
|
+
# raise RuntimeError(result["dict_payload"].get("message"))
|
|
192
|
+
|
|
193
|
+
# self._run_coro_blocking(
|
|
194
|
+
# self._accessory_flow_manager_solver(
|
|
195
|
+
# robot_model=robot_model,
|
|
196
|
+
# req_id=req_id,
|
|
197
|
+
# flow_manager_args=flow_manager_args,
|
|
198
|
+
# )
|
|
199
|
+
# )
|
|
200
|
+
# return result["obj_payload"]
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
|
|
3
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityCamera import RequestCapabilityCameraT
|
|
4
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityDock import RequestCapabilityDockT
|
|
5
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityImu import RequestCapabilityImuT
|
|
6
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityLidar2D import RequestCapabilityLidar2DT
|
|
7
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityLidar3D import RequestCapabilityLidar3DT
|
|
8
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetyBumper import RequestCapabilitySafetyBumperT
|
|
9
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetyInterlock import (
|
|
10
|
+
RequestCapabilitySafetyInterlockT,
|
|
11
|
+
)
|
|
12
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetyIo import RequestCapabilitySafetyIoT
|
|
13
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetyObstacle import RequestCapabilitySafetyObstacleT
|
|
14
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetyOperationStop import (
|
|
15
|
+
RequestCapabilitySafetyOperationStopT,
|
|
16
|
+
)
|
|
17
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilitySafetySpeedControl import (
|
|
18
|
+
RequestCapabilitySafetySpeedControlT,
|
|
19
|
+
)
|
|
20
|
+
from rainbow.rb_flat_buffers.SLAMNAV.RequestCapabilityTabos import RequestCapabilityTabosT
|
|
21
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityCamera import ResponseCapabilityCameraT
|
|
22
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityDock import ResponseCapabilityDockT
|
|
23
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityImu import ResponseCapabilityImuT
|
|
24
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityLidar2D import ResponseCapabilityLidar2DT
|
|
25
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityLidar3D import ResponseCapabilityLidar3DT
|
|
26
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetyBumper import ResponseCapabilitySafetyBumperT
|
|
27
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetyInterlock import (
|
|
28
|
+
ResponseCapabilitySafetyInterlockT,
|
|
29
|
+
)
|
|
30
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetyIo import ResponseCapabilitySafetyIoT
|
|
31
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetyObstacle import (
|
|
32
|
+
ResponseCapabilitySafetyObstacleT,
|
|
33
|
+
)
|
|
34
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetyOperationStop import (
|
|
35
|
+
ResponseCapabilitySafetyOperationStopT,
|
|
36
|
+
)
|
|
37
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilitySafetySpeedControl import (
|
|
38
|
+
ResponseCapabilitySafetySpeedControlT,
|
|
39
|
+
)
|
|
40
|
+
from rainbow.rb_flat_buffers.SLAMNAV.ResponseCapabilityTabos import ResponseCapabilityTabosT
|
|
41
|
+
from rainbow.rb_schemas.fbs_models.amr.v1.slamnav_capability_models import (
|
|
42
|
+
ResponseCapabilityDockPD,
|
|
43
|
+
)
|
|
44
|
+
from rainbow.rb_schemas.sdk import FlowManagerArgs
|
|
45
|
+
|
|
46
|
+
from rainbow.rb_sdk.base import RBBaseSDK
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class RBAmrCapabilitySDK(RBBaseSDK):
|
|
50
|
+
"""
|
|
51
|
+
[AMR Capability SDK]
|
|
52
|
+
"""
|
|
53
|
+
def get_capability_dock(self, robot_model: str, req_id: str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityDockT:
|
|
54
|
+
"""
|
|
55
|
+
[AMR Capability Dock]
|
|
56
|
+
"""
|
|
57
|
+
if req_id is None:
|
|
58
|
+
req_id = str(uuid.uuid4())
|
|
59
|
+
|
|
60
|
+
# 1) RequestCapabilityDockT 객체 생성
|
|
61
|
+
req = RequestCapabilityDockT()
|
|
62
|
+
req.id = req_id
|
|
63
|
+
|
|
64
|
+
# 2) 요청 전송
|
|
65
|
+
result = self.zenoh_client.query_one(
|
|
66
|
+
f"amr/{robot_model}/capability/dock",
|
|
67
|
+
flatbuffer_req_obj=req,
|
|
68
|
+
flatbuffer_res_T_class=ResponseCapabilityDockPD,
|
|
69
|
+
flatbuffer_buf_size=125,
|
|
70
|
+
timeout=3
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# 3) 결과 처리 및 반환
|
|
74
|
+
if result.get("obj_payload") is None:
|
|
75
|
+
raise RuntimeError("Call Get Capability Dock failed: obj_payload is None")
|
|
76
|
+
|
|
77
|
+
if flow_manager_args is not None:
|
|
78
|
+
flow_manager_args.done()
|
|
79
|
+
|
|
80
|
+
return result["obj_payload"]
|
|
81
|
+
|
|
82
|
+
def get_capability_safety_io(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetyIoT:
|
|
83
|
+
"""
|
|
84
|
+
[로봇 IO 상태 조회]
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
if req_id is None:
|
|
88
|
+
req_id = str(uuid.uuid4())
|
|
89
|
+
|
|
90
|
+
req = RequestCapabilitySafetyIoT()
|
|
91
|
+
req.id = req_id
|
|
92
|
+
|
|
93
|
+
result = self.zenoh_client.query_one(
|
|
94
|
+
f"amr/{robot_model}/capability/safety/io",
|
|
95
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetyIoT,
|
|
96
|
+
flatbuffer_req_obj=req,
|
|
97
|
+
flatbuffer_buf_size=125,
|
|
98
|
+
timeout=3
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# 3) 결과 처리 및 반환
|
|
102
|
+
if result.get("obj_payload") is None:
|
|
103
|
+
raise RuntimeError("Call Get Capability Safety IO failed: obj_payload is None")
|
|
104
|
+
|
|
105
|
+
if flow_manager_args is not None:
|
|
106
|
+
flow_manager_args.done()
|
|
107
|
+
|
|
108
|
+
return result["obj_payload"]
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def get_capability_camera(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityCameraT:
|
|
112
|
+
"""
|
|
113
|
+
[로봇 카메라 상태 조회]
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
if req_id is None:
|
|
117
|
+
req_id = str(uuid.uuid4())
|
|
118
|
+
|
|
119
|
+
req = RequestCapabilityCameraT()
|
|
120
|
+
req.id = req_id
|
|
121
|
+
|
|
122
|
+
result = self.zenoh_client.query_one(
|
|
123
|
+
f"amr/{robot_model}/capability/camera",
|
|
124
|
+
flatbuffer_res_T_class=ResponseCapabilityCameraT,
|
|
125
|
+
flatbuffer_req_obj=req,
|
|
126
|
+
flatbuffer_buf_size=125,
|
|
127
|
+
timeout=3
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# 3) 결과 처리 및 반환
|
|
131
|
+
if result.get("obj_payload") is None:
|
|
132
|
+
raise RuntimeError("Call Get Capability Camera failed: obj_payload is None")
|
|
133
|
+
|
|
134
|
+
if flow_manager_args is not None:
|
|
135
|
+
flow_manager_args.done()
|
|
136
|
+
|
|
137
|
+
return result["obj_payload"]
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_capability_lidar2d(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityLidar2DT:
|
|
141
|
+
"""
|
|
142
|
+
[로봇 라이다 2D 상태 조회]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
if req_id is None:
|
|
146
|
+
req_id = str(uuid.uuid4())
|
|
147
|
+
|
|
148
|
+
req = RequestCapabilityLidar2DT()
|
|
149
|
+
req.id = req_id
|
|
150
|
+
|
|
151
|
+
result = self.zenoh_client.query_one(
|
|
152
|
+
f"amr/{robot_model}/capability/lidar2d",
|
|
153
|
+
flatbuffer_res_T_class=ResponseCapabilityLidar2DT,
|
|
154
|
+
flatbuffer_req_obj=req,
|
|
155
|
+
flatbuffer_buf_size=125,
|
|
156
|
+
timeout=3
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
# 3) 결과 처리 및 반환
|
|
160
|
+
if result.get("obj_payload") is None:
|
|
161
|
+
raise RuntimeError("Call Get Capability Lidar 2D failed: obj_payload is None")
|
|
162
|
+
|
|
163
|
+
if flow_manager_args is not None:
|
|
164
|
+
flow_manager_args.done()
|
|
165
|
+
|
|
166
|
+
return result["obj_payload"]
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def get_capability_lidar3d(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityLidar3DT:
|
|
170
|
+
"""
|
|
171
|
+
[로봇 라이다 3D 상태 조회]
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
if req_id is None:
|
|
175
|
+
req_id = str(uuid.uuid4())
|
|
176
|
+
|
|
177
|
+
req = RequestCapabilityLidar3DT()
|
|
178
|
+
req.id = req_id
|
|
179
|
+
|
|
180
|
+
result = self.zenoh_client.query_one(
|
|
181
|
+
f"amr/{robot_model}/capability/lidar3d",
|
|
182
|
+
flatbuffer_res_T_class=ResponseCapabilityLidar3DT,
|
|
183
|
+
flatbuffer_req_obj=req,
|
|
184
|
+
flatbuffer_buf_size=125,
|
|
185
|
+
timeout=3
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
# 3) 결과 처리 및 반환
|
|
189
|
+
if result.get("obj_payload") is None:
|
|
190
|
+
raise RuntimeError("Call Get Capability Lidar 3D failed: obj_payload is None")
|
|
191
|
+
|
|
192
|
+
if flow_manager_args is not None:
|
|
193
|
+
flow_manager_args.done()
|
|
194
|
+
|
|
195
|
+
return result["obj_payload"]
|
|
196
|
+
|
|
197
|
+
def get_capability_imu(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityImuT:
|
|
198
|
+
"""
|
|
199
|
+
[로봇 IMU 상태 조회]
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
if req_id is None:
|
|
203
|
+
req_id = str(uuid.uuid4())
|
|
204
|
+
|
|
205
|
+
req = RequestCapabilityImuT()
|
|
206
|
+
req.id = req_id
|
|
207
|
+
|
|
208
|
+
result = self.zenoh_client.query_one(
|
|
209
|
+
f"amr/{robot_model}/capability/imu",
|
|
210
|
+
flatbuffer_res_T_class=ResponseCapabilityImuT,
|
|
211
|
+
flatbuffer_req_obj=req,
|
|
212
|
+
flatbuffer_buf_size=125,
|
|
213
|
+
timeout=3
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# 3) 결과 처리 및 반환
|
|
217
|
+
if result.get("obj_payload") is None:
|
|
218
|
+
raise RuntimeError("Call Get Capability IMU failed: obj_payload is None")
|
|
219
|
+
|
|
220
|
+
if flow_manager_args is not None:
|
|
221
|
+
flow_manager_args.done()
|
|
222
|
+
|
|
223
|
+
return result["obj_payload"]
|
|
224
|
+
|
|
225
|
+
def get_capability_safety_bumper(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetyBumperT:
|
|
226
|
+
"""
|
|
227
|
+
[로봇 안전 범퍼 상태 조회]
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
if req_id is None:
|
|
231
|
+
req_id = str(uuid.uuid4())
|
|
232
|
+
|
|
233
|
+
req = RequestCapabilitySafetyBumperT()
|
|
234
|
+
req.id = req_id
|
|
235
|
+
|
|
236
|
+
result = self.zenoh_client.query_one(
|
|
237
|
+
f"amr/{robot_model}/capability/safety/bumper",
|
|
238
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetyBumperT,
|
|
239
|
+
flatbuffer_req_obj=req,
|
|
240
|
+
flatbuffer_buf_size=125,
|
|
241
|
+
timeout=3
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
# 3) 결과 처리 및 반환
|
|
245
|
+
if result.get("obj_payload") is None:
|
|
246
|
+
raise RuntimeError("Call Get Capability Safety Bumper failed: obj_payload is None")
|
|
247
|
+
|
|
248
|
+
if flow_manager_args is not None:
|
|
249
|
+
flow_manager_args.done()
|
|
250
|
+
|
|
251
|
+
return result["obj_payload"]
|
|
252
|
+
|
|
253
|
+
def get_capability_safety_interlock(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetyInterlockT:
|
|
254
|
+
"""
|
|
255
|
+
[로봇 안전 인터록 상태 조회]
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
if req_id is None:
|
|
259
|
+
req_id = str(uuid.uuid4())
|
|
260
|
+
|
|
261
|
+
req = RequestCapabilitySafetyInterlockT()
|
|
262
|
+
req.id = req_id
|
|
263
|
+
|
|
264
|
+
result = self.zenoh_client.query_one(
|
|
265
|
+
f"amr/{robot_model}/capability/safety/interlock",
|
|
266
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetyInterlockT,
|
|
267
|
+
flatbuffer_req_obj=req,
|
|
268
|
+
flatbuffer_buf_size=125,
|
|
269
|
+
timeout=3
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
# 3) 결과 처리 및 반환
|
|
273
|
+
if result.get("obj_payload") is None:
|
|
274
|
+
raise RuntimeError("Call Get Capability Safety Interlock failed: obj_payload is None")
|
|
275
|
+
|
|
276
|
+
if flow_manager_args is not None:
|
|
277
|
+
flow_manager_args.done()
|
|
278
|
+
|
|
279
|
+
return result["obj_payload"]
|
|
280
|
+
|
|
281
|
+
def get_capability_safety_obstacle(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetyObstacleT:
|
|
282
|
+
"""
|
|
283
|
+
[로봇 안전 장애물 상태 조회]
|
|
284
|
+
"""
|
|
285
|
+
|
|
286
|
+
if req_id is None:
|
|
287
|
+
req_id = str(uuid.uuid4())
|
|
288
|
+
|
|
289
|
+
req = RequestCapabilitySafetyObstacleT()
|
|
290
|
+
req.id = req_id
|
|
291
|
+
|
|
292
|
+
result = self.zenoh_client.query_one(
|
|
293
|
+
f"amr/{robot_model}/capability/safety/obstacle",
|
|
294
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetyObstacleT,
|
|
295
|
+
flatbuffer_req_obj=req,
|
|
296
|
+
flatbuffer_buf_size=125,
|
|
297
|
+
timeout=3
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
# 3) 결과 처리 및 반환
|
|
301
|
+
if result.get("obj_payload") is None:
|
|
302
|
+
raise RuntimeError("Call Get Capability Safety Obstacle failed: obj_payload is None")
|
|
303
|
+
|
|
304
|
+
if flow_manager_args is not None:
|
|
305
|
+
flow_manager_args.done()
|
|
306
|
+
|
|
307
|
+
return result["obj_payload"]
|
|
308
|
+
|
|
309
|
+
def get_capability_safety_operation_stop(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetyOperationStopT:
|
|
310
|
+
"""
|
|
311
|
+
[로봇 안전 작동 정지 상태 조회]
|
|
312
|
+
"""
|
|
313
|
+
|
|
314
|
+
if req_id is None:
|
|
315
|
+
req_id = str(uuid.uuid4())
|
|
316
|
+
|
|
317
|
+
req = RequestCapabilitySafetyOperationStopT()
|
|
318
|
+
req.id = req_id
|
|
319
|
+
|
|
320
|
+
result = self.zenoh_client.query_one(
|
|
321
|
+
f"amr/{robot_model}/capability/safety/operation/stop",
|
|
322
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetyOperationStopT,
|
|
323
|
+
flatbuffer_req_obj=req,
|
|
324
|
+
flatbuffer_buf_size=125,
|
|
325
|
+
timeout=3
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
# 3) 결과 처리 및 반환
|
|
329
|
+
if result.get("obj_payload") is None:
|
|
330
|
+
raise RuntimeError("Call Get Capability Safety Operation Stop failed: obj_payload is None")
|
|
331
|
+
|
|
332
|
+
if flow_manager_args is not None:
|
|
333
|
+
flow_manager_args.done()
|
|
334
|
+
|
|
335
|
+
return result["obj_payload"]
|
|
336
|
+
|
|
337
|
+
def get_capability_safety_speed_control(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilitySafetySpeedControlT:
|
|
338
|
+
"""
|
|
339
|
+
[로봇 안전 속도 제어 상태 조회]
|
|
340
|
+
"""
|
|
341
|
+
|
|
342
|
+
if req_id is None:
|
|
343
|
+
req_id = str(uuid.uuid4())
|
|
344
|
+
|
|
345
|
+
req = RequestCapabilitySafetySpeedControlT()
|
|
346
|
+
req.id = req_id
|
|
347
|
+
|
|
348
|
+
result = self.zenoh_client.query_one(
|
|
349
|
+
f"amr/{robot_model}/capability/safety/speed/control",
|
|
350
|
+
flatbuffer_res_T_class=ResponseCapabilitySafetySpeedControlT,
|
|
351
|
+
flatbuffer_req_obj=req,
|
|
352
|
+
flatbuffer_buf_size=125,
|
|
353
|
+
timeout=3
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
# 3) 결과 처리 및 반환
|
|
357
|
+
if result.get("obj_payload") is None:
|
|
358
|
+
raise RuntimeError("Call Get Capability Safety Speed Control failed: obj_payload is None")
|
|
359
|
+
|
|
360
|
+
if flow_manager_args is not None:
|
|
361
|
+
flow_manager_args.done()
|
|
362
|
+
|
|
363
|
+
return result["obj_payload"]
|
|
364
|
+
|
|
365
|
+
def get_capability_tabos(self, robot_model: str, req_id:str | None = None, flow_manager_args: FlowManagerArgs | None = None) -> ResponseCapabilityTabosT:
|
|
366
|
+
"""
|
|
367
|
+
[로봇 안전 도킹 상태 조회]
|
|
368
|
+
"""
|
|
369
|
+
|
|
370
|
+
if req_id is None:
|
|
371
|
+
req_id = str(uuid.uuid4())
|
|
372
|
+
|
|
373
|
+
req = RequestCapabilityTabosT()
|
|
374
|
+
req.id = req_id
|
|
375
|
+
|
|
376
|
+
result = self.zenoh_client.query_one(
|
|
377
|
+
f"amr/{robot_model}/capability/dock",
|
|
378
|
+
flatbuffer_res_T_class=ResponseCapabilityTabosT,
|
|
379
|
+
flatbuffer_req_obj=req,
|
|
380
|
+
flatbuffer_buf_size=125,
|
|
381
|
+
timeout=3
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
# 3) 결과 처리 및 반환
|
|
385
|
+
if result.get("obj_payload") is None:
|
|
386
|
+
raise RuntimeError("Call Get Capability Tabos failed: obj_payload is None")
|
|
387
|
+
|
|
388
|
+
if flow_manager_args is not None:
|
|
389
|
+
flow_manager_args.done()
|
|
390
|
+
|
|
391
|
+
return result["obj_payload"]
|