2. Quick start with RTW

This tutorial shows the use of RosTeamWorkspace (RTW) for very common use-cases that can be done without permanent changes to your environment.

Note

This tutorial assumes that RTW is already set up and sourced. If that is not the case, please follow the Setting up RosTeamWorkspace (RTW) tutorial first.

2.1. Creating a new workspace (RTW)

For more details on options and flags check use-case description.

Local, empty workspace:

rtw workspace create --ros-distro jazzy --ws-folder my_workspace

Docker, empty workspace:

rtw workspace create --ros-distro jazzy --docker --ws-folder my_workspace

Local workspace from .repos file:

rtw workspace create --ros-distro jazzy --repos-containing-repository-url <my_git_url> --repos-branch <my_git_branch_with_repos> --ws-folder my_workspace

Docker workspace from .repos file:

rtw workspace create --ros-distro jazzy --docker --repos-containing-repository-url <my_git_url> --repos-branch <my_git_branch_with_repos> --ws-folder my_workspace

Warning

When using .repos files, rosdep install may fail if the package references in your repositories are outdated or if the rosdep database is not up-to-date. Ensure your .repos files point to the correct branches for your ROS distro and that packages have valid package.xml files with correct dependencies.

Note

For more advanced options such as proxy configuration, standalone workspaces, IPC communication setup, and other features, check the RTW CLI page.

2.2. Create new package in an existing workspace

For more details, check use-case description.

source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>

create-new-package <my_new_package_name> <"Some cool description of the package.">  # follow the instructions and remember to set a license

cd .. && colcon build --symlink-install  # to compile your newly created package

2.3. Create robot description package

For more details, check use-case description.

Warning

You must have a <my_cool_robot_description_package_name> package of build type ament_cmake to hold the robot description.

source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<my_cool_robot_description_package_name>

setup-robot-description <my_cool_robot_name>

2.4. Create robot bringup package

For more details, check use-case description.

Warning

You must have a <my_cool_robot_bringup_package_name> package of build type ament_cmake to hold the robot bringup.

source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<my_cool_robot_bringup_package_name>

setup-robot-bringup <my_cool_robot_name> <my_cool_robot_description_package_name>

2.5. Setup ros2_control control hardware

For more details, check use-case description.

Warning

You must have a <my_cool_robot_control_package_name> package of build type ament_cmake to hold the robot’s ros2_control hardware interface.

source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<my_cool_robot_control_package_name>

ros2_control_setup-hardware-interface-package <my_cool_robot_hardware> [<MyCoolRobotHW>]

2.6. Setup ros2_control controller

For more details, check use-case description.

Warning

You must have a <my_cool_robot_controller_package_name> package of build type ament_cmake to hold the robot’s ros2_control controller.

source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<my_cool_robot_controller_package_name>

ros2_control_setup-controller-package <my_controller_file_name>