Unit 04 · lesson

Diagnose Topic Failures

Topic problems are easier when you separate name, type, endpoint, and data.

Failure A: wrong topic name

Try to echo a name that is not active:

ros2 topic echo /turtle1/not_a_real_topic

Then check:

ros2 topic list

Question: is the problem "no ROS 2" or simply "wrong name"?

Failure B: wrong message type in a publish command

Before publishing, inspect:

ros2 topic list -t
ros2 interface show geometry_msgs/msg/Twist

A publish command using an incompatible type/shape should not be repaired by randomly editing numbers.

Failure C: no subscriber

A publisher can exist even if the intended receiver is not running.

Inspect:

ros2 topic info /turtle1/cmd_vel

If subscription count is zero, ask which node was supposed to receive that topic and whether it is alive.

Failure D: no messages yet

echo can wait quietly because no publisher is sending new data. Trigger teleop and see whether messages arrive.

Diagnostic order

1. exact topic name
2. exact topic type
3. endpoint counts/names
4. interface structure
5. actual message data

Checkpoint

Choose one failure and write an evidence-first repair record. Your first step cannot be "restart everything."