Skip to content

Instantly share code, notes, and snippets.

@MOAMIndustries
Created March 21, 2022 13:01
Show Gist options
  • Save MOAMIndustries/c3c2b041e9209b72e00acf3b862d629b to your computer and use it in GitHub Desktop.
Save MOAMIndustries/c3c2b041e9209b72e00acf3b862d629b to your computer and use it in GitHub Desktop.
ROS2 Environment for Raspberry Pi
#!/bin/bash
sudo apt update
sudo apt install ros-galactic-desktop
# Source environ and add it to the the .bashrc file to save a bunch of hassle
echo "source /opt/ros/galactic/setup.bash" | tee -a ~/.bashrc
source /opt/ros/galactic/setup.bash
# Install common dependancies
sudo apt install python3-colcon-common-extensions python3-rosdep2
A Raspberry Pi4 with at least 4GB of Ram is recommended
Each version of ROS is tied to a specific release of Ubuntu.
We are going to use ROS2 Galactic which is tied to Ubuntu 20.4 Focal.
With full desktop support.
The Raspberry Pi foundations Pi Imager tool makes this easy. If you have not used it before,
you can download it from https://www.raspberrypi.com/software/
--- IMPORTANT: select the 64 bit version of Ubuntu ---
When you launch the tool, select the Ubuntu 20.4 64-Bit server using the following steps
Choose OS
|_Other general-purpose OS
|_Ubuntu
|_Ubuntu Server 20.04.4 LTS (RPI 3/4/400)
64 Bit OS
Select your Storage and create your SD Card
Once your raspberry Pi has booted and you have logged in with the following default credentials
user: ubuntu
pass: ubuntu
Now we need to install a number of dependancies and other services.
1. Install desktop
2. Install ROS
#!/bin/bash
sudo apt update
sudo apt install software-properties-common curl gnupg lsb-release wget git -y
sudo add-apt-repository universe
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt install ubuntu-desktop -y
sudo systemctl set-default multi-user.target
sudo shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment