Installing ROS 1 on Raspberry Pi
Installing ROS 1 on Raspberry Pi
Robot Operating System (ROS) is an open-source framework widely used for robotic applications. This guide walks you through installing ROS 1 (Noetic) on a Raspberry Pi running Ubuntu. ROS 1 Noetic is the recommended version for Raspberry Pi and supports Ubuntu 20.04.
Prerequisites
Before starting, ensure you have the following:
- Raspberry Pi 4 or later with at least 4GB of RAM (8GB is recommended for larger projects).
- Ubuntu 20.04 installed on the Raspberry Pi (Desktop or Server version).
- Internet connection for downloading and installing packages.
Step 1: Set Up Your Raspberry Pi
- Update and Upgrade System Packages:
sudo apt update && sudo apt upgrade -y
- Install Required Dependencies:
sudo apt install -y curl gnupg2 lsb-release
Step 2: Configure ROS Repositories
-
Add the ROS Repository Key:
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
-
Add the ROS Noetic Repository:
echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list
-
Update Package List:
sudo apt update
Step 3: Install ROS 1 Noetic
-
Install the Full ROS Desktop Version:
sudo apt install -y ros-noetic-desktop-full
-
Verify the Installation: Check the installed ROS version:
This should returnrosversion -d
noetic
.
Step 4: Initialize ROS Environment
-
Set Up ROS Environment Variables:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Install rosdep: rosdep is a dependency management tool for ROS:
sudo apt install -y python3-rosdep
-
Initialize rosdep:
sudo rosdep init rosdep update
Step 5: Test the ROS Installation
-
Run roscore: Start the ROS master process:
Leave this terminal open.roscore
-
Open a New Terminal and Run turtlesim: Launch a simple simulation:
rosrun turtlesim turtlesim_node
-
Move the Turtle: Open another terminal and control the turtle using:
Use the arrow keys to move the turtle in the simulation.rosrun turtlesim turtle_teleop_key
Step 6: Install Additional ROS Tools
To enhance your ROS setup, install the following:
-
catkin Tools:
sudo apt install -y python3-catkin-tools
-
Common ROS Packages:
sudo apt install -y ros-noetic-rviz ros-noetic-rqt ros-noetic-rqt-common-plugins
-
GPIO and Hardware Libraries (for Pi-specific projects):
sudo apt install -y wiringpi pigpio
Troubleshooting
-
Issue:
rosdep
not initializing properly.
Fix: Ensure network connectivity and retry:sudo rosdep init rosdep update
-
Issue: ROS environment variables not set.
Fix: Manually source the ROS setup file:source /opt/ros/noetic/setup.bash
Conclusion
Your Raspberry Pi is now configured with ROS 1 Noetic, ready for robotic projects. With this setup, you can develop and deploy various ROS packages, integrate hardware, and experiment with advanced robotic systems.
Happy building!