The ARM11-based Raspberry Pi
is still alive in the Zero series, and there have already been reports of successful installations of ROS
. [^ 1]
I thought that if it works with the Zero series, it could work with the Raspberry Pi Model B
(first generation Raspberry Pi) model, so I searched for an article on the net, but I can't find many reports here. It's just because the equipment is too old ...
So, when I actually tried it myself with reference to the case of Zero, I was able to install / operate the ROS core even with the first Raspberry Pi by changing the settings a little. It is the first Raspberry Pi that has already been treated as a product of the past in 2021, but for those who just want to roll it at home and decorate it, it is also a memorandum of work, and the installation procedure that you actually performed is easy. I will introduce you.
(Addition 2021/1/5) Fixed typographical errors, omission of file folder notation in launch.py, etc.
[^ 1]: How to install ROS (melodic) on Raspberry Pi + Raspbian (stretch)
For those who want to try Stretch + Melodic
quickly, there are people who have already distributed an image file of the OS with ROS Melodic installed on Raspbian Stretch for Raspberry Pi Zero, so first read the following article please confirm.
・ Installing ROS Melodic on Raspbian Stretch
(Added 2021/1/12) If you update with the downloaded image, a ROS authentication error will occur here as well, so please re-acquire the authentication key. The method is the same as described later.
$ sudo apt-key del F42ED6FEAB17C654
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
If you burn the ZIP image downloaded from the above site to an SD card of 4GB or more and start the first Raspberry Pi, Raspbian will start up smoothly. You can still use it if you just want to start a simple ROS node. However, ROSCORE started with Zero, but with the original Raspberry Pi, the process went down in the middle of starting.
The phenomenon that actually occurred is the same as Report case here. It happened because Python couldn't wait for ROSCORE to start and timed out.
For the solution, I referred to this article and this article. The specific work is shown below.
$ sudo nano /opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/launch.py
#_TIMEOUT_MASTER_START = 10.0 #seconds ###Comment out
_TIMEOUT_MASTER_START = 100.0 #seconds ###add to
Also, referring to this article, I restored the size of the swap file.
$ sudo nano /etc/dphys–swapfile
CONF_SWAPSIZE=100 ###add to
# CONF_SWAPSIZE=1024 ###Comment out
Save the file for the swap size change to take effect.
$ sudo /etc/init.d/dphys-swapfile stop
$ sudo /etc/init.d/dphys-swapfile start
$ free -m
With the above, you can get the environment where the core part (ROS Core) of ROS (Melodic) is installed in the first Raspberry Pi.
I don't think getting the environment in the above way to use ROS is practically different from installing ROS
on ubuntu
with apt-get
, but anyway. Then, for those who are curious to go through the steps themselves, here are some steps and commands that needed to be changed in order to proceed with the installation procedure introduced on the site introduced at the beginning. to introduce.
--Check the data of REP 3 (Target Platform) of Ros.org.
This is unexpectedly important information, and I would like to emphasize it in particular. Even if I follow the [Step-by-step procedure](Installing ROS Melodic on the Raspberry Pi) on ROS.org, it always fails because the article is old. It was useful information for thinking about the cause of work failure on the way, and it was like a compass to reach the end of the installation. I realized that working without knowledge of the combination of versions for each software was both reckless and a waste of time.
――The work takes almost half a day or more in total. In particular, it took several hours just to initialize rosdep (Initializing rosdep
). Do it when you have enough time. (Additional notes will be described later.)
--There was no trouble during the work even if the swap memory expansion (100 → 1024) was done when the OS was first started. After the installation work was completed, I restored it.
--In raspi-config
at the first startup, only SSH
can be used. If you connect with SSH from a Windows PC, you can work by copying and pasting the screen, which improves work efficiency.
--I didn't use overclocking this time. Other OS initial settings were not changed as much as possible, and the locale, language, and keyboard layout were not changed.
--The SD card used Micro SD
of 8GB
. [^ 2]
[^ 2]: In the olden days, new products were incredibly cheap (about 350 yen including tax). In my opinion, in OS experiments, the SD card drive is deleted, the partition is rebuilt, and the full format is redone, so to save time, keep the memory card as small as possible. I'm using.
It is the most time-consuming work, and if an error occurs in the middle, it is difficult to start over. Add the following work in advance, and try changing the command a little as follows.
$ sudo apt-key del F42ED6FEAB17C654
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
$ rosdep install --from-paths src --ignore-src --rosdistro melodic -y --skip-keys-"python-pycryptodome" --os=debian:stretch
The first two commands are for authentication key error countermeasures. I referred to the following article. -Key error during ROS melodic installation (NO_PUBKEY F42ED6FBAB17C654)
python-pycryptodome doesn't seem to have used by Melodic as standard on Stretch deb. There seems to be a way to install it with pip, but I referred to the following ROS Answer article and skipped the process. ・ Pycryptodome
Actually, this theme is one of the "hogaku" that I spent a lot of time researching and trying in 2020, but it didn't work. After all, the cause of the failure was that I was working without understanding the contents well, only relying on the procedures and experimental results written by others. So, even though I didn't know the existence of information related to "specifications" like REP 3
, I was fortunate to find it by chance by searching the Internet, and I greatly reflected on the method until last year.
Recommended Posts