ros_sugar.robot.adapters¶
Component-side adapters that bridge Sugarcoat’s I/O contract to robot plugin transports.
RobotCommandPublisher is a io.publisher.Publisher subclass:
a component holds it in publishers_dict under the original output-topic
name and calls publish(), but the output is encoded and routed through a
robot plugin robot.command.RobotCommand instead of being sent on a ROS topic.
Module Contents¶
Classes¶
Publisher-shaped adapter that routes a component output through a robot plugin command transport. |
API¶
- class ros_sugar.robot.adapters.RobotCommandPublisher(plugin, command, output_topic, node_name: str = '')¶
Bases:
ros_sugar.io.publisher.PublisherPublisher-shaped adapter that routes a component output through a robot plugin command transport.
A drop-in
Publishersubclass: kept inpublishers_dictunder the original output-topic name, butpublishencodes via the plugin’sRobotCommandand sends the bytes through the command transport instead of through a ROS publisher._publisherstaysNone; the component’s_external_topicsset guards against the ROS-publisher creation path being applied to adapter entries.- Parameters:
plugin – The robot plugin instance (HOST or CLIENT).
command – The :class:
robot.command.RobotCommandto route to.output_topic – The original component output
io.topic.Topic.node_name – Owning component node name (for processor logging).
- publish(output: Any, **_) None¶
Encode
outputand send it through the robot plugin command.
- set_node_name(node_name: str) None¶
- set_publisher(publisher: rclpy.publisher.Publisher) None¶
- add_pre_processors(processors: List[Union[Callable, socket.socket]])¶