read_topic
Retrieve the latest message from a ROS2 topic, returning serialized data and message age in milliseconds. Supports latched topics for static data like /map or /robot_description.
Instructions
Read the latest message from a ROS2 topic. Returns the serialized message and data age in milliseconds. For latched topics (/map, /robot_description), set latched=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | Topic name, e.g. '/scan' | |
| latched | No | Set true for topics published once on connect (/map, /robot_description) | |
| msg_type | No | ROS2 message type, e.g. 'sensor_msgs/LaserScan' | std_msgs/String |
| timeout_ms | No | Max wait time in milliseconds |