publish_to_topic
Publish a message to any ROS2 topic by specifying the topic name, message type, and data as JSON.
Instructions
Publish a message to any ROS2 topic.
This tool allows publishing to any ROS2 topic with the appropriate message type. Use 'get_topic_info' to discover the message type for a topic.
Examples:
Publish twist: publish_to_topic("/cmd_vel", "geometry_msgs/msg/Twist", {"linear": {"x": 1.0}, "angular": {"z": 0.5}})
Publish initial pose: publish_to_topic("/initialpose", "geometry_msgs/msg/PoseWithCovarianceStamped", {...})
Returns:
success: Whether the publish succeeded
error: Error message if publish failed
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Message data to publish as JSON | |
| topic_name | Yes | Topic name to publish to | |
| message_type | Yes | Message type (e.g., geometry_msgs/msg/Twist) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||