2.ROS2 install Foxy

 

1. Set the language environment

Please first check whether the local language environment supports UTF-8 encoding. You can call the following command to check and set UTF-8 encoding.

Note: The locale can be different, but must support UTF-8 encoding

 

2. Set software source

Start the Ubuntu universe repository

Add the ROS 2 apt repository to the system and authorize our GPG key with apt

Add repository to sources list

 

3. Install Foxy

First update the apt repository cache:

Then upgrade the installed software (ROS2 packages are built on Ubuntu systems which are frequently updated, please make sure your system is up to date before installing new packages):

Install the desktop version of ROS2 (recommended), including: ROS, RViz, examples and tutorials. The installation command is as follows:

Install colcon build tools

 

4. Configure environment

Under the terminal, when executing the ROS2 program, you need to call the following command to configure the environment:

Every time you open a new terminal, you must execute the above command, or you can also execute the following command to write the configuration environment instructions into the "~/.bashrc" file. Then every time you start a new terminal, you do not need to manually configure the environment.

So far, ROS2 has been installed and configured.

 

5. About uninstallation

After ROS2 is installed, if you want to uninstall ROS2, you can execute the following command:

You can also delete the corresponding repository of ROS2: