[PYTHON] Put ROS melodic in Raspberry Pi 4 / Buster

SS 192.png Qiitaに初投稿します。Ninagawa_Izumiです。なにかお役に立てれば。

things to do

Make ROS melodic work on Buster of Raspberry Pi 4. While referring to various places, I tried to describe it in an OK way if I keep typing shell commands anyway. I'm sure everyone can deploy the latest ROS environment as of January 2020.

What is ROS in the first place?

An open source platform aimed at promoting joint development of robot software on a global scale. Information such as sensors and actuators and simulators can be handled in an integrated manner.

Preparation / implementation environment

--Raspbian-Raspberry Pi 4 with Buster installed

How to install

Open LXTerminal etc., copy and paste the code line by line, and press the return key repeatedly. Below, the code part (text on a black background) is a shell script that you type in the terminal. Is your Raspberry Pi 4 running? Let's type in more and more!

Environmental check and library update

How to check debian version

python


cat /etc/debian_version 

Result example> 7.8

How to check the kernel version

python


uname -a

Result example> Linux raspberry 4.19.75-v71 + Honyara

Package list updates and package upgrades

python


sudo apt-get update
sudo apt-get upgrade

If you are in a hurry, you may skip this item. It takes a lot of time. $ sudo apt-get updateWill do it again later $ sudo apt-get upgradeWill take a long time to complete.

Introduce ROS-melodic

Reference URL) https://www.instructables.com/id/ROS-Melodic-on-Raspberry-Pi-4-RPLIDAR/ Reference URL) http://wiki.ros.org/melodic/Installation/Debian

Add repository

python


sudo sh -c 'echo "deb  http://packages.ros.org/ros/ubuntu  $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update

Install the required packages

python


sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential  cmake
sudo rosdep init
rosdep update

Create and move the ros_catkin_ws directory

python


mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws

Install ROS Desktop

python


rosinstall_generator desktop --rosdistro melodic --deps --wet-only --tar > melodic-desktop-wet.rosinstall
wstool init -j8 src melodic-desktop-wet.rosinstall

If the above installation stops prematurely, you can restart it with `` `$ wstool update -j4 -t src```.

Minor correction of dependencies

python


mkdir -p ~/ros_catkin_ws/external_src
cd ~/ros_catkin_ws/external_src
wget http://sourceforge.net/projects/assimp/files/assimp-3.1/assimp-3.1.1_no_test_models.zip/download -O assimp-3.1.1_no_test_models.zip
unzip assimp-3.1.1_no_test_models.zip
cd assimp-3.1.1
cmake .
make
sudo make install

Installation of OGRE for rviz

python


sudo apt-get install  libogre-1.9-dev

note

In the procedure explained in the reference URL, the file modification (boost :: posix_time :: milliseconds related) is instructed here, but it seems that it has already been modified by the package, so it is necessary as of January 2020 There is none.

Implementation of rosdep (it takes time here)

python


cd ~/ros_catkin_ws #20200226 Addendum
rosdep install --from-paths src --ignore-src --rosdistro melodic -y

Build and install (it takes more time here, about an hour?)

python


sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/melodic -j2
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

Reboot once.

python


sudo reboot

This completes the installation of ROS-melodic. If you can restart it, it's finally time to check the operation.

Launch roscore

python


roscore

roscore.png Thank you for your hard work! If you see a display like this, ROSCORE is working. Congratulations.

By the way, turtlesim is also an operation test

Open a new terminal that is different from the one you opened for roscore and do the following:

python


rosrun turtlesim turtlesim_node

You should see a window with a small turtle. turtlesim2.png

Open another terminal and do the following:

python


rosrun turtlesim turtle_teleop_key

If you activate this terminal and press the cursor key, you can operate the turtle in the previous window.

In addition, rqt_graph is also tested

python


rosrun rqt_graph

SS 193.png The relationship between NODE and TOPIC flow is visualized.

You can even use rviz

python


rviz

SS 194.png I feel the power of Raspberry Pi 4 when starting at a second speed.

in conclusion

How was it? Did you successfully introduce ROS-melodic? I have implemented this procedure twice and it has been successful, but if there is something that does not work, please share it in the comment section. In this state, it is still difficult to use, so in the environment at hand, various settings are made to make it convenient for development. I also found some tips on how to back up SD, so I hope I can introduce it in another entry.

[Qiita] SD card backup and SD card selection for Raspberry Pi (Mac)

Recommended Posts

Put ROS melodic in Raspberry Pi 4 / Buster
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