Beginners guide to ROS 2 Humble Installation
The Robot Operating System (ROS) is a set of software libraries and tools for building robot applications. From drivers and state-of-the-art algorithms to powerful developer tools, ROS has the open source tools you need for your next robotics project. Since ROS was started in 2007, a lot has changed in the robotics and ROS community. The goal of the ROS 2 project is to adapt to these changes, leveraging what is great about ROS 1 and improving what isn’t.
ROS 2 Humble is the eighth release of ROS 2. ROS, in its various iterations or “distributions,” is regularly released, with multiple “distros” supported at the same time, although they do not all have the same lifetimes.
On Windows, WSL (Windows Subsystem for Linux) improves the user experience with ROS 2 compared to native Windows installation, as it runs on a Linux platform. Install WSL with an Ubuntu version which is compatible with your ROS distribution and upgrade to WSL2 following the official Microsoft tutorial.
1. Installing WSL
Open PowerShell in Admin Mode
Run
wsl --installYou might run into the below error. This is related to Windows Subsystem for Linux (WSL) and specifically means that the Windows Hyper-V or virtualization services required by WSL 2 are not available or not running.
Check if virtualization is enabled
Open Task Manager → Performance → CPU tab
Look for “Virtualization: Enabled”
If Disabled, enable it in the BIOS/UEFI settings
Error code: Wsl/InstallDistro/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLEIf NO error continue with setting the username and password
Restart
Run
wsl --list --onlineto see available linux distros
Install distro
wsl --install Ubuntu-22.04Create username and password
Verify version by running
wsl -l -vInstall WSL in VS Code Extension
Open Ubuntu App (Windows Key > Ubuntu)
Run
code .Right click explorer to reveal in folder and save folder path
2. Setting Up Github in WSL
Set up credentials on VS Code
git config --global user.name “yourusername” git config --global user.email “youremail@gmail.com”3. ROS2 Humble Installation
Locale configuration
locale # check for UTF-8 sudo apt update && sudo apt install locales
Locale # check for UTF-8
sudo locale-gen en_US en_US.UTF-8 sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 export LANG=en_US.UTF-8 locale # verify settings
Software properties and Universe Repository
sudo apt install software-properties-common sudo add-apt-repository universe
Curl installation and ROS Key
sudo apt update && sudo apt install curl -y sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
ROS2 Sources Configuration
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
Update and Upgrade
sudo apt update && sudo apt install -y \ python3-flake8-docstrings \ python3-pip \ python3-pytest-cov \ ros-dev-tools
ROS Desktop Installation
sudo apt install ros-humble-desktop
ROS Environment Setup
source /opt/ros/humble/setup.bash
ROS2 Command check
ros24. ROS2 Command not found
This is a common error when running any ros2 commands
Run
echo “source /opt/ros/humble/setup.bash" >> ~/.bashrcto automatically source. This lets your ros2 command work.
5. Running Executables
Prerequisites
sudo apt update sudo apt install ros-humble-turtlesim
See list of packages
ros2 pkg list
See list of <packages, executables>
ros2 pkg executables
See list of executables from turtlesim package
ros2 pkg executables turtlesim
Run turtlesim. Do ros2 run -h to see options
# ros2 run <package_name> <executable_name> ros2 run turtlesim turtlesim_node
In other terminal, run the teleop mode
ros2 run turtlesim turtle_teleop_key6. Other Examples to try:
In one terminal, run a C++
talker:ros2 run demo_nodes_cpp talker
In another terminal run a Python
listener:ros2 run demo_nodes_py listenerYou should see the
talkersaying that it’sPublishingmessages and thelistenersayingI heardthose messages. This verifies both the C++ and Python APIs are working properly. Hooray!
Comments
Post a Comment