Skip to content

Robotics

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

  1. Update and Upgrade System Packages:
    sudo apt update && sudo apt upgrade -y
    
  2. Install Required Dependencies:
    sudo apt install -y curl gnupg2 lsb-release
    

Step 2: Configure ROS Repositories

  1. Add the ROS Repository Key:

    sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
    

  2. 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
    

  3. Update Package List:

    sudo apt update
    


Step 3: Install ROS 1 Noetic

  1. Install the Full ROS Desktop Version:

    sudo apt install -y ros-noetic-desktop-full
    

  2. Verify the Installation: Check the installed ROS version:

    rosversion -d
    
    This should return noetic.


Step 4: Initialize ROS Environment

  1. Set Up ROS Environment Variables:

    echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
    source ~/.bashrc
    

  2. Install rosdep: rosdep is a dependency management tool for ROS:

    sudo apt install -y python3-rosdep
    

  3. Initialize rosdep:

    sudo rosdep init
    rosdep update
    


Step 5: Test the ROS Installation

  1. Run roscore: Start the ROS master process:

    roscore
    
    Leave this terminal open.

  2. Open a New Terminal and Run turtlesim: Launch a simple simulation:

    rosrun turtlesim turtlesim_node
    

  3. Move the Turtle: Open another terminal and control the turtle using:

    rosrun turtlesim turtle_teleop_key
    
    Use the arrow keys to move the turtle in the simulation.


Step 6: Install Additional ROS Tools

To enhance your ROS setup, install the following:

  1. catkin Tools:

    sudo apt install -y python3-catkin-tools
    

  2. Common ROS Packages:

    sudo apt install -y ros-noetic-rviz ros-noetic-rqt ros-noetic-rqt-common-plugins
    

  3. 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! ```