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