Ready to use image for Raspberry Pi
Custom 64 bit raspbian server image for raspberry pi 4/3b+ with pre-installed ROS noetic and many other useful packages for ready to use prototyping.
The Need
Imagine the time you have completed your simulation and now you are ready to implement it on your awesome hardare. But to test that beautiful code you get through the boardem task of preping your sd card with a fresh flash of raspbian and go through the tedious job of installing ROS and other packages in it.
So to avoid that we came up with the idea of creating our own custom image with pre-installed ROS and many other packages for a user friendly experience.
So the next time you mess up something big time, dont worry! Just get ready with a fresh flash of this image and you are good to go.
Initial Setup
To get started, download the image file using the link given above. Alright, once the download is complete, it’s time to flash it on your sd card. You could do that using various softwares like Balena Etcher, RUFUS or use the Official Raspberry Pi Imager.
WIFI and SSH: While working with ROS and robotics related projects you will be required to establish a ssh connection with your raspberry pi to avoid the hassle of connecting it to a display via HDMI. So in order to establish a ssh connection with your laptop both the devices needs to be on the same network. To do so, plug in your sd card in your computer and open the
wpa_suppicant.conf
file in a text editor and add your ssid and password accordingly. This will automatically connect your raspberry pi to the network on startup.
Ok, Once your pi is on the same network, we need to identify the ip address of your raspberry pi in order to ssh into it. You can use “nmap” to find devices on your network. Type in the following command to find all devices connected on the network.
Installing nmap:
sudo apt install nmap
Checking all devices on the same network.
sudo nmap -sN <IP of your device>/24
You should be a able to find a result that says Raspberry pi.
Find the IP of your raspberry in the list and ssh into using the command below.
ssh pi@<IP of your Raspberry Pi>
Alright! you’re all set up and good to go.
Note
Delault username: pi Default password: raspberry
Featues and usage
ROS: The image comes with pre-installed ROS neotic and Nav stack packages. For installation and more info on ROS please visit our Intro to ROS section.
ROS Master-Slave communication: ROS Master-Slave communication is essential when you are working with computational heavy packages which can can create a toll on your raspberry pi. To avoid that a Master-Slave communication is established so you can run differnet nodes on different devices accordingly. While using the above image, the raspberry pi is assumed to be a slave considering its master is running on your host device (eg: Your laptop running ROS). In order to do so, open your
.bashrc
file in your/home
directory and add the following lines in the end.export ROS_MASTER_URI=http://localhost:11311/ export ROS_HOSTNAME=<ROS IP OF YOUR MASTER DEVICE> export ROS_IP=<ROS IP OF YOUR MASTER DEVICE>
Once you are done with that, just save it and close the editor. Source the edited bashrc or open a fresh terminal and run
roscore
and you will see yourROS_MASTER_URI
has been changed from local host to the IP of your master device.Once the master url has been exposed, your raspberry pi can connect to your device as a slave. To do so open the
.bashrc
file of raspberry pi and navigate to the botom. You will find some similar lines contaitingROS_MASTER_URI
,ROS_HOSTNAME
,ROS_IP
. Change the IP address of your devices accordingly and you are good to go.
Virtual env Wrapper: virtual enviroment wrapper is a great tool for switching between diffenent python enviroments for diffent projects. The image comes pre-installed with it and has an existing enviroment named cv with OpenCV installed created in it. just type the below command and you are good to go.
workon cv
For more info and its usage please visit our Virtual Enviroment tutorial.
workon_ros: workon ros is an awesome tool to source and switch between different ros workspaces made by Jasmeet Singh. The workspace is needed to be created and built in a directory called ~/ros_workspace/. Once built, you can directly source the workspace using the workon_ros command. The image is already set up with the tool. To source with noetic workspace just paste the command below.
workon_ros noetic
Github repo for the project. Your inputs are always welcome.