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

RobotCommandPublisher

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.Publisher

Publisher-shaped adapter that routes a component output through a robot plugin command transport.

A drop-in Publisher subclass: kept in publishers_dict under the original output-topic name, but publish encodes via the plugin’s RobotCommand and sends the bytes through the command transport instead of through a ROS publisher. _publisher stays None; the component’s _external_topics set 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.RobotCommand to 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 output and 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]])