A ROS workspace is a directory with a defined internal structure for storing, building, and running ROS packages. Packages live in src; colcon creates build, install, and log directories for generated artifacts, environment setup, and build records. section 4.3
A typical workspace workflow is:
- Create the workspace and its src directory, then place new or cloned packages under src. section 4.3
- Run colcon build from the workspace's top-level directory, not from a subdirectory. section 4.3
- Source install/setup.sh so ROS tools can discover the built packages. section 4.3
- Verify discovery with ros2 pkg list or ros2 pkg prefix. section 4.3 section 4.7
Build and expose a package
For ~/rfp_ws, create a Python package in src, build from ~/rfp_ws with colcon build --symlink-install, source the install setup script, and run the package through ros2. section 4.3 section 4.7
mkdir -p ~/rfp_ws/src
Create the conventional workspace and source directory before adding ROS packages. section 4.3
cd ~/rfp_ws colcon build --symlink-install
Build all packages from the workspace root while preserving source-file links during development. section 4.3
