Install ROS Melodic on the Raspbian Buster native system of Raspberry Pi 4B (8G)

1. About the selection and installation of the Raspberry Pi operating system

It took a lot of time to install the Raspberry Pi system and the ros installation. In order to increase the comparison, I repeatedly installed the native system, ubuntu server18, ubuntu mate16, ubuntu mate18, ubuntu mate20 32-bit and 32-bit versions on my 3b+ and 4B respectively. 64 bits. . . Anyway, there are more boards and more cards.
Final conclusion: Raspberry Pi 3B+ uses ubuntu mate16/18 (32-bit), Raspberry Pi 4B uses ubuntu mate20 (32-bit and 64-bit both). Note that Raspberry Pi 4B can only use the mate20 version, and the previous ones will not work.

2. Install ROS on Raspbian Buster system

Who told me that the native system of Raspberry Pi is not easy to install ubuntu? ? ? So I switched to ubuntu without trying. In short, after a day of tossing on ubuntu, I still failed to install it. The third part will explain. Then I tried to install it on the Raspbian system. I found a few blogs and found that they were similar, basically the same as the tutorials on the official website. So I installed it directly according to the official website tutorial, and it was successful once? ! Sure enough, practice brings true knowledge. The following steps are basically based on the official tutorial. I suggest you look at the official website directly. The foreigner's writing is indeed detailed and reliable.

  1. Log in to the official website of the Raspberry Pi system to install ros . as the picture shows
    Insert picture description here

  2. Choose whether to install kinetic or Melodic, just click into it. My choice is Melodic.

  3. Add software source, add key

$ 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://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

I directly use the ros official website here, and the installation is normal. If the installation process can be replaced with slower domestic mirroring try, the official website can also find other Mirror Mirrors

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
  1. Update
$ sudo apt-get update
$ sudo apt-get upgrade
  1. Installation dependencies (the process is a bit longer, you will install them all by yourself)
$ sudo apt install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake
  1. Initialize rosdep
$ sudo rosdep init
$ rosdep update

This step is a big pit, and many people will fall here. The fundamental reason is that the website raw.githubusercontent.com cannot be accessed in China. . Refer to this blog to solve the problem perfectly.

  1. Create ros workspace
$ mkdir -p ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
  1. Download the package (note that the Rsspbian system uses the source code to install ros).
    The official here gives two solutions, one is the recommended general installation (ROS-Comm), there is no GUI TOOLS, and many packages are not available, including turtlesim. One is Desktop. I tried both and can install it. It is recommended to install the Desktop version, which is the full version.
    Insert picture description here

ROS-Common version

$ rosinstall_generator ros_comm --rosdistro melodic --deps --wet-only --tar > melodic-ros_comm-wet.rosinstall
$ wstool init src melodic-ros_comm-wet.rosinstall

Desktop version

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

After executing the above command, all ros packages will be downloaded to the ~/ros_catkin_ws/src directory.

  1. Install rosdep dependencies
$ cd ~/ros_catkin_ws
$ rosdep install -y --from-paths src --ignore-src --rosdistro melodic -r --os=debian:buster

This command will traverse all ros packages under src and automatically install all dependencies.

  1. Compile and install
sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/melodic

Compile and install ros to /opt/ros/melodic, you can also change this directory, and the corresponding path when source is just fine.
After a long wait, it will be installed! ! !
11. Source the path of ROS.
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
Use this one if you use zsh.
echo "source /opt/ros/melodic/setup.zsh" >> ~/.zshrc
12.
Take a look at the successful startup and test the little turtle.
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
Here we use three terminals to open it. We recommend a terminal terminator, which is easier to use than the default one. It can be divided by frequency. sudo apt install terminator That's it.

3. UBUNTU MATE20.04 install ROS Noetic

I have not installed it using ubuntu installation. At first, I said that the software package could not be located. It turned out that the latest version of ROS Noetic must be installed for ubuntu20, and ROS Melodic cannot be installed. Later, there was always a dependency problem, which has not been solved yet.
Put it under the table for now and install it later.

Guess you like

Origin blog.csdn.net/qq_30267617/article/details/108252600