ros2_assert_topic_published
Verify that a ROS2 topic publishes a message matching an optional condition within a timeout. Confirms expected message flow during testing.
Instructions
Assert that a message matching an optional condition has been published to a topic.
Args:
topic: Topic to check (e.g. '/robot/cmd_vel')
topic_type: Message type string (e.g. 'geometry_msgs/msg/Twist')
condition_expr: Python expression evaluating 'msg' (e.g. "msg['linear']['x'] > 0.5")
timeout_sec: Max wait duration in seconds
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>",
"topic_type": "<topic_type>"
},
"name": "ros2_assert_topic_published"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | ||
| topic_type | Yes | ||
| timeout_sec | No | ||
| condition_expr | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |