ROS 2 Workspace Structure

Understanding src, build, install, and log
Created by Tech Arcanist
Big Picture
src → build → install → log
Click to understand
• Workspace is just folders with rules
• ROS 2 tools move code through stages
• Similar to a cooking pipeline

Analogy:
src = ingredients
build = cooking
install = ready food
log = kitchen notes
src/ — Source Folder
bumperbot_ws/
└── src/
├── bumperbot_py_examples/
└── bumperbot_cpp_examples/
Click to understand
• This is where YOU write code
• Contains ROS 2 packages
• Python & C++ source files
• package.xml and CMakeLists.txt

Rule: You manually touch ONLY src/
build/ — Build Folder
build/
├── bumperbot_py_examples/
└── bumperbot_cpp_examples/
Click to understand
• Auto-generated by colcon build
• Temporary / intermediate files
• Compiler outputs & cache

Never: run or edit code from here
install/ — Install Folder
install/
├── bumperbot_py_examples/
├── bumperbot_cpp_examples/
└── setup.bash
Click to understand
• Final usable output
• Contains executables & libraries
• ROS 2 runs code ONLY from here

Critical file:
install/setup.bash
log/ — Log Folder
log/
├── latest/
└── build_YYYY-MM-DD/
Click to understand
• Build logs & warnings
• Used when build fails
• Safe to delete anytime
Key Mental Model:
src is what you write,
install is what ROS 2 runs.