How to Create and Set Up a ROS2 Workspace | ROS2 Tutorial

Added:

Workspace Setup
Tool Install
Workdir Init
Build Verify
Wrap Up

Workspace Setup

0:00
Playing Section
  • 1

    Introduces ROS2 workspace organization for code structure.

  • 2

    Explains need for dedicated folder to build and install custom nodes.

  • 3

    Highlights workspace as a shareable unit for team collaboration.

Basic proficiency with the Linux command-line interface, including terminal navigation, directory creation, and file permissions.
A foundational understanding of the core architecture of ROS2 (Robot Operating System 2), specifically the roles of nodes, topics, and packages.
Familiarity with shell configuration files (such as .bashrc or .zshrc) and how environment variables affect terminal sessions.
Introductory programming knowledge in Python or C++, which are the primary languages used to develop ROS2 applications.
Creating custom ROS2 packages from scratch using the 'ros2 pkg create' command for Python or C++.
Writing and building your first custom publisher and subscriber nodes within the newly created workspace.
Utilizing the 'rosdep' tool to automate the resolution and installation of system-level dependencies for your packages.
Developing ROS2 launch files to orchestrate and run multiple nodes simultaneously with specific configurations.
Mastering advanced 'colcon' build arguments, such as '--symlink-install', to streamline the debugging and development cycle.
134K views1.5Klikes8:18@RoboticsBackEndOriginal Release: 2022-08-17

A ROS2 workspace is a dedicated folder structure for organizing custom ROS2 code through packages, enabling building, installing, and sharing nodes with teams. To set up a workspace, first install colcon (the ROS2 build tool) using sudo apt install python3-colcon-command-extensions, then configure auto-completion by sourcing the bash script at /usr/share/colcon/argcomplete/hook in your .bashrc file. Create the workspace by making a directory (e.g., ros2_ws) and adding a src folder inside it. Run colcon build to compile code, which creates build, install, and log folders. Finally, source the install/setup.bash script to enable your custom nodes, and add this source command to your .bashrc for persistent configuration across all terminal sessions.