robotrt-sdk 0.1.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.
@@ -0,0 +1,84 @@
1
+ from ._ffi import _CORE
2
+ from ._version import __version__
3
+ import ctypes
4
+ from .core import (
5
+ ActionClient,
6
+ ActionGoalHealth,
7
+ ActionServer,
8
+ BackpressureSignal,
9
+ CallbackGroupType,
10
+ BufferDescriptor,
11
+ BufferLease,
12
+ ExternalBufferRef,
13
+ LeaseView,
14
+ MissionSession,
15
+ Node,
16
+ NodeCallbackBinding,
17
+ Publisher,
18
+ CallbackExecutor,
19
+ MultiThreadExecutor,
20
+ MultiThreadExecutorStats,
21
+ RegisteredWork,
22
+ RegisteredWorkKind,
23
+ ServiceClient,
24
+ ServiceServer,
25
+ SimpleExecutor,
26
+ Subscriber,
27
+ TimerRegistration,
28
+ )
29
+ from .errors import ErrorInfo, RobotRtError
30
+ from .lifecycle import LifecycleNode, LifecycleState
31
+ from .logger import Logger
32
+ from .status import StatusClient
33
+
34
+ __all__ = [
35
+ "BufferDescriptor",
36
+ "BufferLease",
37
+ "ErrorInfo",
38
+ "LeaseView",
39
+ "LifecycleNode",
40
+ "LifecycleState",
41
+ "Logger",
42
+ "Node",
43
+ "NodeCallbackBinding",
44
+ "Publisher",
45
+ "Subscriber",
46
+ "ServiceClient",
47
+ "ServiceServer",
48
+ "ActionClient",
49
+ "ActionGoalHealth",
50
+ "ActionServer",
51
+ "BackpressureSignal",
52
+ "CallbackGroupType",
53
+ "CallbackExecutor",
54
+ "ExternalBufferRef",
55
+ "MissionSession",
56
+ "MultiThreadExecutor",
57
+ "MultiThreadExecutorStats",
58
+ "RobotRtError",
59
+ "RegisteredWork",
60
+ "RegisteredWorkKind",
61
+ "StatusClient",
62
+ "SimpleExecutor",
63
+ "TimerRegistration",
64
+ "__version__",
65
+ "abi_version",
66
+ "protocol_version",
67
+ "build_info",
68
+ ]
69
+
70
+
71
+ def abi_version() -> int:
72
+ return int(_CORE.lib.robotrt_core_abi_version())
73
+
74
+
75
+ def protocol_version() -> int:
76
+ return int(_CORE.lib.robotrt_core_protocol_version())
77
+
78
+
79
+ def build_info() -> str:
80
+ needed = ctypes.c_uint32(0)
81
+ _CORE.lib.robotrt_core_build_info_copy(None, 0, ctypes.byref(needed))
82
+ buf = ctypes.create_string_buffer(needed.value + 1)
83
+ _CORE.lib.robotrt_core_build_info_copy(buf, needed.value + 1, ctypes.byref(needed))
84
+ return buf.value.decode("utf-8", errors="replace")
robotrt_sdk/_ffi.py ADDED
@@ -0,0 +1,26 @@
1
+ from __future__ import annotations
2
+
3
+ from ._ffi_loader import CoreFfi, _CORE
4
+ from ._ffi_types import (
5
+ RT_DURABILITY_TRANSIENT_LOCAL,
6
+ RT_DURABILITY_VOLATILE,
7
+ RT_OK,
8
+ RtActionGoalHealth,
9
+ RtBufferDescriptor,
10
+ RtErrorInfo,
11
+ RtExternalBufferRef,
12
+ RtTopicQosProfile,
13
+ )
14
+
15
+ __all__ = [
16
+ "RT_OK",
17
+ "CoreFfi",
18
+ "RT_DURABILITY_TRANSIENT_LOCAL",
19
+ "RT_DURABILITY_VOLATILE",
20
+ "RtActionGoalHealth",
21
+ "RtBufferDescriptor",
22
+ "RtErrorInfo",
23
+ "RtExternalBufferRef",
24
+ "RtTopicQosProfile",
25
+ "_CORE",
26
+ ]
@@ -0,0 +1,82 @@
1
+ from __future__ import annotations
2
+
3
+ import ctypes
4
+ import os
5
+ import platform
6
+ from pathlib import Path
7
+
8
+ from ._ffi_signatures import declare_signatures
9
+ from ._ffi_types import RT_OK, RtErrorInfo
10
+ from .errors import ErrorInfo, RobotRtError
11
+
12
+
13
+ def _workspace_root() -> Path:
14
+ return Path(__file__).resolve().parents[3]
15
+
16
+
17
+ def _dylib_name() -> str:
18
+ name = platform.system().lower()
19
+ if name == "darwin":
20
+ return "librobotrt_core_ffi.dylib"
21
+ if name == "windows":
22
+ return "robotrt_core_ffi.dll"
23
+ return "librobotrt_core_ffi.so"
24
+
25
+
26
+ def _resolve_library_path() -> Path:
27
+ env = os.environ.get("ROBOTRT_CORE_FFI_LIB")
28
+ if env:
29
+ p = Path(env).expanduser().resolve()
30
+ if p.exists():
31
+ return p
32
+ raise FileNotFoundError(f"ROBOTRT_CORE_FFI_LIB does not exist: {p}")
33
+
34
+ root = _workspace_root()
35
+ direct = root / "target" / "debug" / _dylib_name()
36
+ if direct.exists():
37
+ return direct
38
+
39
+ deps = root / "target" / "debug" / "deps"
40
+ if deps.exists():
41
+ suffixes = {".dylib", ".so", ".dll"}
42
+ for candidate in sorted(deps.iterdir()):
43
+ if candidate.suffix not in suffixes:
44
+ continue
45
+ if candidate.name.startswith("librobotrt_core_ffi") or candidate.name == _dylib_name():
46
+ return candidate
47
+
48
+ raise FileNotFoundError("robotrt core ffi dynamic library not found; run cargo build -p core-ffi --lib")
49
+
50
+
51
+ class CoreFfi:
52
+ def __init__(self) -> None:
53
+ self.library_path = _resolve_library_path()
54
+ self.lib = ctypes.CDLL(str(self.library_path))
55
+ declare_signatures(self.lib)
56
+
57
+ def last_error(self) -> ErrorInfo:
58
+ info = RtErrorInfo()
59
+ self.lib.robotrt_error_last(ctypes.byref(info))
60
+
61
+ needed = ctypes.c_uint32(0)
62
+ self.lib.robotrt_error_message_copy(None, 0, ctypes.byref(needed))
63
+ message = ""
64
+ if needed.value > 0:
65
+ buf = ctypes.create_string_buffer(needed.value)
66
+ self.lib.robotrt_error_message_copy(buf, needed.value, ctypes.byref(needed))
67
+ message = buf.value.decode("utf-8", errors="replace")
68
+
69
+ return ErrorInfo(
70
+ code=int(info.code),
71
+ domain=int(info.domain),
72
+ retryable=bool(info.retryable),
73
+ message=message,
74
+ )
75
+
76
+ def check(self, status: int, context: str) -> None:
77
+ if status == RT_OK:
78
+ return
79
+ raise RobotRtError(self.last_error(), context)
80
+
81
+
82
+ _CORE = CoreFfi()
@@ -0,0 +1,372 @@
1
+ from __future__ import annotations
2
+
3
+ import ctypes
4
+
5
+ from ._ffi_types import (
6
+ RtActionGoalHealth,
7
+ RtBufferDescriptor,
8
+ RtErrorInfo,
9
+ RtExternalBufferRef,
10
+ RtTopicQosProfile,
11
+ RtUuid,
12
+ )
13
+
14
+
15
+ def declare_signatures(lib: ctypes.CDLL) -> None:
16
+ lib.robotrt_core_abi_version.argtypes = []
17
+ lib.robotrt_core_abi_version.restype = ctypes.c_uint32
18
+
19
+ lib.robotrt_core_protocol_version.argtypes = []
20
+ lib.robotrt_core_protocol_version.restype = ctypes.c_uint32
21
+
22
+ lib.robotrt_core_build_info_copy.argtypes = [
23
+ ctypes.c_char_p,
24
+ ctypes.c_uint32,
25
+ ctypes.POINTER(ctypes.c_uint32),
26
+ ]
27
+ lib.robotrt_core_build_info_copy.restype = ctypes.c_int32
28
+
29
+ lib.robotrt_node_create.argtypes = [ctypes.POINTER(ctypes.c_void_p)]
30
+ lib.robotrt_node_create.restype = ctypes.c_int32
31
+
32
+ lib.robotrt_node_create_with_identity.argtypes = [
33
+ ctypes.c_char_p,
34
+ ctypes.c_char_p,
35
+ ctypes.POINTER(ctypes.c_void_p),
36
+ ]
37
+ lib.robotrt_node_create_with_identity.restype = ctypes.c_int32
38
+
39
+ lib.robotrt_node_destroy.argtypes = [ctypes.c_void_p]
40
+ lib.robotrt_node_destroy.restype = ctypes.c_int32
41
+
42
+ lib.robotrt_node_set_param.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]
43
+ lib.robotrt_node_set_param.restype = ctypes.c_int32
44
+
45
+ lib.robotrt_node_get_param_copy.argtypes = [
46
+ ctypes.c_void_p,
47
+ ctypes.c_char_p,
48
+ ctypes.c_void_p,
49
+ ctypes.c_uint32,
50
+ ctypes.POINTER(ctypes.c_uint32),
51
+ ctypes.POINTER(ctypes.c_uint8),
52
+ ]
53
+ lib.robotrt_node_get_param_copy.restype = ctypes.c_int32
54
+
55
+ lib.robotrt_node_discovery_snapshot_json_copy.argtypes = [
56
+ ctypes.c_void_p,
57
+ ctypes.c_void_p,
58
+ ctypes.c_uint32,
59
+ ctypes.POINTER(ctypes.c_uint32),
60
+ ]
61
+ lib.robotrt_node_discovery_snapshot_json_copy.restype = ctypes.c_int32
62
+
63
+ lib.robotrt_node_topic_qos_ex.argtypes = [
64
+ ctypes.c_void_p,
65
+ ctypes.c_char_p,
66
+ ctypes.POINTER(RtTopicQosProfile),
67
+ ctypes.POINTER(ctypes.c_uint8),
68
+ ]
69
+ lib.robotrt_node_topic_qos_ex.restype = ctypes.c_int32
70
+
71
+ lib.robotrt_publisher_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
72
+ lib.robotrt_publisher_create.restype = ctypes.c_int32
73
+
74
+ lib.robotrt_publisher_publish.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint8), ctypes.c_uint64]
75
+ lib.robotrt_publisher_publish.restype = ctypes.c_int32
76
+
77
+ lib.robotrt_publisher_publish_buffer.argtypes = [ctypes.c_void_p, ctypes.POINTER(RtExternalBufferRef)]
78
+ lib.robotrt_publisher_publish_buffer.restype = ctypes.c_int32
79
+
80
+ lib.robotrt_publisher_flush.argtypes = [ctypes.c_void_p]
81
+ lib.robotrt_publisher_flush.restype = ctypes.c_int32
82
+
83
+ lib.robotrt_publisher_destroy.argtypes = [ctypes.c_void_p]
84
+ lib.robotrt_publisher_destroy.restype = ctypes.c_int32
85
+
86
+ lib.robotrt_subscriber_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
87
+ lib.robotrt_subscriber_create.restype = ctypes.c_int32
88
+
89
+ lib.robotrt_subscriber_recv.argtypes = [
90
+ ctypes.c_void_p,
91
+ ctypes.POINTER(ctypes.c_uint8),
92
+ ctypes.c_uint64,
93
+ ctypes.POINTER(ctypes.c_uint64),
94
+ ctypes.POINTER(ctypes.c_uint8),
95
+ ]
96
+ lib.robotrt_subscriber_recv.restype = ctypes.c_int32
97
+
98
+ lib.robotrt_subscriber_ack.argtypes = [ctypes.c_void_p]
99
+ lib.robotrt_subscriber_ack.restype = ctypes.c_int32
100
+
101
+ lib.robotrt_subscriber_pending_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint64)]
102
+ lib.robotrt_subscriber_pending_count.restype = ctypes.c_int32
103
+
104
+ lib.robotrt_subscriber_destroy.argtypes = [ctypes.c_void_p]
105
+ lib.robotrt_subscriber_destroy.restype = ctypes.c_int32
106
+
107
+ lib.robotrt_service_client_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
108
+ lib.robotrt_service_client_create.restype = ctypes.c_int32
109
+
110
+ lib.robotrt_service_server_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
111
+ lib.robotrt_service_server_create.restype = ctypes.c_int32
112
+
113
+ lib.robotrt_service_client_call.argtypes = [
114
+ ctypes.c_void_p,
115
+ ctypes.POINTER(ctypes.c_uint8),
116
+ ctypes.c_uint64,
117
+ ctypes.POINTER(RtUuid),
118
+ ]
119
+ lib.robotrt_service_client_call.restype = ctypes.c_int32
120
+
121
+ lib.robotrt_service_client_call_with_deadline.argtypes = [
122
+ ctypes.c_void_p,
123
+ ctypes.POINTER(ctypes.c_uint8),
124
+ ctypes.c_uint64,
125
+ ctypes.c_uint64,
126
+ ctypes.POINTER(ctypes.c_uint64),
127
+ ]
128
+ lib.robotrt_service_client_call_with_deadline.restype = ctypes.c_int32
129
+
130
+ lib.robotrt_service_client_cancel.argtypes = [ctypes.c_void_p, RtUuid]
131
+ lib.robotrt_service_client_cancel.restype = ctypes.c_int32
132
+
133
+ lib.robotrt_service_server_recv_request.argtypes = [
134
+ ctypes.c_void_p,
135
+ ctypes.POINTER(RtUuid),
136
+ ctypes.POINTER(ctypes.c_uint8),
137
+ ctypes.c_uint64,
138
+ ctypes.POINTER(ctypes.c_uint64),
139
+ ctypes.POINTER(ctypes.c_uint8),
140
+ ]
141
+ lib.robotrt_service_server_recv_request.restype = ctypes.c_int32
142
+
143
+ lib.robotrt_service_server_reply.argtypes = [
144
+ ctypes.c_void_p,
145
+ RtUuid,
146
+ ctypes.POINTER(ctypes.c_uint8),
147
+ ctypes.c_uint64,
148
+ ]
149
+ lib.robotrt_service_server_reply.restype = ctypes.c_int32
150
+
151
+ lib.robotrt_service_server_reply_error.argtypes = [
152
+ ctypes.c_void_p,
153
+ RtUuid,
154
+ ctypes.c_int32,
155
+ ctypes.c_int32,
156
+ ctypes.c_uint8,
157
+ ctypes.c_char_p,
158
+ ]
159
+ lib.robotrt_service_server_reply_error.restype = ctypes.c_int32
160
+
161
+ lib.robotrt_service_client_poll_response.argtypes = [
162
+ ctypes.c_void_p,
163
+ RtUuid,
164
+ ctypes.POINTER(ctypes.c_uint8),
165
+ ctypes.c_uint64,
166
+ ctypes.POINTER(ctypes.c_uint64),
167
+ ctypes.POINTER(ctypes.c_uint8),
168
+ ]
169
+ lib.robotrt_service_client_poll_response.restype = ctypes.c_int32
170
+
171
+ lib.robotrt_service_client_destroy.argtypes = [ctypes.c_void_p]
172
+ lib.robotrt_service_client_destroy.restype = ctypes.c_int32
173
+
174
+ lib.robotrt_service_server_destroy.argtypes = [ctypes.c_void_p]
175
+ lib.robotrt_service_server_destroy.restype = ctypes.c_int32
176
+
177
+ lib.robotrt_action_client_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
178
+ lib.robotrt_action_client_create.restype = ctypes.c_int32
179
+
180
+ lib.robotrt_action_server_create.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
181
+ lib.robotrt_action_server_create.restype = ctypes.c_int32
182
+
183
+ lib.robotrt_action_client_send_goal.argtypes = [
184
+ ctypes.c_void_p,
185
+ ctypes.POINTER(ctypes.c_uint8),
186
+ ctypes.c_uint64,
187
+ ctypes.POINTER(RtUuid),
188
+ ctypes.POINTER(ctypes.c_uint8),
189
+ ]
190
+ lib.robotrt_action_client_send_goal.restype = ctypes.c_int32
191
+
192
+ lib.robotrt_action_server_recv_goal.argtypes = [
193
+ ctypes.c_void_p,
194
+ ctypes.POINTER(RtUuid),
195
+ ctypes.POINTER(ctypes.c_uint8),
196
+ ctypes.c_uint64,
197
+ ctypes.POINTER(ctypes.c_uint64),
198
+ ctypes.POINTER(ctypes.c_uint8),
199
+ ]
200
+ lib.robotrt_action_server_recv_goal.restype = ctypes.c_int32
201
+
202
+ lib.robotrt_action_server_accept_goal.argtypes = [ctypes.c_void_p, RtUuid]
203
+ lib.robotrt_action_server_accept_goal.restype = ctypes.c_int32
204
+
205
+ lib.robotrt_action_server_reject_goal.argtypes = [ctypes.c_void_p, RtUuid, ctypes.c_char_p]
206
+ lib.robotrt_action_server_reject_goal.restype = ctypes.c_int32
207
+
208
+ lib.robotrt_action_server_publish_feedback.argtypes = [
209
+ ctypes.c_void_p,
210
+ RtUuid,
211
+ ctypes.POINTER(ctypes.c_uint8),
212
+ ctypes.c_uint64,
213
+ ]
214
+ lib.robotrt_action_server_publish_feedback.restype = ctypes.c_int32
215
+
216
+ lib.robotrt_action_server_heartbeat.argtypes = [ctypes.c_void_p, RtUuid]
217
+ lib.robotrt_action_server_heartbeat.restype = ctypes.c_int32
218
+
219
+ lib.robotrt_action_client_poll_feedback.argtypes = [
220
+ ctypes.c_void_p,
221
+ RtUuid,
222
+ ctypes.POINTER(ctypes.c_uint8),
223
+ ctypes.c_uint64,
224
+ ctypes.POINTER(ctypes.c_uint64),
225
+ ctypes.POINTER(ctypes.c_uint8),
226
+ ]
227
+ lib.robotrt_action_client_poll_feedback.restype = ctypes.c_int32
228
+
229
+ lib.robotrt_action_server_succeed.argtypes = [
230
+ ctypes.c_void_p,
231
+ RtUuid,
232
+ ctypes.POINTER(ctypes.c_uint8),
233
+ ctypes.c_uint64,
234
+ ]
235
+ lib.robotrt_action_server_succeed.restype = ctypes.c_int32
236
+
237
+ lib.robotrt_action_server_fail.argtypes = [ctypes.c_void_p, RtUuid, ctypes.c_char_p]
238
+ lib.robotrt_action_server_fail.restype = ctypes.c_int32
239
+
240
+ lib.robotrt_action_client_poll_result.argtypes = [
241
+ ctypes.c_void_p,
242
+ RtUuid,
243
+ ctypes.POINTER(ctypes.c_int32),
244
+ ctypes.POINTER(ctypes.c_uint8),
245
+ ctypes.c_uint64,
246
+ ctypes.POINTER(ctypes.c_uint64),
247
+ ctypes.POINTER(ctypes.c_uint8),
248
+ ]
249
+ lib.robotrt_action_client_poll_result.restype = ctypes.c_int32
250
+
251
+ lib.robotrt_action_client_cancel.argtypes = [ctypes.c_void_p, RtUuid]
252
+ lib.robotrt_action_client_cancel.restype = ctypes.c_int32
253
+
254
+ lib.robotrt_action_client_goal_status.argtypes = [
255
+ ctypes.c_void_p,
256
+ RtUuid,
257
+ ctypes.POINTER(ctypes.c_int32),
258
+ ctypes.POINTER(ctypes.c_uint8),
259
+ ]
260
+ lib.robotrt_action_client_goal_status.restype = ctypes.c_int32
261
+
262
+ lib.robotrt_action_client_goal_health.argtypes = [
263
+ ctypes.c_void_p,
264
+ RtUuid,
265
+ ctypes.POINTER(RtActionGoalHealth),
266
+ ctypes.POINTER(ctypes.c_uint8),
267
+ ]
268
+ lib.robotrt_action_client_goal_health.restype = ctypes.c_int32
269
+
270
+ lib.robotrt_action_client_active_goal_health.argtypes = [
271
+ ctypes.c_void_p,
272
+ ctypes.POINTER(RtActionGoalHealth),
273
+ ctypes.c_uint64,
274
+ ctypes.POINTER(ctypes.c_uint64),
275
+ ]
276
+ lib.robotrt_action_client_active_goal_health.restype = ctypes.c_int32
277
+
278
+ lib.robotrt_action_client_tick_timeouts.argtypes = [
279
+ ctypes.c_void_p,
280
+ ctypes.c_uint64,
281
+ ctypes.POINTER(ctypes.c_uint32),
282
+ ]
283
+ lib.robotrt_action_client_tick_timeouts.restype = ctypes.c_int32
284
+
285
+ lib.robotrt_action_server_poll_cancel.argtypes = [
286
+ ctypes.c_void_p,
287
+ ctypes.POINTER(ctypes.c_uint64),
288
+ ctypes.POINTER(ctypes.c_uint8),
289
+ ]
290
+ lib.robotrt_action_server_poll_cancel.restype = ctypes.c_int32
291
+
292
+ lib.robotrt_action_server_confirm_cancel.argtypes = [ctypes.c_void_p, RtUuid]
293
+ lib.robotrt_action_server_confirm_cancel.restype = ctypes.c_int32
294
+
295
+ lib.robotrt_action_client_destroy.argtypes = [ctypes.c_void_p]
296
+ lib.robotrt_action_client_destroy.restype = ctypes.c_int32
297
+
298
+ lib.robotrt_action_server_destroy.argtypes = [ctypes.c_void_p]
299
+ lib.robotrt_action_server_destroy.restype = ctypes.c_int32
300
+
301
+ lib.robotrt_mission_create.argtypes = [ctypes.c_void_p, RtUuid, ctypes.POINTER(ctypes.c_void_p)]
302
+ lib.robotrt_mission_create.restype = ctypes.c_int32
303
+
304
+ lib.robotrt_mission_open.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
305
+ lib.robotrt_mission_open.restype = ctypes.c_int32
306
+
307
+ lib.robotrt_mission_send_command.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint8)]
308
+ lib.robotrt_mission_send_command.restype = ctypes.c_int32
309
+
310
+ lib.robotrt_mission_reconcile.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_uint32]
311
+ lib.robotrt_mission_reconcile.restype = ctypes.c_int32
312
+
313
+ lib.robotrt_mission_complete_replay.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
314
+ lib.robotrt_mission_complete_replay.restype = ctypes.c_int32
315
+
316
+ lib.robotrt_mission_send_update_text.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
317
+ lib.robotrt_mission_send_update_text.restype = ctypes.c_int32
318
+
319
+ lib.robotrt_mission_send_update_json.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
320
+ lib.robotrt_mission_send_update_json.restype = ctypes.c_int32
321
+
322
+ lib.robotrt_mission_heartbeat.argtypes = [ctypes.c_void_p]
323
+ lib.robotrt_mission_heartbeat.restype = ctypes.c_int32
324
+
325
+ lib.robotrt_mission_next_update_json.argtypes = [
326
+ ctypes.c_void_p,
327
+ ctypes.c_void_p,
328
+ ctypes.c_uint32,
329
+ ctypes.POINTER(ctypes.c_uint32),
330
+ ctypes.POINTER(ctypes.c_uint8),
331
+ ]
332
+ lib.robotrt_mission_next_update_json.restype = ctypes.c_int32
333
+
334
+ lib.robotrt_mission_destroy.argtypes = [ctypes.c_void_p]
335
+ lib.robotrt_mission_destroy.restype = ctypes.c_int32
336
+
337
+ lib.robotrt_buffer_lease_create_from_bytes.argtypes = [ctypes.POINTER(ctypes.c_uint8), ctypes.c_uint64, ctypes.POINTER(ctypes.c_void_p)]
338
+ lib.robotrt_buffer_lease_create_from_bytes.restype = ctypes.c_int32
339
+
340
+ lib.robotrt_buffer_lease_descriptor.argtypes = [ctypes.c_void_p, ctypes.POINTER(RtBufferDescriptor)]
341
+ lib.robotrt_buffer_lease_descriptor.restype = ctypes.c_int32
342
+
343
+ lib.robotrt_buffer_lease_open_from_descriptor.argtypes = [ctypes.POINTER(RtBufferDescriptor), ctypes.POINTER(ctypes.c_void_p)]
344
+ lib.robotrt_buffer_lease_open_from_descriptor.restype = ctypes.c_int32
345
+
346
+ lib.robotrt_buffer_lease_copy_bytes.argtypes = [
347
+ ctypes.c_void_p,
348
+ ctypes.c_uint64,
349
+ ctypes.POINTER(ctypes.c_uint8),
350
+ ctypes.c_uint64,
351
+ ctypes.POINTER(ctypes.c_uint64),
352
+ ]
353
+ lib.robotrt_buffer_lease_copy_bytes.restype = ctypes.c_int32
354
+
355
+ lib.robotrt_buffer_lease_borrow_readonly.argtypes = [
356
+ ctypes.c_void_p,
357
+ ctypes.POINTER(ctypes.POINTER(ctypes.c_uint8)),
358
+ ctypes.POINTER(ctypes.c_uint64),
359
+ ]
360
+ lib.robotrt_buffer_lease_borrow_readonly.restype = ctypes.c_int32
361
+
362
+ lib.robotrt_buffer_lease_release.argtypes = [ctypes.c_void_p]
363
+ lib.robotrt_buffer_lease_release.restype = ctypes.c_int32
364
+
365
+ lib.robotrt_error_last.argtypes = [ctypes.POINTER(RtErrorInfo)]
366
+ lib.robotrt_error_last.restype = ctypes.c_int32
367
+
368
+ lib.robotrt_error_message_copy.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)]
369
+ lib.robotrt_error_message_copy.restype = ctypes.c_int32
370
+
371
+ lib.robotrt_error_clear.argtypes = []
372
+ lib.robotrt_error_clear.restype = ctypes.c_int32
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+
3
+ import ctypes
4
+
5
+ RT_OK = 0
6
+ RT_DURABILITY_VOLATILE = 0
7
+ RT_DURABILITY_TRANSIENT_LOCAL = 1
8
+
9
+
10
+ class RtUuid(ctypes.Structure):
11
+ _fields_ = [("bytes", ctypes.c_uint8 * 16)]
12
+
13
+
14
+ class RtErrorInfo(ctypes.Structure):
15
+ _fields_ = [
16
+ ("code", ctypes.c_int32),
17
+ ("domain", ctypes.c_int32),
18
+ ("retryable", ctypes.c_uint8),
19
+ ("_reserved0", ctypes.c_uint8),
20
+ ("_reserved1", ctypes.c_uint8),
21
+ ("_reserved2", ctypes.c_uint8),
22
+ ("message_len", ctypes.c_uint32),
23
+ ]
24
+
25
+
26
+ class RtBufferDescriptor(ctypes.Structure):
27
+ _fields_ = [
28
+ ("lease_id", ctypes.c_uint64),
29
+ ("payload_len", ctypes.c_uint64),
30
+ ("segment_index", ctypes.c_uint32),
31
+ ("segment_offset", ctypes.c_uint32),
32
+ ("segment_capacity", ctypes.c_uint32),
33
+ ("flags", ctypes.c_uint32),
34
+ ]
35
+
36
+
37
+ class RtExternalBufferRef(ctypes.Structure):
38
+ _fields_ = [
39
+ ("buffer_id", RtUuid),
40
+ ("offset", ctypes.c_uint64),
41
+ ("len", ctypes.c_uint64),
42
+ ]
43
+
44
+
45
+ class RtTopicQosProfile(ctypes.Structure):
46
+ _fields_ = [
47
+ ("reliable", ctypes.c_uint8),
48
+ ("durability", ctypes.c_uint8),
49
+ ("_reserved0", ctypes.c_uint8),
50
+ ("_reserved1", ctypes.c_uint8),
51
+ ("depth", ctypes.c_uint64),
52
+ ("deadline_nanos", ctypes.c_uint64),
53
+ ("lifespan_nanos", ctypes.c_uint64),
54
+ ("has_deadline", ctypes.c_uint8),
55
+ ("has_lifespan", ctypes.c_uint8),
56
+ ("_reserved2", ctypes.c_uint8),
57
+ ("_reserved3", ctypes.c_uint8),
58
+ ]
59
+
60
+
61
+ class RtActionGoalHealth(ctypes.Structure):
62
+ _fields_ = [
63
+ ("goal_id", RtUuid),
64
+ ("status", ctypes.c_int32),
65
+ ("liveness", ctypes.c_int32),
66
+ ("heartbeat_timeout_nanos", ctypes.c_uint64),
67
+ ("stalled_threshold_nanos", ctypes.c_uint64),
68
+ ("last_heartbeat_at_unix_nanos", ctypes.c_uint64),
69
+ ("last_feedback_at_unix_nanos", ctypes.c_uint64),
70
+ ("last_result_at_unix_nanos", ctypes.c_uint64),
71
+ ("has_heartbeat_timeout", ctypes.c_uint8),
72
+ ("has_stalled_threshold", ctypes.c_uint8),
73
+ ("has_last_heartbeat", ctypes.c_uint8),
74
+ ("has_last_feedback", ctypes.c_uint8),
75
+ ("has_last_result", ctypes.c_uint8),
76
+ ("_reserved0", ctypes.c_uint8),
77
+ ("_reserved1", ctypes.c_uint8),
78
+ ("_reserved2", ctypes.c_uint8),
79
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"