LESSON 04 · ROS 2

Nodes, packages and workspaces

Separate software packaging from the running communication graph.

Environment and verification

Documented target: Ubuntu 24.04 · ROS 2 Jazzy · Gazebo Harmonic where used. Browser labs tested; ROS/Ubuntu/hardware execution not performed here.

What you will understand

  • Distinguish package, executable and node.
  • Inspect a live node.
  • Build a package skeleton.

Prerequisites: Choose and verify a ROS 2 environment and its stated environment.

The idea, made clear.

A package groups source, dependencies and executable entry points. A node is a running graph participant. One executable may create several nodes, and a package can supply several executables. A package being installed does not mean its node is running.

A colcon workspace usually contains src plus generated build, install and log directories. Sourcing install/setup.bash overlays built packages onto an existing ROS installation. Source the underlay first and workspace overlay afterward in every new terminal used for the exercise.

Inspect before editing. Namespaces, node names and remappings are runtime identifiers. A process that exits immediately disappears from the graph. Two processes sharing a node name can confuse introspection; give instances distinct names when investigating them.

Package sourceBuild + installExecutableRunning node
An original overview of the information or commissioning sequence.

Try it, step by step.

1

Inspect the graph

Keep a demo talker running.

nodes-and-workspaces-1.txt
ros2 node list
ros2 node info /talker

Expected: The talker and its communication endpoints.

2

Create a package

Requires a sourced Jazzy shell and development tools.

nodes-and-workspaces-2.txt
mkdir -p ~/nexviora_ws/src
cd ~/nexviora_ws/src
ros2 pkg create --build-type ament_python nexviora_demo --dependencies rclpy std_msgs

Expected: Package source and metadata; no runnable entry point yet.

3

Build and source

Build from workspace root.

nodes-and-workspaces-3.txt
cd ~/nexviora_ws
colcon build --symlink-install
source install/setup.bash
ros2 pkg prefix nexviora_demo

Expected: The package resolves to this workspace install prefix.

Explore the interactive lab →

If something goes wrong

Package missing after build
Source the install setup script in your run terminal.
Unresolved dependency
Inspect package.xml and install the matching dependency.

Check your understanding

Which is a live graph participant?

Make it yours

Start a second talker with --ros-args -r __node:=second_talker and inspect both.

Your learning progress

Optional progress stays in this browser. No account needed.

Go to the source documentation

Commands are educational examples for the stated environment, not a transcript of local ROS execution. Verify actual behavior on your machine.

Look up a term · Version notes · Report an issue