ros_sugar.robot.bus#

Feedback bus: fans decoded robot telemetry out to component consumers.

The plugin HOST (in the launcher process) decodes each telemetry packet once and publishes it on the FeedbackBus. Component consumers subscribe to the channels they need.

The bus carries bytes only; callers serialize ROS messages with rclpy.serialization and command payloads are already encoder output. The bus is symmetric. Either side may publish or subscribe.

Module Contents#

Classes#

BusHandle

Returned by FeedbackBus.subscribe; call unsubscribe to detach.

FeedbackBus

Bytes-only, channel-keyed pub/sub used between the plugin HOST and component consumers.

InProcessFeedbackBus

Direct in-process fan-out — used for multithreaded launch.

SocketFeedbackBus

Local abstract-namespace AF_UNIX fan-out - used for multiprocess launch.

API#

class ros_sugar.robot.bus.BusHandle(unsubscribe: Callable[[], None])#

Returned by FeedbackBus.subscribe; call unsubscribe to detach.

class ros_sugar.robot.bus.FeedbackBus#

Bases: abc.ABC

Bytes-only, channel-keyed pub/sub used between the plugin HOST and component consumers.

abstractmethod start() None#

Bring the bus up on the HOST side (e.g. bind a server socket).

abstractmethod connect() None#

Attach to an already-started bus from a component process.

abstractmethod publish(channel: str, data: bytes) None#

Publish data on channel to every subscriber.

abstractmethod subscribe(channel: str, on_data: Callable[[bytes], None]) ros_sugar.robot.bus.BusHandle#

Register on_data to receive every payload published on channel.

abstractmethod close() None#

Tear the bus down and release all resources.

property endpoint: Optional[str]#

Socket name for socket buses; None for in-process buses.

class ros_sugar.robot.bus.InProcessFeedbackBus#

Bases: ros_sugar.robot.bus.FeedbackBus

Direct in-process fan-out — used for multithreaded launch.

start() None#
connect() None#
publish(channel: str, data: bytes) None#
subscribe(channel: str, on_data: Callable[[bytes], None]) ros_sugar.robot.bus.BusHandle#
close() None#
property endpoint: Optional[str]#
class ros_sugar.robot.bus.SocketFeedbackBus(endpoint: Optional[str] = None)#

Bases: ros_sugar.robot.bus.FeedbackBus

Local abstract-namespace AF_UNIX fan-out - used for multiprocess launch.

The HOST calls start, which binds an abstract-namespace Unix socket and exposes its name via endpoint. Each component process constructs a SocketFeedbackBus with that endpoint and calls connect.

property endpoint: Optional[str]#
start() None#
connect() None#
publish(channel: str, data: bytes) None#
subscribe(channel: str, on_data: Callable[[bytes], None]) ros_sugar.robot.bus.BusHandle#
close() None#