Skip to main content
The TurtleBot3 workspace uses colcon as its build system. This guide covers building packages and using build aliases.

Quick build with aliases

The environment includes pre-configured aliases for common build tasks:
AliasCommandDescription
cbcd /workspace/turtlebot3_ws && colcon build --symlink-installBuild workspace
sbsource /workspace/turtlebot3_ws/install/setup.bashSource workspace
1

Navigate to workspace

cd /workspace/turtlebot3_ws
2

Build all packages

cb
Or use the full command:
colcon build --symlink-install
3

Source the workspace

After building, source the workspace to use the packages:
sb
Or use the full command:
source install/setup.bash

Build options

The --symlink-install flag creates symbolic links instead of copying files. This allows you to modify Python scripts and launch files without rebuilding:
colcon build --symlink-install
Note: C++ code changes still require a rebuild.

Build specific packages

Build only one package:
colcon build --packages-select turtlebot3_gazebo
Build a package and its dependencies:
colcon build --packages-up-to turtlebot3_gazebo

Verbose output

Show detailed build output for debugging:
colcon build --event-handlers console_direct+

Release build

Build with optimizations enabled:
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
This is the default configuration used in post-start.sh.

Clean build

When you need to rebuild everything from scratch:
1

Remove generated directories

cd /workspace/turtlebot3_ws
rm -rf build install log
2

Rebuild workspace

colcon build --symlink-install
3

Source the workspace

source install/setup.bash

Automatic build on startup

The container automatically builds the workspace when it starts via post-start.sh:
# From .devcontainer/post-start.sh
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
First-time builds take 2-3 minutes. Subsequent builds are faster when packages haven’t changed.

Build verification

Verify the build succeeded by listing installed packages:
ros2 pkg list | grep turtlebot3
Expected output includes:
  • turtlebot3_cartographer
  • turtlebot3_description
  • turtlebot3_gazebo
  • turtlebot3_navigation2
  • turtlebot3_node
  • turtlebot3_teleop
And more TurtleBot3 packages.

Troubleshooting build issues

If the build fails:
1

Check for error messages

Review the build output for specific errors:
colcon build --symlink-install --event-handlers console_direct+
2

Install missing dependencies

rosdep update
rosdep install --from-paths src --ignore-src -r -y
3

Clean and rebuild

cd /workspace/turtlebot3_ws
rm -rf build install log
colcon build --symlink-install
4

Check build logs

Review detailed logs if issues persist:
cat /workspace/turtlebot3_ws/log/latest*/events.log

Build docs developers (and LLMs) love