Go to Official website to download the virtual machine Virtual Box or go to Official website to download the virtual machine VMware.
Of course, if you already have your virtual machine, you may skip this step.
We chose to download the Virtual box because it is free.
Select Create in control
Select the ubuntu version according to your own needs and install it:
Note: ROS2 needs to download version 20.04.
The installation method and process of the three versions are the same. Here, we take the version 18.04 version for an example.
After the downloading is complete, there will be a file shown in the figure:
Find the previously installed virtual machine in the Virtual box, enter Setup, and assign a CD to the controller in Storage:
Then open the virtual machine for ubuntu installation, and click start.
Building a basic development environment requires the installation of the robot operating system (short for ROS), MoveIt and a git version manager. The installation methods and procedures are described respectively below.
For myCobot 280-M5 and myCobot 320-M5 devices, refer to the installation methods and procedures described below. For myCobot 280-PI and myCobot 320-PI devices, you only need to install the mycobot_ros installation package.
There is a one-to-one relationship between ROS and ubuntu. Different versions of ubuntu correspond to different versions of ROS. The reference website is as follows: http://wiki.ros.org/Distributions
Here are the ROS versions supported by Ubuntu:
Install the ROS 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 18.04, so the corresponding ROS version is ROS Melodic.
NOTE: At present, we do not provide any reference for installing ROS in windows. If necessary, refer to https://www.ros.org/install/
There is no ROS 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 ROS. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command:
xxxxxxxxxx
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
xxxxxxxxxx
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'
Here you will be asked to input a user password. Just input the user password set when Ubuntu is installed.
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:
xxxxxxxxxx
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
The execution result is displayed as follows:
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:
xxxxxxxxxx
sudo apt-get update
Execute Installing ROS. Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command according to your Ubuntu version:
xxxxxxxxxx
# 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 the complete ROS here to prevent the lack of libraries and dependencies.
The installation process takes a long time, so please wait with patience.
xxxxxxxxxx
sudo gedit /etc/apt/sources.list
Ubuntu 16.04 version:
xxxxxxxxxx
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:
xxxxxxxxxx
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:
xxxxxxxxxx
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 the configuration is complete, the contents of the sources.list file are as follows, click Save and Exit.
xxxxxxxxxx
sudo apt-get update
xxxxxxxxxx
# 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, so please wait with patience.
rosdep allows you to easily install the source codes you want to compile, or the system dependencies required by some ROS core components. Execute the following commands in sequence in the terminal, and open a console terminal (shortcut key: Ctrl+Alt+T).
If your system does not have rosdep installed, use the command sudo apt install python-rosdep
to install it.
If the system of the Ubuntu installed by you is version 20.04, use the command sudo apt install python3-rosdep
to it install. After completion, execute the rosdep initialization command.
initialize rosdep:
xxxxxxxxxx
sudo rosdep init
If the following error message appears:
Solution: Modify the hosts file and enter the following command in the console terminal:
xxxxxxxxxx
sudo gedit /etc/hosts
At the end of the file content, add the IP addresses of the following two URLs to access:
xxxxxxxxxx
199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com
After the modification is complete, execute in the console terminal:
xxxxxxxxxx
sudo rosdep init
rosdep update
After the initialization is completed, in order to avoid re-validating the ROS 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 ROS 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 commands:
xxxxxxxxxx
# Ubuntu 16.04
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
If you replace bash with zsh, then:
xxxxxxxxxx
# 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
Input the following command in the terminal to install a ROS extra dependency, and open a console terminal (shortcut key: Ctrl+Alt+T):
xxxxxxxxxx
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:
xxxxxxxxxx
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
The startup of the ROS system requires a ROS Master, that is, a node manager. We can input the roscore command in the terminal to start the ROS Master.
To verify whether ROS has been installed successfully, open a console terminal (shortcut key: Ctrl+Alt+T) and execute the following command in the terminal:
xxxxxxxxxx
roscore
When the following interface is displayed, it means that ROS has been installed successfully.
The roscore command starts a node manager, which is used for node management. In a ros system, there is and only one node manager, which is the prerequisite for the operation of the ros node, so before executing the start of the ros node, roscore needs to be executed in the first step.
For more detailed installation instructions, you can refer to the official installation instructions by visiting the website:: http://wiki.ros.org/ROS/Installation
MoveIt is the composition of a series of function packages for movement operations in ros, mainly including motion planning, collision detection, kinematics, 3D perception, operation control and other functions.
Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to update the software source list:
xxxxxxxxxx
sudo apt-get update
Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to execute the installation of MoveIt:
xxxxxxxxxx
# 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
Add the software source for installing git to the software source list of ubuntu, open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window:
xxxxxxxxxx
sudo add-apt-repository ppa:git-core/ppa
Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to update the software source list:
xxxxxxxxxx
sudo apt-get update
Open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window to execute the installation of git:
xxxxxxxxxx
sudo apt-get install git
Read the git version, open a console terminal (shortcut key: Ctrl+Alt+T) and input the following command on the terminal window:
xxxxxxxxxx
git --version
The git version number can be displayed in the terminal as follows, that is, the installation is successful.
During the subsequent downloading of the ros package, you need to use git. For the use of git, refer to the following link:
mycobot_ros
is a ROS package launched by Elephant Robotics and applicable to its mycobot series of desktop six-axis robot arms.
Project address: http://github.com/elephantrobotics/mycobot_ros
Before installing the package, make sure you have a ros 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:
xxxxxxxxxx
mkdir -p ~/catkin_ws/src # Create a folder
cd ~/catkin_ws/src # Enter the folder
catkin_init_workspace # Initialize the current directory into a ROS workspace
cd .. # Return to the parent directory
catkin_make # Build the code in the workspace
Add workspace environment
The official default ROS1 workspace is catkin_ws
.
xxxxxxxxxx
# Ubuntu 16.04
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
# Ubuntu 18.04
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
# Ubuntu 20.04
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
NOTE:
This package depends on ROS and MoveIT. Before using it, make sure that you have installed ROS and MoveIT successfully.
The interaction of this package with a real robot arm depends on PythonApi - pymycobot
.
The Api project location is: https://github.com/elephantrobotics/pymycobot
Quick installation: pip install pymycobot --upgrade
When executing the pip install pymycobot --upgrade command, if the following error message appears:
Enter the following command to install pip at the prompt
xxxxxxxxxx
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 complete, the terminal executes again
xxxxxxxxxx
pip install pymycobot --upgrade
The installation method depends on Git, so make sure that Git have been installed in your computer.
The official default ROS1 workspace is catkin_ws
.
xxxxxxxxxx
cd ~/catkin_ws/src # Enter the src folder of the workspace
# Clone the code on github
git clone https://github.com/elephantrobotics/mycobot_ros.git
cd .. # return to the workspace
catkin_make # Build the code in the workspace
source devel/setup.bash # add environment variables
The Raspberry Pi version comes with an Ubuntu (V-20.04) system and a built-in development environment, so you don’t need to build and manage it, Just update the mycobot_ros package.
mycobot_ros
is a ROS1 package launched by Elephant Robotics and applicable to its mycobot series of desktop six-axis robot arms.
ROS1 Project address: http://github.com/elephantrobotics/mycobot_ros
Robotic arm API driver library address: https://github.com/elephantrobotics/pymycobot
In order to ensure that users can use the latest official package in time (new users do not need to update), they can go to the /home/er/catkin_ws/src
folder through the file manager and open the console terminal (shortcut Ctrl+Alt+T ) , enter the following command to update:
xxxxxxxxxx
# Clone the code on github
cd ~/catkin_ws/src
git clone https://github.com/elephantrobotics/mycobot_ros.git # Please check the attention section below before deciding whether to execute this command
cd .. # Back to work area
catkin_make # Build the code in the workspace
source devel/setup.bash # add environment variable
Note: If the mycobot_ros
folder already exists in the /home/er/catkin_ws/src (equivalent to ~/catkin_ws/src)
directory, you need to delete the original mycobot_ros
before executing the above command. Among them, ubuntu in the directory path is the user name of the virtual machine. If it is inconsistent, please modify it.
So far, the ROS1 environment construction has been completed.Please refer to 13.1.3 Rviz Introduction and Use for the use of ROS1.