ROS noetic installation and problem solving and testing

0. Main reference:

Official installation
Official Chinese installation
Install ROS Noetic version in Ubuntu 20.04
Installing ROS robot operating system Noetic on Ubuntu 20.04
Gazebo problem repair of virtual machine running

1. Configure system software source

Open "software and update" and enter the "Ubuntu software" page. Universal, restricted and diverse are allowed, that is, check these three items, as shown in the figure below. After installing the Ubuntu system, these three items are allowed by default, but it's better to check them.

2. Add ROS software source

Open the terminal, enter the following instructions and add the official software source image of ROS:

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

3. Add key

Add a key using the following command:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

4. Install ROS

1. Use the following command to ensure that the software index is up-to-date:

sudo apt update

Install the full desktop version using the following command:

sudo apt install ros-noetic-desktop-full

5. Setting environment variables

Before use, the environment variables shall be configured, and the following instructions shall be input at the terminal:

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

6. Build package dependencies

So far, you have installed the software required to run the core ROS package. In order to create and manage your own ROS workspace, various tools and requirements are distributed separately. For example, rosinstall is a common command-line tool that enables you to easily download multiple source code trees of ROS packages with one command.
To install this tool and build additional dependencies for the ROS package, run:

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

6.1. Initialize rosdep

Before using many ROS tools, you need to initialize rosdep. Rosdep enables you to easily install system dependencies for the source code to be compiled and is necessary to run some core components in ROS. If you have not already installed rosdep, please follow the steps below.

sudo apt install python3-rosdep

6.2. Initialization of rosdep and problem solving

You can initialize rosdep with the following command

sudo rosdep init
rosdep update
6.2.1 initialization problem solving (refer to the original station B up: yenian west wind)

ERROR occurs when running sudo rosdep init:

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

You can download the osdep.zip file through the following link:
Link: https://pan.baidu.com/s/1RUtnTTYTvbMfmMAQPjsZYg Extraction code: edn1
In the download directory: unzip the rosdep.zip file to the / opt/rosdep directory

sudo unzip rosdep.zip -d /opt/rosdep
6.2.1.1 modify the contents of _init_.py file:
sudo gedit /usr/lib/python3/dist-packages/rosdistro/__init__.py

Place the left and right of line 68:

DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

Amend to read:

DEFAULT_INDEX_URL = 'file:///opt/rosdep/rosdistro/master/index-v4.yaml'
6.2.1.2 modify the contents of rep3.py file
sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py

Turn line 39 around:

REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'

Amend to read:

REP3_TARGETS_URL = 'file:///opt/rosdep/rosdistro/master/releases/targets.yaml'
6.2.1.3 modify the contents of source_list.py file
sudo gedit /usr/lib/python3/dist-packages/rosdep2/sources_list.py

Turn line 72 around:

DEFAULT_SOURCES_LIST_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'

Change to

DEFAULT_SOURCES_LIST_URL = 'file:///opt/rosdep/rosdistro/master/rosdep/sources.list.d/20-default.list'

At this point, the modification is completed and the installation can continue
function:

sudo rosdep init

appear:

Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

Continue running:

rosdep update

appear:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///opt/rosdep/rosdistro/master/rosdep/osx-homebrew.yaml
Hit file:///opt/rosdep/rosdistro/master/rosdep/base.yaml
Hit file:///opt/rosdep/rosdistro/master/rosdep/python.yaml
Hit file:///opt/rosdep/rosdistro/master/rosdep/ruby.yaml
Hit file:///opt/rosdep/rosdistro/master/releases/fuerte.yaml
Query rosdistro index file:///opt/rosdep/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/zobot/.ros/rosdep/sources.cache

So far, ROS installation is completed

7.ros test

You can enter the roscore command on the terminal to check that the distribution name of the installed ros is noetic and the version number is 1.15.7, as shown in the following figure

7.1 small turtle test

Open a terminal and enter the command: rosrun turnlesim turnlesim_node. You can see that the simulation interface of the little turtle has been opened. Open a new terminal and enter the command: rosrun turnlesim turnlesim_teleop_key. You can control the little turtle to move in the interface through the direction key of the keyboard, as shown in the figure below:

7.2 RVIZ test

Open a new terminal and start RVIZ. Before starting, confirm that the opened roscore is not closed

rviz

It can open the graphical interface, and it is normal if there is no error

7.2 Gazebo test

Open a new terminal and start Gazebo. Before starting, confirm that the opened roscore is not closed

gazebo

It can open the graphical interface, and it is normal if there is no error
Using the virtual machine may flash back, and the hardware acceleration function needs to be turned off
Gazebo problem repair of virtual machine running
To turn off the hardware acceleration function, refer to:

    echo "export SVGA_VGPU10=0" >> ~/.bashrc
    source ~/.bashrc

Tags: Linux Ubuntu Autonomous vehicles

Posted on Sat, 06 Nov 2021 02:28:48 -0400 by sanahoria