Skip to main content

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.
  • 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"])
  print(sub.recv_batch(8))
  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)

Quick Start

  1. Build the shared library:
cargo build -p core-ffi --lib
  1. Run tests:
PYTHONPATH=bindings/python python3 -m unittest discover -s bindings/python/tests -p 'test_*.py'
  1. Run the embedded zero-copy demo:
PYTHONPATH=bindings/python python3 bindings/python/examples/embedded_zero_copy_demo.py
  1. Run the daemon status demo:
PYTHONPATH=bindings/python python3 bindings/python/examples/daemon_status_demo.py
  1. 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

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 the core-ffi dynamic library.
    • If not set, SDK auto-discovers under target/debug and target/debug/deps.

Project details


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.0b1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotrt_sdk-0.1.0b1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file robotrt_sdk-0.1.0b1.tar.gz.

File metadata

  • Download URL: robotrt_sdk-0.1.0b1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for robotrt_sdk-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 bdf71cfe1d450298aeb604d3b27686374a9838f92dd9e63cdf6fc20ed06dc2b6
MD5 715773ef3814bac244d678acfb46a8d4
BLAKE2b-256 5c14bee83976a1a2692a1665757063e96f2bf58964da26f50d7956a6ace7642e

See more details on using hashes here.

File details

Details for the file robotrt_sdk-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: robotrt_sdk-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for robotrt_sdk-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9513a6d35c68b058b5d479ba24d5512ac4a9bca3e8d5a94189c6afe41e97225
MD5 8b500ef82e487ad97a30fce3d85fc798
BLAKE2b-256 3a4a679362d7ed299d77376f715fcc73b3195bdbb60fc1ad28fa17d41b920d7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page