ROS2 Setup Guide for Robot Learning
Step-by-step guide to installing ROS2 Humble or Jazzy on Ubuntu for robot learning, data collection, and teleoperation with OpenArm and LeRobot.
Prerequisites
- Ubuntu 22.04 LTS (recommended) or Ubuntu 24.04 LTS
- At least 16 GB RAM (32 GB recommended for ML workloads)
- 50 GB free disk space
- NVIDIA GPU with 8+ GB VRAM (for downstream ML tasks)
- Internet connection for package downloads
- Basic familiarity with the Linux terminal
What you will set up
By the end of this tutorial, you will have a fully working ROS2 installation with colcon build tools, a workspace structure, MoveIt2 and ros2-control for robot arm manipulation, and a bridge to LeRobot for data collection. This is the foundation for every other tutorial on this site.
Check System Requirements
Before installing anything, verify your system meets the requirements. Open a terminal and run these checks:
You should see Ubuntu 22.04 or 24.04, at least 16 GB RAM, and 50 GB+ free disk space. If nvidia-smi is not found, install NVIDIA drivers first:
Install ROS2 Humble (or Jazzy)
Set up locale, add the ROS2 apt repository, and install ROS2. These commands are for Humble on 22.04 — replace humble with jazzy and jammy with noble if you are on 24.04.
This will take 5–15 minutes depending on your connection. Once done, source the setup file:
Install Colcon Build Tools and rosdep
Colcon is the standard build tool for ROS2 workspaces. rosdep resolves and installs package dependencies automatically.
sudo rosdep init says "already initialized", that is fine — just run rosdep update and continue.
Create a ROS2 Workspace
A ROS2 workspace is a directory where you clone, build, and develop packages. The standard convention is ~/ros2_ws.
You should see output like:
This means colcon is working. Your workspace structure is now:
Install Common Robot Packages
These packages are used in nearly every robot learning pipeline — arm control, motion planning, navigation, and sensor processing.
Test Your Installation
Verify everything works by running the classic talker/listener demo. Open two terminals:
Terminal 1 — Start the talker:
Terminal 2 — Start the listener:
You should see the talker publishing messages and the listener receiving them:
Also verify the key tools work:
Configure for OpenArm and Robot Arms
If you are using OpenArm or another robot arm, you need to set up the URDF description and ros2-control configuration.
Launch the robot description and visualize it in RViz2:
RViz2 should open showing the OpenArm model. You can move the joints using the joint_state_publisher_gui sliders to verify the URDF is correct.
~/ros2_ws/src, run rosdep install, and build.
Connect to LeRobot for Data Collection
LeRobot is Hugging Face's toolkit for robot learning. You can bridge ROS2 topics to LeRobot for recording teleoperation data.
Test that ROS2 topics are visible to LeRobot by checking the joint states:
Your ROS2 setup is now complete and ready for data collection. The next step is to configure LeRobot to record demonstrations from your robot.
Next: Collect Robot Training Data
Ready to start recording demonstrations? Follow our complete data collection tutorial to set up teleoperation, record episodes, and prepare your dataset for VLA fine-tuning.
Troubleshooting
Locale Error: "Cannot set LC_ALL to default locale"
Run sudo locale-gen en_US.UTF-8 and then sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8. Log out and back in, then retry the installation.
GPG Key Error: "The following signatures couldn't be verified"
The ROS2 GPG key may have changed. Re-download it: sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg and then sudo apt update.
Missing Dependencies: "rosdep could not find package"
Run rosdep update first. If the error persists, install the missing system dependency manually with sudo apt install <package-name>. Check the ROS2 Discourse forums for package-specific fixes.
colcon build fails with "CMake Error"
Make sure you sourced ROS2 before building: source /opt/ros/humble/setup.bash. Also verify build-essential and cmake are installed: sudo apt install -y build-essential cmake.
nvidia-smi: "NVIDIA-SMI has failed"
Your NVIDIA driver may need reinstalling. Run sudo apt purge nvidia-*, then sudo ubuntu-drivers autoinstall, and reboot. Verify with nvidia-smi after reboot.
Frequently Asked Questions
ROS2 Humble (LTS, supported until May 2027) is the safest choice for production robot learning pipelines. ROS2 Jazzy (released May 2024) offers newer features but has a smaller package ecosystem. Most LeRobot and OpenVLA integrations target Humble first.
An NVIDIA GPU with at least 8 GB VRAM is strongly recommended. You need it for real-time camera processing, CUDA-accelerated inference, and running VLA models during deployment. ROS2 itself runs fine on CPU, but downstream ML tasks require GPU.
ROS2 officially supports Ubuntu Linux. While Humble has experimental macOS and Windows builds, most robot learning tooling (LeRobot, OpenVLA, MoveIt2) is only tested on Ubuntu. Use a native Ubuntu install or a Docker container for the best experience.
Plan for at least 30 GB. ROS2 Desktop takes about 3 GB, MoveIt2 adds 2–4 GB, and ML dependencies (PyTorch, CUDA toolkit) can take 15–20 GB. Training data storage is additional — budget 100 GB+ if you plan to collect teleoperation datasets.
ros2-control is a hardware abstraction layer that manages real-time communication with robot actuators and sensors. MoveIt2 is a motion planning framework that generates collision-free trajectories. They work together: MoveIt2 plans the path, ros2-control executes it on the hardware.
Was this tutorial helpful?