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¶
Returned by |
|
Bytes-only, channel-keyed pub/sub used between the plugin HOST and component consumers. |
|
Direct in-process fan-out — used for multithreaded launch. |
|
Local abstract-namespace |
API¶
- class ros_sugar.robot.bus.BusHandle(unsubscribe: Callable[[], None])¶
Returned by
FeedbackBus.subscribe; callunsubscribeto detach.
- class ros_sugar.robot.bus.FeedbackBus¶
Bases:
abc.ABCBytes-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
dataonchannelto every subscriber.
- abstractmethod subscribe(channel: str, on_data: Callable[[bytes], None]) ros_sugar.robot.bus.BusHandle¶
Register
on_datato receive every payload published onchannel.
- abstractmethod close() None¶
Tear the bus down and release all resources.
- property endpoint: Optional[str]¶
Socket name for socket buses;
Nonefor in-process buses.
- class ros_sugar.robot.bus.InProcessFeedbackBus¶
Bases:
ros_sugar.robot.bus.FeedbackBusDirect 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.FeedbackBusLocal abstract-namespace
AF_UNIXfan-out - used for multiprocess launch.The HOST calls
start, which binds an abstract-namespace Unix socket and exposes its name viaendpoint. Each component process constructs aSocketFeedbackBuswith that endpoint and callsconnect.- 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¶