[LINUX] I tried to move ROS (Melodic) with the first Raspberry Pi (Stretch) at the beginning of 2021

Introduction

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)

Download OS image for Raspberry Pi Zero with ROS

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

Fix for the first Raspberry Pi

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.

Furthermore, for those who cannot control their impulsivity ...

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.

Additional work before initializing rosdep

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

in conclusion

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

I tried to move ROS (Melodic) with the first Raspberry Pi (Stretch) at the beginning of 2021
I tried to automate the watering of the planter with Raspberry Pi
I tried to build an environment of Ubuntu 20.04 LTS + ROS2 with Raspberry Pi 4
When I tried to do socket communication with Raspberry Pi, the protocol was different
I tried to find the entropy of the image with python
I tried running Movidius NCS with python of Raspberry Pi3
I tried using the DS18B20 temperature sensor with Raspberry Pi
I sent the data of Raspberry Pi to GCP (free)
I tried to move the ball
I tried to automatically post to ChatWork at the time of deployment with fabric and ChatWork Api
I wanted to run the motor with Raspberry Pi, so I tried using Waveshare's Motor Driver Board
I want to output the beginning of the next month with Python
I tried to expand the size of the logical volume with LVM
I tried to improve the efficiency of daily work with Python
I tried to estimate the pi stochastically
I tried to solve the first question of the University of Tokyo 2019 math entrance exam with python sympy
I tried to get the authentication code of Qiita API with Python.
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
I tried to automatically extract the movements of PES players with software
I tried to analyze the negativeness of Nono Morikubo. [Compare with Posipa]
I tried to streamline the standard role of new employees with Python
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I tried to get the movie information of TMDb API with Python
I tried to predict the behavior of the new coronavirus with the SEIR model.
I made an npm package to get the ID of the IC card with Raspberry Pi and PaSoRi
I tried to move GAN (mnist) with keras
I tried to save the data with discord
I tried to find 100 million digits of pi
I tried L-Chika with Raspberry Pi 4 (Python edition)
I tried to touch the API of ebay
I tried to correct the keystone of the image
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
I tweeted the illuminance of the room with Raspberry Pi, Arduino and optical sensor
I tried to easily visualize the tweets of JAWS DAYS 2017 with Python + ELK
I tried to create a button for Slack with Raspberry Pi + Tact Switch
The story of making soracom_exporter (I tried to monitor SORACOM Air with Prometheus)
I tried to create a model with the sample of Amazon SageMaker Autopilot
I tried to automatically send the literature of the new coronavirus to LINE with Python
I tried to learn the sin function with chainer
I got an error when I put opencv in python3 with Raspberry Pi [Remedy]
Raspberry Pi backup
Put matplotlib in Centos7.
Put scipy in ec2
What is Raspberry Pi?
GPGPU with Raspberry Pi
Put jedi in emacs 24
pigpio on Raspberry pi
Raspberry Pi video camera
I tried to move ROS (Melodic) with the first Raspberry Pi (Stretch) at the beginning of 2021
Raspberry Pi Bad Knowledge
Let's do Raspberry Pi?
Put pip in Blender
DigitalSignage with Raspberry Pi
Raspberry Pi 4 setup memo
Cython on Raspberry Pi
Raspberry Pi system monitoring
Change the message displayed when logging in to Raspberry Pi
I tried to move machine learning (ObjectDetection) with TouchDesigner
I tried to extract features with SIFT of OpenCV
I tried to move Faster R-CNN quickly with pytorch
I tried to summarize the basic form of GPLVM
Try to visualize the room with Raspberry Pi, part 1
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
Take the value of SwitchBot thermo-hygrometer with Raspberry Pi
Log the value of SwitchBot thermo-hygrometer with Raspberry Pi
I tried to visualize the spacha information of VTuber
I tried to erase the negative part of Meros
I tried to solve the problem with Python Vol.1
I tried to classify the voices of voice actors
I tried to summarize the string operations of Python
I tried to make something like a chatbot with the Seq2Seq model of TensorFlow
I tried to put out the frequent word ranking of LINE talk with Python
I tried to automate the article update of Livedoor blog with Python and selenium.
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
[First data science ⑥] I tried to visualize the market price of restaurants in Tokyo
I tried to visualize the running data of the racing game (Assetto Corsa) with Plotly