How To Install ROS Melodic in Ubuntu 18.04

References:

Ubuntu18.04 installs ROS Melodic (detailed, the pro-test installation is completed, there are clear screenshot steps)
zero-based learning ROS robot operating system
ROS.org
Tsinghua University open source software mirror station


1. Installation environment

Host system: Win10
Virtual machine software: VMware 15.5
Virtual machine system: Ubuntu18.04

2. Install ROS

This blog is mainly installed according to the steps in the ROS wiki official website.

Let me say in advance, don't just look at this blog to install, please open ROSwiki and Tsinghua University Open Source Software Mirror Site , and then follow this blog to install. Because the official installation tutorial has been updated, the command line of this blog may still be available in 2021, but it will not be available in a few years or even a few months, so please mainly refer to the official tutorial.

2.0 Select ROS version

First open the official website of ROSwiki . Click Install.
insert image description here
According to the system version of the virtual machine (Ubuntu18.04), select ROS Melodic Morenia to install.

insert image description here
Next, select the platform, we can choose the Ubuntu platform.
insert image description here

The pop-up URL gives all the steps required for the installation . Next, this blog will follow the steps in the URL to install it step by step.

2.1 to 2.3 Replace the official website installation source with Tsinghua mirror

Since some URLs in the tutorial are blocked, in order to solve this problem, the installation steps of this blog and the installation steps of the official website will be slightly different in details.
insert image description here
In the installation step 1.2 given by the official website, the URL is blocked, so we choose to use the URL in the open source software mirror site of Tsinghua University instead.

Open the Tsinghua University Open Source Software Mirror Site .
insert image description here
Find ros in the mirror list, then click the question mark after ros , be sure to click the question mark after ros , not ros.
insert image description here
After clicking, the ROS image usage help pops up , and there are also very detailed steps. Next we follow this step.
insert image description here
Before the official operation, if your Ubuntu has not replaced the software installation source, please follow the steps below. If you have replaced it, please skip it.

2.1.1 Ubuntu Replacement Software Installation Source

Start by opening the Ubuntu software.
insert image description here
Then click Software and Updates.
insert image description here
Then it will be downloaded from the source behind, select other, then select aliyun, and finally click to select the server.

insert image description here
After selecting, exit the software and update, the system will prompt to update the cache, you can agree, after updating the cache, the software installation source will be replaced successfully.
insert image description here

2.1.2 Configure the ROS installation source with the help of the ROS image

Open the terminal, follow the first step in the ROS image usage help , and change the file content.
insert image description here

The vim editor is used here for editing. If the vim editor is not installed, just install it.
insert image description here
Copy and paste the content into the file, and then save the file. If you do not know how to operate vim, please refer to: Linux vi/vim command book
insert image description here
Then follow the instructions.
insert image description here
To do it step by step.
insert image description here
insert image description here
After the execution is completed and no error is reported, return to the official website tutorial of ROSwiki . You can find that we have completed steps 1.1 to 1.3 of the official website tutorial, and step 1.4 has opened a small head.

2.4 Install the full version of ROS desktop

insert image description here
Here we execute the code to install the full desktop version.
insert image description here
After execution, as shown in the figure below.
insert image description here
After executing the statement, if no error or any prompt is reported, the installation is successful.

Here is the first pit. Sometimes the above command is only executed once, and the installation cannot be completely installed, and the installation may even fail.

The solution is to execute this command several times until no error is reported. As shown in the figure below, the system prompts me 已经是最新版, indicating that the installation is successful.
insert image description here

2.5 Configure and activate environment variables

Next, configure the environment variables and follow the tutorial step by step.
insert image description here
First execute the first line of commands in the tutorial to add environment variables.
insert image description here
After the addition is complete, we can use vim to view the bashrc file to see if the addition is successful.
insert image description here
The newly added environment variable is on the last line of the file. As you can see, the addition was successful.
insert image description here
Then enter the second line of commands in the tutorial to make it take effect.
insert image description here

2.6 Build Package Dependencies

The next step is to build the package dependencies.
insert image description here
Begin by executing the first paragraph of commands in the tutorial.
insert image description here
Then execute the second command.
insert image description here
Then proceed to initialization. Let me tell you in advance, here is the second pit, the error phenomenon is the connection error of sudo rosdep init or rosdep update, please refer to this article for the solution: Solved: The solution to the connection error of sudo rosdep init or rosdep update

As shown in the figure below, although the initialization is successful, the update fails.
insert image description here
insert image description here
However, the impact of this problem is not particularly large. We will skip this problem here and directly check whether ROS is successfully installed.

3. Check if ROS is installed successfully

Here we use a classic routine to check whether ROS is installed successfully.

Enter first roscore.
insert image description here

Then open another terminal (shortcut key: Ctrl+Shift+T ) and enter rosrun turtlesim turtlesim_node. A window will pop up with a turtle in the middle of the window.
insert image description here
Then open another terminal (shortcut key: Ctrl+Shift+T ) and enter rosrun turtlesim turtle_teleop_key. At this time, according to the prompts in the window, you can drive the little turtle to move.
insert image description here
If the above commands can be run, it proves that ROS has been installed successfully.

Guess you like

Origin blog.csdn.net/mahoon411/article/details/119641517
Recommended