Unit 04 · lesson

Read Message Interfaces

You know /turtle1/cmd_vel uses:

geometry_msgs/msg/Twist

What data does a Twist message actually contain?

Ask ROS 2:

ros2 interface show geometry_msgs/msg/Twist

The official tutorial shows two Vector3 fields:

Vector3 linear
Vector3 angular

Each vector contains x, y, and z floating-point values.

Interface definitions are contracts

A publisher cannot invent arbitrary field names and expect a subscriber using Twist to understand them.

The interface defines the expected structure.

Trace observed data back to the interface

Compare:

ros2 interface show geometry_msgs/msg/Twist

with:

ros2 topic echo /turtle1/cmd_vel

Find each visible message field in the interface definition.

Inspect another interface

Get the type:

ros2 topic list -t

Then inspect the type used by /turtle1/pose:

ros2 interface show turtlesim/msg/Pose

Checkpoint

Explain:

Why do the topic name and message type both matter?