RoArm-M2-S 10. Ubuntu 22.04 Install ROS2 Humble Tutorial
| ||
10. Ubuntu 22.04 Install ROS2 Humble Tutorial
This chapter of the tutorial is not recommended for newbies, we suggest that newbies use the image we made directly, refer to the first chapter of RoArm-M2-S 1. How to Install ROS2.
Different versions of Ubuntu correspond to different versions of ROS2, the ROS2 we installed here is the Humble version, so download the Ubuntu image of version 22.04. Download the Ubuntu22.04 image and install it on Oracle, the rest of this tutorial is done in the terminal on Ubuntu.
ROS2 Installation Method 2
By now, you may have installed Oracle VM VirtualBox following RoArm-M2-S 1. How to Install ROS2. Next, you can operate it by the steps below:
Install Ubuntu Image
-
In the left toolbar, click on "New".
-
Set the name, type to "Linux" and version to "Ubuntu (64-bit)" and click "Next".
-
You can set the "Base Memory" and "Processors" by yourself, I have set it as default here, then click "Next".
-
Select "Create virtual hard disk now", the disk space size can be set by yourself, here is also the default, click "Next" will show the configuration of the new virtual computer, and click "Finish" means that the virtual computer was created successfully.
-
Double-click the left column in the virtual computer just created to start, after the start will prompt "failed to start the virtual computer, you need to load the virtual CD-ROM to install the system", in the "CD-ROM drive" location to add the ubuntu22.04 image you downloaded, click Click "Mount and Retry Boot".
10.2 ROS 2 Humble Installation
10.2.1 Setting Source
You need to add the ROS 2 apt property to your system.
Please ensure Ubuntu Universe property is enabled:
sudo apt install software-properties-common sudo add-apt-repository universe
Add the following content and press "Ctrl+X" to save:
185.199.111.133 raw.githubusercontent.com 185.199.110.133 raw.githubusercontent.com 185.199.109.133 raw.githubusercontent.com 185.199.108.133 raw.githubusercontent.com 199.232.28.133 raw.githubusercontent.com 20.205.243.166 github.com
Now add the ROS 2 GPG key using apt:
sudo apt update && sudo apt install curl -y sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
Then add the storage library to your source list:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
10.2.2 Install ROS 2 Software Package
After setting the property, update the apt property cache:
sudo apt update
The ROS 2 packages are built on frequently updated Ubuntu systems. It is always recommended that you make sure your system is up-to-date before installing new packages:
sudo apt upgrade
Install ROS 2 Humble software package:
sudo apt install ros-humble-desktop
Install the compiler and other development tools for building ROS packages:
sudo apt install ros-dev-tools
Install net-tools, moveit2, foxglove, and uninstall moveit-servo:
sudo apt install net-tools sudo apt install ros-humble-moveit-* sudo apt install ros-humble-foxglove-bridge sudo apt autoremove ros-humble-moveit-servo-*
Add ROS 2 to the source startup script so that you don't need to open a new shell terminal each time to get the setup file:
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc source ~/.bashrc
For more details, you can refer to ROS 2 official document.
10.2.3 Install the Robotic Arm ROS2 Workspace Package
Install git tool:
sudo apt install git
Clone this project on GitHub:
git clone https://github.com/DUDULRX/roarm_ws_em0.git
10.2.4 Install Python3 Library
sudo apt install python3-pip cd ~/roarm_ws_em0 python3 -m pip install -r requirements.txt
10.3 Compile Robotic Arm ROS 2 Software Package
Each compilation is only possible under the workspace of the robotic arm ROS 2.
10.3.1 First-time Compilation
cd ~/roarm_ws_em0 sudo chmod +x build_first.sh . build_first.sh
The initial compilation process takes a long time, after the initial compilation through this time you can use the robot arm according to the content of the previous tutorial, in the compilation process, some packages with "stder output" can be ignored..
10.3.2 Subsequent Compilation and Use
Every time a change is made to a package's code, it needs to be recompiled before it can be used again.
cd ~/roarm_ws_em0 . build_common.sh
Only the compilation of the roarm-web-app functionality package has been modified:
cd ~/roarm_ws_em0 . build_roarm_web_app.sh
10.4 Ubuntu Open SSH Service
sudo apt update sudo apt install net-tools sudo apt install openssh-server sudo service ssh start
After that you can access this Ubuntu VM using other devices by connecting remotely via SSH.
RoArm-M2-S ROS2 Humble + Moveit2 Tutorial
- RoArm-M2-S 1. How to Install ROS2
- RoArm-M2-S 2. ROS2 Workspace Description
- RoArm-M2-S 3. Drive Nodes to Control Real-world Robotic Arm
- RoArm-M2-S 4. Drag-and-drop Interactions in Moveit2
- RoArm-M2-S 5. Control the Robotic Arm with Gamepad or Keyboard
- RoArm-M2-S 6. Using Foxglove for Web-Based Control
- RoArm-M2-S 7. Web Application Based on ROS2Web app
- RoArm-M2-S 8. Control Robotic Arm with Commands
- RoArm-M2-S 9. Combined Use
- RoArm-M2-S 10. Ubuntu 22.04 Install ROS2 Humble Tutorial