Install different versions of ubuntu system in Linux

1 Virtual machine installation

Go to the official website to download the virtual machine Virtual Box or go to the official website to download the virtual machine VM ware

Of course, if you already have your virtual machine, you can skip this step.

We chose to download Virtual box because it is free.

2 New Virtual Machine

2.1 Create virtual machine

Select New in Control

Enter the name and storage location of the virtual machine, select Linux as the virtual machine type, and select the ubuntu 64 bit version to proceed to the next step.

Configure the memory size according to your own requirements and proceed to the next step.

Select Create Virtual Hard Disk to create it.

Select the VDI type for the virtual hard disk type and proceed to the next step.

To allocate the size of the virtual hard disk, since the ubuntu system needs to be installed and will operate in the system, it is recommended that the size should not be less than 20G.

2.2 Import ubuntu system

2.2.1 Download the ubuntu system.

Please select the ubuntu version to install according to your needs

The installation methods and procedures for the three versions are the same. Here, version 18.04 is used as an example

After downloading, there is a file as shown in the figure:

2.2.2 Import ubuntu into the virtual machine

Find the previously installed virtual machine in the Virtual box, enter Settings, and assign a CD to the controller in Storage:

Then open the virtual machine for ubuntu installation, and click Start.

2.2.3 ubuntu Installation

Wait for the system to start, enter the welcome interface, select "Chinese (Simplified)", and click the "Install Ubuntu" button;

Click the "Continue" button;

Select the option "Clear the entire disk and install Ubuntu", and click the "Install Now" button;

Click "Continue" in the pop-up dialog box;

Set the geographical location and click the "Continue" button;

Set the user name and password, and click the "Continue" button;

Please wait patiently when entering the system installation interface;

After the installation is completed, click the "Restart Now" button in the pop-up dialog box to complete the installation.

Environment installation

1 ROS environment construction

1.1 ROS installation

The basic development environment needs to install the robot operating system ROS, MoveIt, and git version managers. The installation methods and processes are described below.

For ultraArm equipment, refer to the installation method and process described below.

1.1.1 Version selection

ROS and ubuntu have a one-to-one correspondence. Different versions of ubuntu correspond to different versions of ROS. See the following website for reference: http://wiki.ros.org/Distributions

  • Here is the ROS version supported by Ubuntu:
    • Ubuntu 16.04 / ROS Kinetic
    • Ubuntu 18.04 / ROS Melodic
    • Ubuntu 20.04 / ROS Noetic

Please install the corresponding ROS version according to the Ubuntu version you installed

If the version is different, the download will fail. Here we choose Ubuntu 18.04 as the system, and the corresponding ROS version is ROS Melodic

NOTE: At present, we do not provide any reference for installing ROS in Windows. If necessary, please refer to https://www.ros.org/install/

1.1.2 Start Installation

1 Add Source

There is no ROS software source in the Ubuntu software source list, so you need to configure the ROS software source to the software list repository before downloading ROS. Open a console terminal(shotcut Ctrl+Alt+T),enter the following command:

  • Official source:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  • If the download speed is slow, it is recommended to select a nearby image source to replace the above command. For example,like Tsinghua University:
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'

You will be asked to enter the user password, which is set when installing Ubuntu.

2 Set secret key

Configure public key,this step is to let the system confirm that our path is safe, so that there is no problem downloading files, otherwise they will be deleted immediately after downloading:

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

The execution results are shown as follows:

3 Installation

After adding a new software source, you need to update the software source list and open a console terminal(shotcutCtrl+Alt+T),enter the following command:

sudo apt-get update

Perform ROS installation and open a console terminal(shotcutCtrl+Alt+T),please select and enter the following commands according to your Ubuntu version:

# Ubuntu 16.04
sudo apt install ros-kinetic-desktop-full
# Ubuntu 18.04
sudo apt install ros-melodic-desktop-full
# Ubuntu 20.04
sudo apt install ros-noetic-desktop-full

It is recommended to install a complete ROS to prevent the loss of libraries and dependencies.

The installation process takes a long time and requires patience

  • If the following error message appears on the console terminal during installation, you need to replace the software source list in/etc/opt/sources.list.

  • Open a console terminal(shotcutCtrl+Alt+T),enter the following command:
sudo gedit /etc/apt/sources.list
  • Replace all official software sources in sources.list with the following Alibaba Cloud software sources:

Ubuntu 16.04 Version:

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

Ubuntu 18.04 Version:

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

Ubuntu 20.04 Version:

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

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

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

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

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  • After configuration, the contents of the sources.list file are shown below. Click Save and exit.

  • Update the software source list, and enter:
sudo apt-get update
  • Enter the command to install ROS at the console terminal:
# Ubuntu 16.04
sudo apt install ros-kinetic-desktop-full
# Ubuntu 18.04
sudo apt install ros-melodic-desktop-full
# Ubuntu 20.04
sudo apt install ros-noetic-desktop-full

The installation process takes a long time and requires patience

4 Configure ROS environment to system

rosdep allows you to easily install the source code you want to compile, or rely on the system required by some ROS core components,execute the following commands on the terminal in turn,open a console terminal(shotcutCtrl+Alt+T)

If your system does not have rosdep installed, use the command sudo apt install python-rosdep to install it

If the Ubuntu system you installed is version 20.04, please use the command sudo apt install python3-rosdep to install it, and then execute the rosdep initialization command.

Initialize rosdep

sudo rosdep init

If an error message appears, as shown in the following figure:

Resolvent: Modify the hosts file, enter the following command on the console terminal:

sudo gedit /etc/hosts

At the end of the file content, add the IP addresses of the following two web addresses for access:

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

After modification, execute the following at the console terminal:

sudo rosdep init
rosdep update

After initialization, to avoid the need to re validate the ROS function path every time the terminal window is closed, we can configure the path to the environment variable, so that the ROS function path will automatically become effective every time a new terminal is opened execute the following commands on the terminal in turn,open a console terminal(shotcutCtrl+Alt+T):

1.1.3 Setting the ros environment

Bash

Execute the following command:

# Ubuntu 16.04
# Add the ros environment to the environment variable of the current console
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
# Ubuntu 18.04
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# Ubuntu 20.04
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
Zsh

If zsh is used instead of bash, then:

# Ubuntu16.04
echo "source /opt/ros/kinetic/setup.bash" >> ~/.zshrc
# Ubuntu18.04
echo "source /opt/ros/melodic/setup.bash" >> ~/.zshrc
# Ubuntu20.04
echo "source /opt/ros/noetic/setup.bash" >> ~/.zshrc
source ~/.zshrc
Install ROS Additional Dependencies

Enter the following command on the terminal to install ROS additional dependencies, and open a console terminal(shotcutCtrl+Alt+T):

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

If your Unbutu system is version 20.04, please execute the following command to install it:

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
# Ubuntu 16.04
sudo apt install ros-kinetic-joint-state-publisher-gui
# Ubuntu 18.04 
sudo apt install ros-melodic-joint-state-publisher-gui
# Ubuntu 20.04 
sudo apt install ros-noetic-joint-state-publisher-gui

1.1.4 Verify Installation

To start the ROS system, you need a ROS Master, that is, a node manager. We can enter the score command at the terminal to start the ROS Master.

To verify the successful installation of ROS, open a console terminal(shotcutCtrl+Alt+T),execute the following commands on the terminal:

roscore

When the following interface is displayed, the ROS installation is successful

The roscore command starts a node manager, which is used for node management. In an ROS system, there is one and only one node, which is the prerequisite for running the ROS node. Therefore, the first step is to execute roscore before starting the ROS node.

For more detailed installation instructions, please refer to the official installation instructions at: http://wiki.ros.org/ROS/Installation

2 MoveIt Installation

MoveIt is a functional package of a series of mobile operations in ros, mainly including motion planning, collision detection, kinematics, 3D perception, operation control and other functions.

2.1 Update software source list

Open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window to update the software source list:

sudo apt-get update

2.2 Install MoveIt

Open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window to install MoveIt:

# Ubuntu16.04
sudo apt-get install ros-kinetic-moveit
# Ubuntu 18.04
sudo apt-get install ros-melodic-moveit
# Ubuntu20.04
sudo apt-get install ros-noetic-moveit

3 git Installation

3.1 Add Software Source

Add the software source installed by git to the software source list of ubuntu,open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window:

sudo add-apt-repository ppa:git-core/ppa

3.2 Update software source list

open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window to update software source list:

sudo apt-get update

3.3 Install git

open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window,perform git installation:

sudo apt-get install git

3.4 Verify Installation

Read git version,open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window:

git --version

The git version number can be displayed on the terminal, as shown below, indicating that the installation is successful

3.5 Use

The git is required for subsequent downloading of the ros package. Please refer to the following link for the use of git:

4 mycobot_ros Installation

mycobot_ros is an ROS package launched by Elephant Robotics, which is suitable for desktop three-axis, four-axis and six axis mechanical arms.

Project address:http://github.com/elephantrobotics/mycobot_ros

4.1 Premise

Before installing the package, make sure you have the ros workspace.

Here we give a sample command for creating a workspace,open a console terminal(shotcutCtrl+Alt+T),enter the following command in the terminal window:

mkdir -p ~/catkin_ws/src  # Create folder
cd ~/catkin_ws/src        # Enter folder
catkin_init_workspace     # Initialize the current directory as an ROS workspace
cd ..                     # Return to the parent directory
catkin_make               # Build the code in the workspace.

Add an environment for a workspace

Bash

In the following,<ros workspace>will be used to refer to the workspace path of ROS in your computer. Please ensure that you replace<ros workspace>with the real path of your computer when executing the following command.

Correct example: echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

# Ubuntu 16.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.bashrc
# Ubuntu 18.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.bashrc
# Ubuntu 20.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
Zsh

If zsh is used instead of bash, then:

# Ubuntu16.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.zshrc
# Ubuntu18.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.zshrc
# Ubuntu20.04
echo "source ~/<ros-workspace>/devel/setup.bash" >> ~/.zshrc
source ~/.zshrc

4.2 Installation

NOTE:

  • This package depends on ROS and MoveIT. Before use, ensure that ROS and MoveIT are successfully installed.
  • The interaction between this package and the real mechanical arm depends on Python Api - pymycobot
  • Api project location:https://github.com/elephantrobotics/pymycobot
  • Quick installation:pip install pymycobot --upgrade

    When executing the command pip install pymycobot -- upgrade, an error message as shown in the following figure appears:

    At the prompt, enter the following command to install pip

    sudo apt install python-pip
    
  • If your Ubuntu system is version 20.04, please execute the command sudo apt install python3 pip to install pip. After the pip installation is completed, the terminal will execute again

    pip install pymycobot --upgrade
    
  • The installation method depends on Git. Please ensure that Git is installed on your computer.

In the following,<ros workspace>will be used to refer to the workspace path of ROS in your computer. Please ensure that you replace<ros workspace>with the real path of your computer when executing the following command.

cd ~/<ros-workspace>/src  # Enter the src folder in the workspace
# Cloning code on github
git clone https://github.com/elephantrobotics/mycobot_ros.git
cd ..       # Back to Workspace
catkin_make # Building code in the workspace
source devel/setup.bash # Add environment variable

So far, the ROS environment has been built.

results matching ""

    No results matching ""