Unit 03 · lesson

`ros2 run`: Package, Executable, Node

ros2 run: Package, Executable, Node

The syntax is simple:

ros2 run <package_name> <executable_name>

The meaning is more important.

Three names that beginners mix up

Consider:

ros2 run turtlesim turtlesim_node
  • turtlesim is the package.
  • turtlesim_node is the executable ROS 2 is asked to run.
  • the running node's default name is /turtlesim.

Those names can be related without being identical.

Prove it

With Turtlesim running, open another sourced terminal:

ros2 node list

You should see /turtlesim and, if teleop is running, /teleop_turtle.

Now compare:

ros2 pkg executables turtlesim
ros2 node list

The first command asks what installed executables a package provides. The second asks what nodes are alive now.

Process boundary

Ubuntu can also show the operating-system process:

ps -ef | grep turtlesim

Do not confuse an OS process list with the ROS graph. They answer different questions.

Checkpoint

Explain why this sentence is inaccurate:

"The package /turtlesim is running."

Rewrite it using package, executable, and node correctly.