publish_ros2_topic
Publish a message to a ROS 2 topic for a specified duration by defining topic, message type, content, and time in seconds.
Instructions
Publishes a message to a specific ROS 2 topic for a given duration (in seconds).
Args:
topic: Topic name to publish to (e.g., "/cmd_vel")
msg_type: ROS 2 message type (e.g., "geometry_msgs/msg/Twist")
msg_content: Message to send (e.g., '{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.5}}')
duration: Duration in seconds to continue publishing
Example:
topic: "/cmd_vel"
msg_type: "geometry_msgs/msg/Twist"
msg_content: '{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.5}}'
duration: 5
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"topic": "<topic>",
"msg_type": "<msg_type>",
"msg_content": "<msg_content>",
"duration": "<duration>"
},
"name": "publish_ros2_topic"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | ||
| duration | Yes | ||
| msg_type | Yes | ||
| msg_content | Yes |