Introduction: Raspberry Pi and ROS (Robotic Operating System)
Now just so that you are not confused about the potentials of the Raspberry Pi as a robotic processor/controller, it has great potential for small computation and can run Linux and all the great features that come along with it. But this is a Arm processor and not a typical PC cpu so it is limited by its architecture and power capabilities. Some portions of Linux code have not been completely ported to ARM processors so you will be limited at the moment to what programs you can install. But for most of ROS and the programs I am going to cover in this tutorial, Pi is functional and can be useful depending on the demands of your project. But if you are planning to do any 3d/2d mapping/navigation with a Kinect/laser scanner at the moment I am not sure its possible utilizing just the Raspberry Pi but with time who knows. In the future I will also include another tutorial that connects the Raspberry Pi to a small robot to act as controller. So lets begin..
Step 1: Parts List
We are going to need the following items :
Raspberry Pi
http://www.zagrosrobotics.com/shop/item.aspx?itemid=895
Micro USB power supply
USB keyboard and mouse
HDMI cable
Monitor with HDMI input
SD Card with at least 8GB (Check this list of compatible cards )
And a computer with either Windows or Linux installed
Step 2: Writing the Image to the SD Card
Now there are a couple of different ways to get Linux and ROS working on Raspberry PI. One way is to write the Linux image to the SD card then download and install ROS form within the Raspberry Pi. This can become difficult and time consuming for the beginner, but it is useful when creating a custom ROS installation. These steps can be found here on the ROS WIKI
Rosberry Pi
However we are going to be using a Linux image that has ROS pre-installed. Thanks to Jeremy Nicola for providing the image in the form of a zip file which can be found here
Rosberry PI Image
And in order to get our Linux image on to the SD Card we are going to use Image Writer for Windows, which can be downloaded here
https://launchpad.net/win32-image-writer
FOR WINDOWS :
Insert the SD card into your SD card reader, then locate and remember what drive letter the SD card was assigned.
Format the card and make sure there is only one partition (FAT32 is a good choice), otherwise
Win32DiskImager can corrupt your SD card!
Extract the Raspbian-ROS-full.img.7z file somewhere.
Install and run Win32DiskImager utility as Administrator.
Select the Raspbian-ROS-full.img image file
Select the drive letter of the SD card in the device box. Make sure you select the correct drive, if you select the wrong drive you can corrupt your data on that assigned drive.
Click Write and wait for the write to complete.
Exit the program and eject the SD card.
If all goes well you should have a bootable image on your SD card.
FOR LINUX :
Use DD in the terminal to write the image to the SD card
extract Raspbian-ROS-full.img.7z
copy and paste this after replacing the correct paths to your SD card and Raspberry Pi image
sudo dd if=/path/to/Download/img/file of=/path/to/SDcard
example
sudo dd if=/home/username/Downloads/Raspbian-ROS-full.img of=/dev/sdc
Wait for the command to return. This may take some time so be patient .If all goes well you should have a bootable image on your SD card.
Step 3: Starting Our Rosberry for the First Time
Insert the SD card into the Raspberry Pi's card slot. Connect the Raspberry PI to the HDMI monitor, keyboard, mouse and power supply. Before you can get into the desktop screen you will have to enter your username and password
Username: pi
Password: raspberry
And once Linux has booted to the desktop open a terminal screen [ Ctrl + Alt + t ] and enter the following :
roscore
The roscore is now running and we are now ready to start the tutorials.
If you want some background on ROS commands and Syntax look to this Cheat Sheet for help.
or the ROS Start Guide .
Step 4: ROS Tutorials
We are going to go over how to publish a message to the roscore then subscribe to that message. This concept is the basics behind the ROS system which gives us a dynamic way to publish/receive data to control our robot projects and get data from them.
With roscore running in one terminal open another terminal and copy and paste
rosrun roscpp_tutorials talker
This should start publishing something like this
[ INFO] [1358365440.794845809]: hello world 0
[ INFO] [1358365440.895024702]: hello world 1
[ INFO] [1358365440.995006238]: hello world 2
[ INFO] [1358365441.095000473]: hello world 3
[ INFO] [1358365441.195000082]: hello world 4
Then open another terminal and copy and paste
rosrun roscpp_tutorials listener
This should output the same data that the first terminal is displaying
Now lets get an idea of what is happening inside the roscore by using rxgraph to display the nodes and messages that are running in our system. Open a new terminal then copy and paste
rxgraph
Now you should see the running nodes and their respective messages with arrows to point out there output orientation, if you select all topics in the window you can see all the topics that are published and subscribed within the roscore.
For more ROS tutorials check out the ROS Tutorials page.
Step 5: Conclusion
Hopefully with this tutorial you were able to install Linux and ROS on your Raspbery PI and get a basic idea of how ROS works. Here is a list of links that might help you get your robotic project running with ROS and Raspberry PI.
ROS and Arduino
Youtube Tutorials
Rosberry Pi Wiki
28 Comments
8 years ago on Step 2
I tried the install of Raspbian+ROS from Raspbian-ROS-full.img.7z file. Unfortunately the micro-SD card will not boot the Pi B+ with that. Card is OK as reimaging with Raspbian alone is OK for Pi boot. Any solutions or pointers?
Reply 7 years ago on Step 2
Hello
I am having the same problem have you found a solution for the raspberry pi b++ I can not seem to get the image to boot.
Reply 4 years ago
Hello, I seem to be facing a similar issue. How did you solve the problem ? My Pi3 B+ does not boot with this above image. I am connecting it via Ethernet to my desktop. Using an 8 GB SD card
6 years ago
Hi thanks for this tutorial it is very helpful and save lot of time, i am planing to bay raspberry pi zero, is this image work on raspberry pi zero???
6 years ago
In the ROS wiki instructions Installing ROS Indigo on the Raspberry Pi
(http://wiki.ros.org/ROSberryPi/Installing ROS Indigo on Raspberry Pi)
I kept getting a 'Permission denied' error
Something that really helped me was to change this line:
wget https://bootstrap.pypa.io/ez_setup.py -O – | python
To this:
sudo wget https://bootstrap.pypa.io/ez_setup.py -O – | sudo python
6 years ago
Does this work on a Pi3 Model B
Reply 6 years ago
I had success with the Indigo installation on Raspbian on the Pi 3 following these instructions:
http://wiki.ros.org/indigo/Installation/UbuntuARM
though it didn't install MoveIt successfully, or rViz - which apparently is a bit processor heavy for the Pi anyway
I have successfully activated OpenGL on the Pi3 though
And have it networking with some Arduino Chips running sensor inputs and motor outputs
I would like it to run a simulated real time model of the robot I'm building, but am thinking I may have to write my own lightweight code for that
Reply 6 years ago
Thank you for that link! I tried many links and was almost there when a coworker told me about another issue.
I am now waiting for an external HD so that I am not constantly writing to the SC card. Apparently that causes issues.
I am completely familiar with interfacing to external sensors but not using the ROS.
Reply 6 years ago
Which linux distribution did you install on the pi ?
7 years ago
keyboard not write, what can i do in this case???
Reply 6 years ago
wired USB keyboard?
7 years ago on Introduction
What is user and password?
8 years ago on Introduction
hello friend, I install image but it runs in my raspberry pi, what happens? thanks for your help.
Reply 8 years ago on Introduction
Does it run or not? What is your problem? I installed the image on two RPis. Together with my Ubunutu-ROS that I had earlier I have 3 ROS-nodes at all and everyone works fine!
8 years ago on Introduction
Hi! There were some problems when downloading the image. Chrome did not manage it. Both attempts failed near 30% of progress. Then I tried it with Opera - only 60% were done. Finally the Firefox got it very quickly from the first attempt. So try different browsers.
The image worked fine. I'm using Transcend 8Gb card.
For people who are wondering which versions of RPi and ROS are there:
RPi: 3.1.9+
ROS: Fuerte
Installed packages:
actionlib, actionlib_msgs,
cpp_common, diagnostic_msgs, geometry_msgs, message_filters, mk, nav_msgs, perf_roscpp,
rosbag, rosbash, rosboost_cfg, rosbuild, rosclean, rosconsole, roscpp, roscpp_serialization,
roscpp_traits, roscpp_tutorials, roscreate, rosgraph, rosgraph_msgs, roslang, roslaunch,
roslib, roslisp, rosmake, rosmaster, rosmsg, rosnode, rosout, rospack, rosparam,
rospy, rospy_tutorials, rosservice, rostest, rostime, rostopic, rosunit, roswtf,
rxbag, rxgraph, rxtools, sensor_msgs, std_msgs, std_srvs, stereo_msgs, test_crosspackage,
test_ros, test_rosbag, test_roscpp, test_roscpp_serialization, test_roscpp_serialization_perf,
test_roslib_comm, test_rospy, test_rosservice, test_rostime, topic_tools, trajectory_msgs,
turtlesim, visualization_msgs, wxPython_swig_interface, xdot, xmlrpcpp
Many thanks to you guys for the instruction!
8 years ago on Introduction
The raspberry pi Image link is not working
8 years ago
I'd been trying to connect a Kinect with the raspi through ROS but I'm not succeeding yet, I use the ROS that you posted here, do you know what libraries do I need and where can I find them?
Thanks a lot
Reply 8 years ago on Introduction
Use the OpenNI or Freenect stacks
http://wiki.ros.org/openni_kinect
http://wiki.ros.org/freenect_stack
8 years ago
Hello. I'm trying to install ROS groovy from source into a raspberry pi.
Could you tell me what kind of ROS is inside the image?
I'm look for desktop full install.
Sorry for my bad english.
9 years ago on Step 2
I can not get your image to boot, although I was able to get raspbian installed...but had problems getting ros setup on it :(
I'm using an 8 gb sd card (and as I've said, I have successfully put raspbian on it) on a model b raspberry pi. I wiped the card so it only had one partition, used win-32-imagewriter to write the image to the disk. There are 12 files on the card after writing on the 55.9 MB portion.
Could the fact that I have a raspberry pi model b be messing things up?