UR manipulator learning: ROS environment installation

01 preparation

1.1 ros simple learning

Because I haven't been in touch with Ubuntu system before, I first learned the operation of ROS platform on the online platform.

1.2 Ubuntu system installation

Because I haven't contacted Ubuntu system, I chose virtual machine installation first. Installation process reference:

For dual system installation of Ubuntu, please refer to:

If there is a black edge after the virtual machine is installed, VMware Tools can be installed

1.2.1 VMware Tools installation process:

  1. Click VMware menu bar - virtual machine - install VMware Tools, and then the installation package will appear on the desktop, as shown in the following figure:
  2. Click to enter the installation package and put VMware to... Tar GZ copy to the directory where you want to install. Then right click the installation package under the installation target, select extract here, and decompress the compressed package
  3. Enter the extracted VMware Tools District folder, and then open the terminal here (right click to open it in the terminal)
  4. Enter sudo/ vmware-install. PL, enter the user password, enter y when determining the installation, and then enter all by default
  5. After installation, the interface can adapt to the window

1.2.2 the virtual machine cannot access the Internet

In the VMware interface, right-click virtual machine - select settings
Press the following settings, and then restart the client to access the Internet

02 installing ROS

Official tutorial for ROS installation: http://wiki.ros.org/melodic/Installation/Ubuntu

The installation process mainly refers to:

2.1 Ubuntu environment configuration

  1. Click "show application" in the lower left corner to search for "software and updates"
  2. Check the four items of Universe, restricted, multiverse and source code;
    Modify the download source to the domestic image (Alibaba cloud and China University of science and technology can both download the source, and the speed of the foreign source may be very slow)
    The specific settings are shown in the figure below:

2.2 add ROS download source and download key

  1. The official source may be used slowly in China. We can use the source of Tsinghua University or China University of science and technology and run one of the following commands:

❤ The source of China University of science and technology:

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

❤ Source of Tsinghua University:

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
  1. Add download key:
    If you encounter problems connecting to the server, the middle hkp://keyserver.ubuntu.com:80 Line can be replaced with: hkp://ha.pool.sks-keyservers.net:80 Or hkp://pgp.mit.edu:80
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# Spare 1
sudo apt-key adv --keyserver 'hkp://ha.pool.sks-keyservers.net:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# Spare 2
sudo apt-key adv --keyserver 'hkp://pgp.mit.edu:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

2.3 installing ROS

  1. First update the system:
sudo apt update
  1. If you want to learn ROS, it is generally recommended to install desktop full.
    It includes ROS, rqt, rviz, 2D / 3D simulation and 2D/3D perception. It is relatively comprehensive, otherwise many libraries will be prompted to be missing in the development process.
sudo apt install ros-melodic-desktop-full

In addition to the above installation methods, you can also install according to the following methods:

  • Desktop, however, is relatively incomplete. It only includes ROS, rqt, rviz and other commonly used libraries. If the demand for ros is not great, you can install this version.
sudo apt install ros-melodic-desktop
  • ROS base, this version only contains some basic ROS things without GUI tools. It is recommended to install this for airborne processor, which saves space
sudo apt install ros-melodic-ros-base
  • Separate packages can be installed in this way if a package is missing or needs to be added
sudo apt install ros-melodic-slam-gmapping
  • In addition, you can view and install the package through the following command
apt search ros-melodic

2.4 configuring ROS

  1. Initialize rosdep
    Initializing rosdep is a necessary step before using ROS. It can install some system dependencies for you when compiling some source code, and it is also a tool that must be used by some ROS core functional components.
sudo rosdep init
rosdep update
  1. ROS environment configuration
    The environment configuration of ROS enables you to automatically configure the environment variables of ROS every time you open a new terminal, that is, add them to the bash session, because the command source / opt / ROS / kinetic / setup Bash only works on the current terminal, that is, it has a single timeliness. If you want to open a new terminal every time without reconfiguring the environment, you can add the command to the bash session with echo statement.
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. Install rosinstall and other dependencies
    rosinstall is an independent and commonly used command line tool in ROS. It allows you to download many source trees for a ROS package through one command.
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

2.5 test ROS

  1. First, start ROS, enter the code at a terminal and run roscore:
roscore
  1. Open another terminal and enter:
rosrun turtlesim turtlesim_node
  1. Open the third terminal and enter:
rosrun turtlesim turtle_teleop_key

This will see a pop-up window with a little turtle. You can control the movement of the little turtle through the up, down, left and right keys on the keyboard. This indicates that your ROS is successfully installed and functioning.
(Note: the keyboard can control the little turtle normally only when the mouse stays at the third open terminal)

03 summary of the above commands

1. Add software source

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

2. Add secret key

sudo apt-key adv --keyserver 'hkp://ha.pool.sks-keyservers.net:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3. Install ROS

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

4. Initialize rosdep

sudo rosdep init
rosdep update

5. Configuration environment

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

6. Install rosinstall

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

6. Test whether ROS is installed successfully (run the little turtle)

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

Keywords: ROS

Added by raven2009 on Wed, 02 Feb 2022 00:56:41 +0200