Skip to main content

English | 中文

Robot Bus

CI Code Quality crates.io PyPI npm Maven Central License

Robot Bus is a lightweight, multi-language messaging framework with a ROS 2–style programming model — topics, services, actions, and Node + spin — built on ZeroMQ. It does not replace ROS 2; it extends the ROS ecosystem to platforms and languages where a full ROS 2 stack is difficult to deploy or heavier than needed (for example Android, Windows, and browser clients).

APIs stay close to ROS 2 naming and usage so working code can later move into a ROS 2 node, or stay on robot-bus and interconnect with an existing ROS 2 graph through the ROS 2 bridge. Core runtime needs no ROS distro, no source setup.bash, and no workspace: one broker process plus an SDK is enough.

SDKs: Rust, Python, TypeScript, C++, Java, Android.

Robot Bus Web console

Web console — Overview / Topics / Services / Actions / Topology. Start robot-bus-broker, then open http://127.0.0.1:15570. See §4 Web console and the Tank demo.

The Node programming model — Context / Node, topic pub-sub, service, action (send_goal → GoalHandle → result / cancel), and spin — is the stable public API. Gateway clients use WebSocket RPC (Node::ws / Node.ws; transport "ws"). "grpc" and --grpc-listen remain aliases.

1. Application scenarios

1.1 Lightweight ROS 2–style messaging

When a full ROS 2 installation is unnecessary, robot-bus provides the same programming model with a smaller footprint — suitable for prototypes, tooling, Windows hosts, and constrained deployments.

1.2 Heterogeneous systems with ROS 2

Run ROS 2 on Ubuntu (or other Linux hosts) as usual, and place part of the compute on Android devices or other hosts where ROS 2 is impractical. Use robot-bus on those hosts with the same topic / service / action model, then interconnect via the ROS 2 bridge.

1.3 Prototype on bus, migrate to ROS 2

Because robot-bus is lightweight and quick to bring up, teams can prototype and validate nodes on bus first, then migrate the validated design to native ROS 2 (or keep the process on bus and bridge only the interfaces that must join the ROS 2 graph).

Migration playbooks for Agent / developers: docs/skills/ros2-to-robot-bus and docs/skills/robot-bus-to-ros2. In Cursor, @ those files or ask to migrate a package either way.

2. Architecture

  Application (Python / Rust / C++ / Java / Android / …)
                    │
                    │  ZMQ (tcp / ipc / inproc) or WebSocket RPC
                    ▼
             robot_bus_broker
                    │
                    │  optional ros2_bridge (rclrs / rclpy / rclcpp)
                    ▼
               ROS 2 graph

3. Quick start

3.1 Install and start the broker

pip install robot-bus
robot-bus-broker

Default API / Web console / WebSocket listen: http://0.0.0.0:15570. After the broker is up, open the Web console in a browser.

Runnable demos (topic, service, action) for Rust / Python / C++: examples/.

Or start the broker in-process:

import robot_bus

with robot_bus.RobotBusBroker.start() as broker:
    # application code …
    pass

3.2 Tank demo

A built-in mini tank sim helps you see topics moving end-to-end without writing code first:

  1. Start the broker (robot-bus-broker).
  2. Open http://127.0.0.1:15570 and click TANK in the sidebar (or go to /tank/).
  3. Click the panel, then drive with Arrow keys / WASD; or switch to point navigation and click on the map to send a goal.

Opening the panel starts the in-process tank node. It subscribes to /robot_bus/tank/cmd_vel and publishes /robot_bus/tank/pose. Multiple browsers share one world (teleop is last-writer-wins). Disable with --no-tank if needed.

3.3 Topic (publish / subscribe)

import robot_bus
from robot_bus.sensor_msgs.msg.v1 import Imu
from robot_bus.geometry_msgs.msg.v1 import Vector3

def on_imu(topic, imu: Imu):
    print(topic, imu.linear_acceleration)

node = robot_bus.Node("pilot")

imu_pub = node.create_publisher("/robot1/imu", Imu)
node.create_subscription("/robot1/imu", on_imu, msg_type=Imu)
imu_pub.publish(Imu(linear_acceleration=Vector3(x=0.0, y=0.0, z=9.8)))
# node.spin()

3.4 Service

import robot_bus
from robot_bus.std_srvs.srv.v1 import SetBoolRequest, SetBoolResponse

def on_set_bool(req: SetBoolRequest) -> SetBoolResponse:
    return SetBoolResponse(success=True, message=f"set:{req.data}")

server = robot_bus.Node("worker")
client = robot_bus.Node("caller")

server.create_service(
    "/set_bool", on_set_bool,
    request_type=SetBoolRequest, response_type=SetBoolResponse,
)
svc = client.create_client(
    "/set_bool",
    request_type=SetBoolRequest, response_type=SetBoolResponse,
)
# reply = svc.call(SetBoolRequest(data=True), timeout=5.0)
# server.spin()

3.5 Action

import robot_bus
from robot_bus.example_interfaces.action.v1 import (
    FibonacciGoal, FibonacciFeedback, FibonacciResult,
)

def on_fibonacci(goal: FibonacciGoal, context):
    seq = list(range(goal.order))
    context.publish_feedback(FibonacciFeedback(sequence=seq[:1]))
    return FibonacciResult(sequence=seq)

server = robot_bus.Node("worker")
client = robot_bus.Node("caller")

server.create_action_server(
    "/fibonacci", on_fibonacci,
    goal_type=FibonacciGoal,
    feedback_type=FibonacciFeedback,
    result_type=FibonacciResult,
)
act = client.create_action_client(
    "/fibonacci",
    goal_type=FibonacciGoal,
    feedback_type=FibonacciFeedback,
    result_type=FibonacciResult,
)
goal = act.send_goal(
    FibonacciGoal(order=5),
    feedback_callback=lambda fb: print(fb.sequence),
)
# result = goal.result(timeout=10.0)
# server.spin()

More detail: docs/en/python-api.md.

3.6 Other languages

Language Package / artifact Guide
Python PyPI robot-bus docs/en/python-api.md
Rust crates.io robot-bus docs/en/rust-api.md
TypeScript npm robot-bus docs/en/typescript-api.md
C++ GitHub Releases (DEB / MSI) docs/en/cpp-api.md
Java Maven Central org.indunet:robot-bus docs/en/java-api.md
Android Maven Central org.indunet:robot-bus-android docs/en/android-api.md
ROS 2 bridge per-language (rclrs / rclpy / rclcpp) docs/en/ros2-bridge.md

4. Web console

The broker ships with an embedded monitoring UI (Overview, Topics, Services, Actions, Topology, logs) — see the screenshot at the top of this README. After robot-bus-broker (or RobotBusBroker.start()), open:

http://127.0.0.1:15570

For a hands-on walkthrough, try the Tank demo from the sidebar TANK entry. Same port as the API / WebSocket gateway. Disable the UI with --no-console if needed. Frontend source: console/; local UI development: console/README.md.

5. ROS 2 bridge

In-process topic / service / action bridging between robot-bus and ROS 2. Each language uses its native client (rclrs / rclpy / rclcpp). Official support: Humble and Jazzy. The core SDK stays ROS-free unless the bridge is enabled.

Requires a sourced ROS 2 distro and rclpy, plus a running broker:

source /opt/ros/humble/setup.bash   # or jazzy
robot-bus-broker                    # another terminal
import robot_bus
from robot_bus.ros2_bridge import (
    Direction,
    Ros2Bridge,
    StdMsgsStringMapper,
    TriggerServiceMapper,
)

assert robot_bus.ros2_available()

bridge = (
    Ros2Bridge.new("ros_bridge")
    .bus_tcp("localhost")
    .route("/chatter", "/chatter")
    .mapper(StdMsgsStringMapper())
    .direction(Direction.Ros2ToBus)
    .add()
    .service("/reset", "/reset")
    .mapper(TriggerServiceMapper())
    .add()
    .build()
)
bridge.spin()

Full guide and examples (Rust / Python / C++): docs/en/ros2-bridge.md. For full package migration (not just bridging), see docs/skills/.

6. Protobuf messages

All robot-bus payloads — topics, services, and actions — are defined and serialized with Protocol Buffers. The wire format is protobuf bytes (not ROS CDR). Typed APIs bind a protobuf message class at create time and encode/decode automatically; omit the type to work with raw bytes.

Contracts live under proto/ in a ROS-style layout, aligned with common ROS 2 package names:

proto/<package>/{msg|srv|action|grpc}/v1/*.proto
Kind How it is modeled
Topic A single *.msg protobuf message
Service A pair of *Request / *Response messages under *.srv
Action Goal / Feedback / Result messages under *.action

Many built-in types are already provided, aligned with common ROS 2 packages. A few examples:

Kind ROS 2 robot-bus
Topic sensor_msgs/msg/Imu robot_bus.sensor_msgs.msg.v1.Imu
Topic geometry_msgs/msg/Twist robot_bus.geometry_msgs.msg.v1.Twist
Topic nav_msgs/msg/Odometry robot_bus.nav_msgs.msg.v1.Odometry
Service std_srvs/srv/SetBool robot_bus.std_srvs.srv.v1.SetBoolRequest / SetBoolResponse
Action example_interfaces/action/Fibonacci robot_bus.example_interfaces.action.v1.FibonacciGoal / …
Topic tf2_msgs/msg/TFMessage robot_bus.tf2_msgs.msg.v1.TFMessage

Generated stubs ship inside published packages (PyPI, crates.io, npm, DEB/MSI, Maven) — consumers do not need protoc. Message modules live under the robot_bus namespace and do not claim top-level ROS package names on the wire. Full list: proto/.

Custom messages

When the builtins are not enough, define your own protobuf types the same way. Typed APIs accept any protobuf message class (they do not have to live in this repository).

  1. Write a .proto (ROS-style package path recommended):
syntax = "proto3";
package my_robot.msg.v1;

message BatteryStatus {
  double voltage = 1;
  double percentage = 2;
}
  1. Generate code into your own project, for example with Python:
protoc --python_out=. --pyi_out=. my_robot/msg/v1/battery_status.proto
  1. Use it on a Node like a built-in type:
from my_robot.msg.v1 import battery_status_pb2 as pb

node = robot_bus.Node("bms")
pub = node.create_publisher("/battery", pb.BatteryStatus)
node.create_subscription("/battery", lambda t, msg: print(msg.voltage), msg_type=pb.BatteryStatus)
pub.publish(pb.BatteryStatus(voltage=48.0, percentage=0.85))

To contribute a type into this repo’s built-in set: add the file under proto/ and regenerate with just gen-python (or the matching just gen-* for other languages).

7. Contributing

If you are interested in this project and willing to spend some time on development, testing, or documentation, you are very welcome. Please contact: deng_ran@aliyun.com.

8. License

Apache License 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

robot_bus-1.1.0-cp39-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

robot_bus-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

robot_bus-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

robot_bus-1.1.0-cp39-abi3-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file robot_bus-1.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: robot_bus-1.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for robot_bus-1.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d5114a312486f7f60fc5db333ecaf2cc30cdf6a91a02aab7257d07a6971ed221
MD5 36c8ae0ccbb07e0aa49aead59b8c4345
BLAKE2b-256 f6d747d73e6d5c6f0d22469178f369c69ed795a94fa7eea76d9e8371da83b3b3

See more details on using hashes here.

File details

Details for the file robot_bus-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robot_bus-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 72e3d6da32617aa38b3b4e628dd18eb50ee0dde6573773db7c0f0e88f16f8bf1
MD5 ccc03582b76bd58c208bceab7cacbf57
BLAKE2b-256 c536d6e65af266c2717207443ecf54b2c1ea7dcd45e2930afaa0faf07b11dbba

See more details on using hashes here.

File details

Details for the file robot_bus-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for robot_bus-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cbe1633d9a6adff023f41e089854a6192703cfe79541fb62afb22ba7d310ce7d
MD5 276e943c93552bdff4e8eb6b81dfa677
BLAKE2b-256 b1e30cda0088f6760e70a06f75ee4db9ee4c19b4c7fcefb73863e76acde16d78

See more details on using hashes here.

File details

Details for the file robot_bus-1.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for robot_bus-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1663aef1ef8f811057e560703f5bd89689f42c3b802a63cbd2b722b12d50fa23
MD5 3c8b91c536e2b50e60d46073a86b749b
BLAKE2b-256 7d75b949591fa2b4eaae04f479161ec244753274bbff4f53c1c2f2b54cae52aa

See more details on using hashes here.

Release history Release notifications | RSS feed

2.3.0

4 files

2.2.0

4 files

2.1.0

4 files

2.0.0

4 files

1.3.4

4 files

1.3.3

4 files

1.3.2

4 files

1.3.1

4 files

1.3.0

4 files

1.2.1

4 files

This release

1.1.0 This release

4 files

1.0.0

4 files

0.1.9

4 files

0.1.8

4 files

0.1.7

4 files

0.1.6

4 files

0.1.4

4 files

0.1.3

4 files

0.1.2

4 files

0.1.1

4 files

0.1.0

4 files

0.0.9

4 files

0.0.6

4 files

0.0.5

4 files

0.0.4

4 files

0.0.3

4 files

0.0.2

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page