RobotRT Python SDK (FFI thin wrapper)
Project description
RobotRT Python SDK (Embedded + Daemon)
This directory contains the Python-first SDK implementation on top of the frozen Core FFI ABI.
Scope
- Embedded mode SDK surface for node and buffer lease lifecycle.
- Embedded mode full communication APIs: pub/sub, service, action, mission.
- Embedded mode executor APIs: SimpleExecutor, CallbackExecutor, and MultiThreadExecutor.
- MultiThread one-shot APIs are
enqueue_*_once; persistent grouped path uses explicit methods:register_subscription_handler_grouped_persistent,register_service_handler_grouped_persistent,register_action_handler_grouped_persistent,register_mission_handler_grouped_persistent. - Daemon mode status SDK surface for snapshot/list/info/watch query.
- Unified error mapping from C ABI status and error payload.
- Zero-copy readable view via borrowed lease pointer to Python
memoryview.
Embedded Communication API (MVP)
import robotrt_sdk as sdk
with sdk.Node.create() as node:
pub = node.create_publisher("/demo/topic")
sub = node.create_subscriber("/demo/topic")
pub.publish_batch([b"hello", b"robotrt", b"batch"])
batch = sub.recv_batch(8)
for _ in batch:
# Reliable topics require explicit ack to release capacity.
sub.ack()
print(batch)
print("backpressure:", sub.backpressure_signal().value)
server = node.create_service_server("/demo/service")
client = node.create_service_client("/demo/service")
request_id = client.call(b"ping")
rid, req = server.recv_request()
server.reply(rid, b"pong")
print(client.poll_response(request_id))
action_server = node.create_action_server("/demo/action")
action_client = node.create_action_client("/demo/action")
goal_id, accepted = action_client.send_goal(b"goal")
gid, goal = action_server.recv_goal()
action_server.accept_goal(gid)
action_server.publish_feedback(gid, b"50%")
action_server.succeed(gid, b"done")
print(action_client.poll_result(goal_id))
mission = node.create_mission_session(42)
mission.open("demo_mission")
mission.send_command("start:demo")
mission.reconcile("cp-1", 2)
Subscriber with optional callback:
# Basic polling style
sub = node.create_subscriber("/demo/topic")
# With inline message handler
sub = node.create_subscriber("/demo/topic", on_message=lambda payload: print(payload))
Quick Start
- Build the shared library:
cargo build -p core-ffi --lib
- Run tests:
PYTHONPATH=bindings/python python3 -m unittest discover -s bindings/python/tests -p 'test_*.py'
- Run the embedded zero-copy demo:
PYTHONPATH=bindings/python python3 bindings/python/examples/embedded_zero_copy_demo.py
- Run the daemon status demo:
PYTHONPATH=bindings/python python3 bindings/python/examples/daemon_status_demo.py
- Run additional examples:
PYTHONPATH=bindings/python python3 bindings/python/examples/full_comms_demo.py
PYTHONPATH=bindings/python python3 bindings/python/examples/executor_demo.py
PYTHONPATH=bindings/python python3 bindings/python/examples/status_watch_demo.py
PYTHONPATH=bindings/python python3 bindings/python/examples/node_full_stack_demo.py
PYTHONPATH=bindings/python python3 bindings/python/examples/assembly_full_stack_demo.py
PYTHONPATH=bindings/python python3 bindings/python/examples/node_inherit_full_stack_demo.py
Unified Sample Naming
node_full_stack_demo: node-centric style, encapsulates pub/sub, service, action, mission in one app object and uses blockingspin().assembly_full_stack_demo: assembly style, creates resources directly and usesspin_async()to keep business logic on the main thread.node_inherit_full_stack_demo: inherit-node style, directly derives fromsdk.Nodeand adds app-level behavior.
Mode Switch API
import robotrt_sdk as sdk
# Embedded mode: read local status report.
embedded = sdk.StatusClient(mode="embedded", report_path="artifacts/introspection/local-loop-status.json")
print(embedded.node_list())
# Daemon mode: query robotrt-host status service.
daemon = sdk.StatusClient(mode="daemon", endpoint="127.0.0.1:7588", timeout_ms=1000)
print(daemon.service_list())
Environment Variables
ROBOTRT_CORE_FFI_LIB: optional absolute path to thecore-ffidynamic library.- If not set, SDK auto-discovers under
target/debugandtarget/debug/deps.
- If not set, SDK auto-discovers under
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
robotrt_sdk-0.1.0.tar.gz
(31.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotrt_sdk-0.1.0.tar.gz.
File metadata
- Download URL: robotrt_sdk-0.1.0.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c4e86cf68a34e4143131926a5902c73a71d74ad4878ee540b16ef42ec939ac6
|
|
| MD5 |
70439f73e1e60d48a63f32dd8ae4069c
|
|
| BLAKE2b-256 |
a4d92dad9706fe6983b3668d7f42dfe05c328baba67d23528b3725f2a6ee6081
|
File details
Details for the file robotrt_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: robotrt_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b317a7cf18f26531d68741818ce2b164bcbecf1d52ce09fba74e48425c04cbce
|
|
| MD5 |
0291c804737d56718b55295549e23d27
|
|
| BLAKE2b-256 |
879f371f602914ccba23492e796d7ae708c73f069fe2a3b02352d9313fd76990
|