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.
According to the system version of the virtual machine (Ubuntu18.04), select ROS Melodic Morenia to install.
Next, select the platform, we can choose the Ubuntu platform.
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.
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 .
Find ros in the mirror list, then click the question mark after ros , be sure to click the question mark after ros , not ros.
After clicking, the ROS image usage help pops up , and there are also very detailed steps. Next we follow this step.
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.
Then click Software and Updates.
Then it will be downloaded from the source behind, select other, then select aliyun, and finally click to select the server.
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.
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.
The vim editor is used here for editing. If the vim editor is not installed, just install it.
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
Then follow the instructions.
To do it step by step.
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
Here we execute the code to install the full desktop version.
After execution, as shown in the figure below.
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.
2.5 Configure and activate environment variables
Next, configure the environment variables and follow the tutorial step by step.
First execute the first line of commands in the tutorial to add environment variables.
After the addition is complete, we can use vim to view the bashrc file to see if the addition is successful.
The newly added environment variable is on the last line of the file. As you can see, the addition was successful.
Then enter the second line of commands in the tutorial to make it take effect.
2.6 Build Package Dependencies
The next step is to build the package dependencies.
Begin by executing the first paragraph of commands in the tutorial.
Then execute the second command.
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.
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
.
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.
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.
If the above commands can be run, it proves that ROS has been installed successfully.