Unit 03 · lesson

Discover Nodes With `ros2 node list`

Discover Nodes With ros2 node list

A live ROS 2 system can change while you watch it.

That makes discovery tools useful.

Baseline

Run only:

ros2 run turtlesim turtlesim_node

In another sourced terminal:

ros2 node list

Record the result.

Add a second node

Start:

ros2 run turtlesim turtle_teleop_key

Run again:

ros2 node list

What appeared?

Stop teleop

Exit turtle_teleop_key, then list nodes again.

The graph changed because a node left the system.

Discovery is live evidence

ros2 node list does not describe every node that could exist. It describes nodes currently discovered in the ROS graph.

That distinction becomes important later when a launch file was supposed to start five nodes but you can only discover four.

Controlled name change

The official node tutorial demonstrates changing the node name at startup:

ros2 run turtlesim turtlesim_node --ros-args --remap __node:=my_turtle

Run ros2 node list again.

You changed the node identity exposed in the graph without renaming the executable on disk.

Evidence checkpoint

Create a three-state table:

StateRunning commandsros2 node list evidence
simulator only
simulator + teleop
renamed simulator