Ubuntu 18.0 based on VMware 04 system installation ROS

Posted by shadownet on Thu, 17 Feb 2022 01:19:13 +0100

Configuration preparation: ubuntu18 04

If you encounter other problems, please see some methods at the end of the article, or search by yourself.

Installation steps

First look WIK of ROS , with Chinese interface, select the appropriate version of the system and the method of ROS installation.

This is mainly for Ubuntu 18 04 installing ROS on virtual machine

Tip: please make sure it is a clean system, which will help you reduce the time you spend

When installing, you need to change the software source first. You can try Tsinghua and Alibaba. I put some here, and you can search by yourself

#Ali source
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#Tsinghua source
# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# Pre release software source, not recommended
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

Select one and copy the contents of the source file, and then add / etc / apt / source List file backup

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Then add / etc / apt / sources List file empty

#The first time you use root, you usually set the password first:
sudo passwd

#Switch to root
su root  

#Put sources List empty
echo ' ' > /etc/apt/sources.list

Finally, use vim to open sources List, paste the contents of the software source, and then update the software source (without vim installation)

su user name

sudo apt update

Next, follow the steps of wiki to install the desktop version and the full version (it is said to be the full version, but some things need to be downloaded by yourself later)

#The following two are the software sources of ros. You can try both

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

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

#Then add the key, which is also easy to fail
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

#Update the source again
sudo apt update

#Install below
sudo apt install ros-melodic-desktop-full

After waiting for a period of time, you can run the next step

sudo rosdep init

#If it fails, it is generally because the new system does not have Python rosdep. Execute the following steps before executing the above steps:
sudo apt-get install python-rosdep

After execution, follow the prompts

rosdep update

This step is where most people have problems. The reason for the problem is usually the timeout of accessing overseas networks. But I can't solve this problem by climbing the wall. I succeeded once before by changing the source. There are also ways to say that changing the mobile phone network can succeed, but I tried it is invalid, but in short, I know it is the problem of the network.

Finally find a quick and effective solution rosdep update solution

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

source ~/.bashrc

#An error appears, displaying / opt / ROS / melody / setup Bash does not exist

Some suggest to ignore it first, and some suggest to reinstall from sudo apt install ROS melody desktop full to repair it. I tried to reinstall and it worked.

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

If there are still problems, it is recommended to compare with the wiki of ROS. vmware can take snapshots to facilitate fallback.

Finally, test whether the installation is successful. Pay attention to the way of entering commands

#Press the tab key, and relevant commands will appear
ros

#Start master
roscore 

#Start turtle simulation node
rosrun turtlesim turtlesim_node 

#Start keyboard node
rosrun turtlesim turtle_teleop_key 

If you have any questions, please comment below.

Problem summary

ubuntu cannot be copied and pasted with win10 after installation

installpipi reports an error. Could not get lock / var / lib / dpkg / lock frontend

rosdep update solution

Topics: Linux Ubuntu ROS Autonomous vehicles