ROS 2 Install and Tutorials - Utagoe-robotics/Wiki GitHub Wiki

Install and Tutorials

Install ROS 2 Dashing

https://index.ros.org/doc/ros2/Installation/Dashing/ Make sure source the setup file /opt/ros/dashing/setup.bash. You might want to add the script to ~/.bashrc.

~/.bashrc

source /opt/ros/dashing/setup.bash

Install Package

Package Package Name
Turtlesim ros-<distro>-turtlesim
rqt ros-<distro>-rqt-*

Tutorials

https://index.ros.org/doc/ros2/Tutorials/

ROS 2 Command

$ ros2 run <Package Name> <Node Name>
$ ros2

Action

https://index.ros.org/doc/ros2/Tutorials/Understanding-ROS2-Actions/#ros2actions

Action is new to ROS 2. It sets a goal and send a message until it completes the goal.

launch

https://index.ros.org/doc/ros2/Tutorials/Launch-Files/Creating-Launch-Files/#ros2launch

Launch file format of ROS 2 is Python.

Creating a Workspace and Package

Creating a Workspace

https://index.ros.org/doc/ros2/Tutorials/Workspace/Creating-A-Workspace/#ros2workspace

  1. Create a new directory. $ mkdir -p ros2_ws/src
  2. Build the workspace. $ colcon build
  3. Source the overlay. $ source ~/ros2_ws/install/local_setup.bash
    • You should add this to ~/.bashrc

Creating a Package

https://index.ros.org/doc/ros2/Tutorials/Creating-Your-First-ROS2-Package/#createpkg

Move to ros2_ws/src directory.

CMake

$ ros2 pkg create --build-type ament_cmake <package_name>

Python

$ ros2 pkg create --build-type ament_python <package_name>

Build a Package

  1. Move to workspace root directory: $ cd ~/ros2_ws
  2. Build the package. $ colcon build
    • You can select specific package to build:
    • colcon build --packages-select <package_name>
⚠️ **GitHub.com Fallback** ⚠️