/opt/ros/humble
).
~/ros2_ws
).
🔑 Rule: Always source
the underlay first, then the overlay.
Sourcing is how you tell your terminal which ROS environment to use:
Source underlay (system ROS2 install):
source /opt/ros/humble/setup.bash
Makes default ROS2 packages available.
Source overlay (your workspace build):
cd ~/ros2_ws
source install/local_setup.bash
Adds your custom workspace packages on top of the underlay.
📌 You must source again every time you open a new terminal (unless added to .bashrc
).
🔑 Example workflow:
source /opt/ros/humble/setup.bash # underlay
source ~/ros2_ws/install/local_setup.bash # overlay
mkdir -p ~/ros2_ws/src
2. go back to ros2_ws and do colcon build
3. When you run colcon build
, a workspace looks like this
ros2_ws/
├── build/ # temporary build files
├── install/ # executables, scripts, setup files (you source this!)
├── log/ # build & run logs
└── src/ # where your packages live