
Overview
We will be install ROS on Raspberry PI 4 without Ubuntu. In this tutorial we we will be using docker insted of using ubuntu or any other software.
Requirments
- Laptop or Desktop
- Stable internet connection(Mobile or Router no matter which connection is it)
- Raspberry Pi with 4GB+ ram (mine is Raspberry Pi 4 B+ model with 8GB of ram)
- MicroSD card with a minimum of 32GB size
- Power supply (power bank or cell phone adaptor)
- MicroB to HDMI with monitor(optional) if you’re going to use a monitor then you will be needing of keyboard
- And most important thing a cup of coffee
Step 1 - Hardware setup
Ok first of all we need some software which will help us to flash memory card so that we can install os in the memory card to boot in pi.
Go to https://www.raspberrypi.com/software/ and download software according to your OS I’m using Zorin OS which is based on Ubuntu so I will be using the terminal. If you are using terminal use the following command
1 | sudo apt install rpi-imager |
as you can see in the below image I have already installed it on my device
Go ahead and open it up after opening it up plugin your 8GB or higher sd card on your laptop. as you can see in the image I have inserted 8GB of card
Now do the following steps as soon in the photo’s
Select Raspberry Pi OS(other)
Then select Raspberry Pi OS with desktop
Now select your disk but before writing your os we will configure it first so that we don’t have to connect any kind of ethernet cable or mini Wi-Fi. Press ALT + SHIFT + X
to open secret setting
Note: set your hostname and remember it we will be needing it later
Click on Yes and let it complete it. After that, you will be granted this message so it means that it is been completed.
Step 2 - Booting UP
Remove your memory card from the computer and plug that it into pi and power it on, well as the pi is doing some process grab a cup of coffee and wait for a few minutes.
Open up your terminal and enter the following command
1 | # as you remember I have told you to set your hostname in the software and remember it. |
Replace your hostname with the hostname you have set while preparing the sd card. In my case, I have set my hostname with datacenter so my command will be like this
1 | ssh [email protected] |
as soon as you hit enter it will as you for a conformation like this
1 | ~ ➤ ssh [email protected] |
answer it with yes after that it will as you for a password which we have set during the software installation. As you have given the password right then you will see that you have been login into your account successfully like I did.
Congratulation we have been login successfully into our pi take a break grab a cup of coffee and relax.
Step 3 - Software setup
As we successfully login into pi first we will update the repository as well as we will be upgrading it by the following command don’t worry if you haven’t used Linux in your life this will be your first experience as well as it will be really easy just follow my steps.
Update and Upgradation of packages
1 | sudo apt update |
The above command will update the repositories as well as it will be upgrading all the packages which are outdated so that we don’t get any kind of error while installing. It will take a few minutes after all the process is completed we will check once again if there is any software that is left to upgrade by the following command.
1 | sudo apt update && sudo apt list --upgradable |
The following command will check whether any package is upgradable or not, if its all upgrade then it will return it with this message
Package Installation
Now we will install some few pre-required software so that we will use it properly. Follow me oh and don’t forget your cup of coffee ;)
1 | sudo apt update |
Step 4 - Getting docker
There is a script which will help us to easily install docker on our PI without any command just a single command and then run it. Right simple as it says lets give it a run.
Download the following scipt
1 | curl -fsSL https://get.docker.com -o get-docker.sh |
After downloading it script rut it with super user permission(root access)
1 | sudo bash get-docker.sh |
Grab your cup of coffee and wait till the installtion is over
Once Docker is installed, add your login user to the docker group with the following command:
1 | sudo usermod -aG docker $(whoami) |
For our safty we will reboot out PI for external changes
1 | sudo init 6 |
After rebooting just check docker verion by following command:
1 | docker version # if the following command wont work then add sudo in front of it |
This is the following version which im running right now:
1 | docker version |
Step 5 - Installing Docker composer
Docker Compose is a tool for automating Docker projects using a YAML file. With the help of thi file you can create many project from scratch as I did.
1 | sudo apt install python3-pip -y |
PIP
is a tool which will help us to install docker composer. If it already install then we will move on to the next step
1 | sudo pip3 install docker-compose |
After installing docker composer we will check wheather it is installed properly or not
1 | docker-compose version |
Step 6 - Installation of ROS (semi-final step)
Before going further we will just give it a reboot so that we make sure that everything is working propely
1 | sudo init 6 |
As we have rebooted our system we will now search for our docker repository by using docker search command
1 | docker search siddhmistry |
We need to install second one which is second one siddhmistry/ros_rpi4
follow the following steps
1 | xhost + |
Now it will take come time so have a coffee break
Step 7 - Final step
As by now you have noticed that a terminator has been popped up run the following command so that we can setup our ROS System
1 | source /opt/ros/noetic/setup.bash |
As we have completed all the steps try to run roscore
if this commands works then you have successfully installed it. Press Ctrl + C
to exit roscore after that type exit
to exit it. Now that we have done everything we just need to install just a small thing which is called Portainer which will help to run this container easily
Step 8 - Installing Portainer
As we know we have already install docker so we will start installing Portainer so just follow the steps
First, create the volume that Portainer Server will use to store its database:
1 | docker volume create portainer_data |
Then, download and install the Portainer Server container:
1 | docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest |
Portainer Server has now been installed. You can check to see whether the Portainer Server container has started by running docker ps
:
1 | docker ps |
Now that the installation is complete, you can log into your Portainer Server instance by opening a web browser and going to: portainer
1 | https://localhost:9443 |
When you open the url you will be asked to steup admin username and password after login into the admin panel it looks like this
Here you will see a local enviroment click on it and this page will open it up:
At the left side panel you will able to see Containers
option. When you open that page it will grant you with some containers.
You will see that there is a container name ROS_PI4
select it and press start anf baam it started working. Portainer is a tool where it will help you control your container and also to add more containers in it. I hope you loved it.
Mr. Blogger
Podcast
Social Media
- Instagram - https://instagram.com/mistrysiddh
- Github - https://guthub.com/mrfoxie
- Linkedin - https://www.linkedin.com/in/SiddhMistry/
- Whatsapp - Message Me
- Discord - https://discord.gg/bPrBSbQ2W4
Donation
- Paypal - https://paypal.me/mistrysiddh
- Patreon - https://www.patreon.com/siddhmistry
- Buymeacoffee - https://www.buymeacoffee.com/mistrysiddh
Play Store
- Post title:ROS on Raspberry PI 4
- Post author:Mistry Siddh
- Create time:2022-10-17 07:06:04
- Post link:https://www.mistrysiddh.com/2022/10/17/ROS-on-RaspberryPI4/
- Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.