Environment Building

1 Virtual machine installation

Notice: When installing the virtual machine system, please install the Ubuntu 20.04 version of the system, The installation method is consistent with ubuntu 18.04.

To install different versions of Ubuntu systems in Linux, please refer to the 6.1 ROS1 Environment building chapter for specific installation methods.

There are two options for virtual machine creation:

2 ROS2 Environment building

2.1 ROS2 installation

To build a basic development environment, you need to install the robot operating system ROS2 and the git version manager. The installation methods and processes are introduced below.

2.1.1 Selecting a version

There is a one-to-one relationship between ROS2 and ubuntu. Different versions of ubuntu correspond to different versions of ROS2. The reference website is as follows: http://docs.ros.org/en/foxy/Releases.html

Here are the ROS versions supported by Ubuntu:

ROS2 versionrelease dateMaintenance deadlineUbuntu version
FoxyJune 5, 2020May 2023Ubuntu 20.04(Focal Fossa)
GalacticMay 23, 2021November 2022Ubuntu 20.04(Focal Fossa)
HumbleMay 23, 2022May 2027Ubuntu 22.04(Jammy Jellyfish)

Install the ROS2 version corresponding to the Ubuntu version you have installed.

If the versions are different, the downloading will fail. The system we choose here is Ubuntu 20.04(recommend), so the corresponding ROS2 version is ROS2 Foxy.

NOTE: At present, we do not provide any reference for installing ROS in windows. If necessary, refer to http://docs.ros.org/en/foxy/Installation/Alternatives/Windows-Development-Setup.html

2.1.2 Start installation

1 Adding a software source

There is no ROS2 software source in the software source list of Ubuntu itself, so you need to Configure the ROS software source into the software list repository first, and then download ROS2. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command:

2 Setting a key

Configuring a public key. This step is to let the system confirm that our path is safe, so that there is no problem in downloading the file. Otherwise it will be deleted immediately after downloading:

3 Installation

After adding a new software source, you need to update the software source list. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command:

Execute Installing ROS2. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command according to your Ubuntu version:

The installation process takes a long time, so please wait with patience.

Refresh environment variables after installation is complete:

2.1.3 Set up the ros2 environment

In order to avoid re-validating the ROS2 function path every time the terminal window is closed, we can set the path to an environment variable, so that each time you open a new terminal, the ROS2 function path will automatically take effect. Execute the following commands in sequence in the terminal, and open a console terminal (shortcut key: Ctrl+Alt+T):

Execute the following command according to your Ubuntu version:

Then run:

Installing a ROS2 extra dependency

Input the following command in the terminal to install a ROS2 extra dependency, and open a console terminal (shortcut key: Ctrl+Alt+T):

2.1.4 Verify installation

To verify whether ROS2 has been installed successfully, open a console terminal (shortcut key: Ctrl+Alt+T) and execute the following command in the terminal:

When the following interface is displayed, it means that ROS2 has been installed successfully.

img

2.2 git Installation

1 Updating the software source list

Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to update the software source list:

2 Installation git

Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to execute the installation of git:

3 Verify installation

Read the git version, open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window:

The git version number can be displayed in the terminal as follows, that is, the installation is successful.

img

2.3 mycobot_ros2 Installation

mycobot_ros2 is a ROS2 package launched by Elephant Robotics and applicable to its mycobot series of desktop six-axis robot arms.

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

1 Precondition

Before installing the package, make sure you have a ros2 workspace.

Here is an example command for creating a workspace. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command in the command line:

Add workspace environment

The official default ROS2 workspace is colcon_ws.

2 Installation

NOTE:

After the pip installation is complete, the terminal executes again

The official default ROS2 workspace is colcon_ws.

So far, the ROS2 environment construction has been completed.You can learn the basics of ROS2 or ROS2 use cases