[super detail] raspberry pie 4B + Ubuntu 18 04.5 + ROS configuration installation tutorial


1, Install Ubuntu system

  1. Download Ubuntu system files
    Ubuntu's official website only matches versions 21 and 20, so I found Ubuntu 18 matching raspberry pie on the Internet 04.5 server version, click the link to download directly.
    Ubuntu Server 18.04.5 for Raspberry Pi 4 64-bit : http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.5-preinstalled-server-arm64+raspi3.img.xz

  2. System burning
    Burning is the official tool of raspberry pie. Click the link to download it directly.
    Install Raspberry Pi OS using Raspberry Pi Imager:
    (1) Format SD card

    (2) Mirror burning

    So far, we have burned the image into the SD card. Next, insert the SD card into the raspberry pie, connect the monitor and turn it on.
    (3) Install desktop
    After entering the system, you need to log in. The default user name and password are ubuntu. After successful login, you need to modify the password. Just follow the prompts.
    Use the ifconfig command to check whether the network is connected. At first, I connected to the campus network that needs authentication and login. As a result, the source change and refresh of the software package list has not been successful, and all kinds of source change can not be done. Later, I remembered that the campus network needs authentication and login to access the Internet. It was not solved until I found a router that has logged in to the campus network.
    Whether to change the source here depends on your personal choice. The default official website has a slow connection from China. You can also change it to a domestic mirror website. I use the default source. The following is the source change process, which can be skipped.

    First, back up the original sources List, and then edit it with your favorite editor. I use nano here

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    sudo nano /etc/apt/sources.list

    Put sources Replace the contents in the list with the file reference configuration contents of each open source image website
    Alibaba cloud open source image website
    Huawei cloud open source image website
    Netease open source mirror website
    Tsinghua open source mirror website
    Open source mirror website of China University of science and technology

    Finished changing sources List file, please run sudo apt get update to update the index to take effect

    sudo apt-get update

    Finally, install the Ubuntu desktop graphics environment

    sudo apt-get install ubuntu-desktop

    So far, our desktop has been installed. Restart the system and enter the desktop system

    sudo reboot

2, Install ROS

  1. Configuring the Ubuntu repository
    In the system settings, find the software and update and check the following items to allow them to be downloaded from the Internet.

  2. Add ROS software source

    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

    If the source has been changed, you need to add the corresponding ROS software source, as follows:

  3. add key

    sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
  4. Install ROS

    sudo apt-get update
    sudo apt-get install ros-melodic-desktop-full

    Attach the relationship between Ubuntu system and different versions of ros system

    Ubuntu versionROS version
    Ubuntu 20.04noetic
    Ubuntu 18.04melodic
    Ubuntu 16.04kinetic
    Ubuntu 14.04indigo

    If the following errors occur during installation, you can delete them

    # error
    E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
    #Execute the following command to solve the problem
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/dpkg/lock
  5. Initialize rosdep

    sudo rosdep init
    rosdep update #sudo cannot be added when entering this sentence, otherwise it will cause system confusion

    When inputting sudo rosdep init, an error appears: ERROR: cannot download default sources list from:
    With reference to the boss's blog, the problem can be solved:

  6. Setting environment variables

    echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
    source ~/.bashrc
  7. Install rosinstall

    sudo apt-get install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

    Display the robot model in rviz and pop up a small window that can control the joints. You need to install the following package

    sudo apt install ros-melodic-joint-state-publisher-gui
  8. Test whether the ROS installation is successful
    (1) Open terminal and enter the following command to initialize the ROS environment:


    (2) Open a new terminal and enter the following command to pop up a small turtle window, as shown in the figure below:

    rosrun turtlesim turtlesim_node

    (3) Open a new terminal and enter the following command to control the movement of the little turtle through the direction keys in terminal:

    rosrun turtlesim turtle_teleop_key

    (4) Open a new terminal, enter the following command, and a new window will pop up to view the ROS node information:

    rosrun rqt_graph rqt_graph

So far, ROS installation is completed.

3, Attach

  1. Windows remote desktop connection (mstsc)
    First install xrdp on raspberry pie

    sudo apt-get install xdrp

    Then enter ifconfig to view the raspberry pie networking


    Then use win+r to start running on the computer, enter mstsc and enter the IP address of raspberry pie

    Enter the user name and password of raspberry pie in the pop-up login interface. Generally, the default is ubuntu

Keywords: Linux Ubuntu Raspberry Pi Autonomous vehicles

Added by bestpricehost on Wed, 05 Jan 2022 10:17:27 +0200