![header](/IFRA-Cranfield/ros2_SimRealRobotControl/raw/humble/media/header.jpg)
IFRA (Intelligent Flexible Robotics and Assembly) Group
Centre for Robotics and Assembly
Cranfield University
Table of Contents
We are currently re-structuring the ros2_SimRealRobotControl repository, to provide a more intuitive usage of the ROS 2-based Robot Simulation and Control packages. Meanwhile, please open the following COMMIT (prior to the re-structuring phase): LINK
The new packages will be ready before AUGUST 2024. Do not hesitate to contact us if you have any questions, or if you are interested in using any particular robot arm, which could be added to this repository. Thanks!
The IFRA (Intelligent Flexible Robotics and Assembly) Group is part of the Centre for Robotics and Assembly at Cranfield University.
IFRA Group pushes technical boundaries. At IFRA we provide high tech automation & assembly solutions, and we support smart manufacturing with Smart Industry technologies and solutions. Flexible Manufacturing Systems (FMS) are a clear example. They can improve overall operations and throughput quality by adapting to real-time changes and situations, supporting and pushing the transition towards flexible, intelligent and responsive automation, which we continuously seek and support.
The IFRA Group undertakes innovative research to design, create and improve Intelligent, Responsive and Flexible automation & assembly solutions, and this series of GitHub repositories provide background information and resources of how these developments are supported.
SOCIAL MEDIA:
IFRA-Cranfield:
- YouTube: https://www.youtube.com/@IFRACranfield
- LinkedIn: https://www.linkedin.com/in/ifra-cranfield/
Centre for Robotics and Assembly:
- Instagram: https://www.instagram.com/cranfieldrobotics/
- Facebook: https://www.facebook.com/cranfieldunirobotics/
- YouTube: https://www.youtube.com/@CranfieldRobotics
- LinkedIn: https://www.linkedin.com/company/cranfieldrobotics/
- Website: https://www.cranfield.ac.uk/centres/centre-for-robotics-and-assembly
The ros2_SimRealRobotControl repository is a collection of ROS 2 packages that are designed to facilitate robot manipulation tasks. The packages include Gazebo Simulation, MoveIt!2, and Robot Bringup, all of which can be used to simulate and control robot manipulators.
The Gazebo Simulation package provides a simulation environment for robot manipulators, allowing users to test and develop control algorithms in a virtual environment before deploying them on a physical robot. MoveIt!2 is a motion planning framework that allows users to plan and execute robot manipulator trajectories, while the Robot Bringup package provides the interface for controlling the physical robot.
By combining these packages, the repository offers a comprehensive solution for developing and testing robot manipulator applications using ROS2. This can be particularly useful for researchers and engineers who are working on robotics projects, as it can significantly reduce the time and resources required for development and testing.
Improvements: ros2_RobotSimulation -> ros2_SimRealRobotControl:
On October 2022, IFRA-Cranfield released ros2_RobotSimulation, a GitHub repository containing "ready-to-use" ROS2 Industrial Robot Simulation packages, that consist of Gazebo (simulation) + MoveIt!2 (control) package combinations for some supported Industrial/Collaborative Robots (or Robot + Gripper combinations), and follows a common standard for a better understanding and further development.
This ros2_SimRealRobotControl repository is based on ros2_RobotSimulation, and contains some improvements and advanced features:
- Robot Bringup packages, that enable the control of REAL ROBOTS through ROS 2.
- The Pilz Industrial Motion Planner, which replaces the OMPL planner (MoveIt!2 default) used in ros2_RobotSimulation and allows for advanced motion control and features, such as cartesian speed control.
- In ros2_RobotSimulation, Robot Movements are triggered as individual ROS 2 Actions, each of them contained in a ROS 2 node. When executing Robot Programs (sequences) using ros2_execution, Robot Movements (execution steps) are executed by calling ROS 2 actions one by one. This introduces a small delay between steps. For ros2_SimRealRobotControl, all Robot Movements are contained in a single ROS 2 Action (therefore, a single ROS 2 node), and sequences are executed by calling a single ROS 2 Action from a python script. Thus, the delay introduced by ROS 2 Action calls is avoided, and the delay between movements now only depends on MoveIt!2's processing (plan+execute) time. Quicker and smoother results are obtained, closing the performance gap between ROS2-controlled robots and Industrial Manipulators.
- Improved simulation of object grasping: The new IFRA_LinkAttacher ROS2-Gazebo plugin developed by IFRA-Cranfield is used in ros2_SimRealRobotControl. This new plugin is more precise and works better than ros2_grasping in ros2_RobotSimulation.
In a nutshell, ros2_RobotSimulation is a great tool if you are new to ROS 2 and you wish to use it for Robot Simulation and Control, and ros2_SimRealRobotControl is appropriate for anyone willing to design, develop and test their own Robot applications using the ROS 2 packages (Gazebo+MoveIt!2+Bringup) provided.
VIDEO: Simulation and Control of an ABB-IRB120 using ROS2
VIDEO: Simulation and Control of a Universal Robots - UR3 using ROS2
All packages in this repository have been developed, executed and tested in a Ubuntu 22.04 machine with ROS 2 Humble. Please find below all the required steps to set-up a ROS 2 Humble environment in Ubuntu and install the ROS 2-based Robot Simulation and Control packages.
-
Set-up the Ubuntu+ROS2 PC for the Robot Simulation and Control: The steps below need to be followed in order to set-up a proper ROS2 (Humble) workspace for Robot Simulation and Control, and to be able to use ros2_SimRealRobotControl:
(1.1) Install Ubuntu 22.04: https://ubuntu.com/desktop
(1.2) Install Git:
# In the terminal shell: sudo apt install git # Git account configuration: git config --global user.name YourUsername git config --global user.email YourEmail git config --global color.ui true git config --global core.editor code --wait # Visual Studio Code is recommended. git config --global credential.helper store
(1.3) Install ROS2 Humble:
- Follow instructions in: ROS2 Humble Tutorials - Installation.
- Source the ROS2.0 Humble installation in the .bashrc file (hidden file in /home):
source opt/ros/humble/setup.bash
(1.4) Install MoveIt!2 for ROS2 Humble (REF: MoveIt!2 Website):
# Command for BINARY INSTALL (recommended): sudo apt install ros-humble-moveit
A small improvement of the move_group_interface.h file has been developed in order to execute the Robot/Gripper triggers in this repository. Both the upgraded file and the instructions of how to implement it can be found here: move_group_interface_improved.h
(1.5) Create and configure the ROS2.0 Humble ~/dev_ws environment/workspace:
- Follow instructions in: ROS2 Humble Tutorials - Create a ROS2 Workspace.
- Source the ~/dev_ws workspace in .bashrc file:
source ~/dev_ws/install/local_setup.bash
(1.6) Install ROS2 packages, which are required for ROS2-based Robot Simulation and Control:
# ROS2 Control + ROS2 Controllers: sudo apt install ros-humble-ros2-control sudo apt install ros-humble-ros2-controllers sudo apt install ros-humble-gripper-controllers # Gazebo for ROS2 Humble: sudo apt install gazebo sudo apt install ros-humble-gazebo-ros2-control sudo apt install ros-humble-gazebo-ros-pkgs # xacro: sudo apt install ros-humble-xacro # Fix cycle time issues in humble-moveit (temporary fix): sudo apt install ros-humble-rmw-cyclonedds-cpp # (+) Add into .bashrc file -> export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
(EXTRA STEP) -> Due to problems with URDF file processing for the newest version of ROS 2 Control-Gazebo plugin, Gazebo-ROS2-Control must be downgraded to the 0.4.6 version:
# Uninstall Gazebo ROS2 Control: sudo apt remove ros-humble-gazebo-ros2-control # Download and install the 0.4.6 version: cd ~/dev_ws/src git clone https://github.com/ros-controls/gazebo_ros2_control.git cd gazebo_ros2_control git reset --hard 9a3736c # Commit for the 0.4.6 version! cd ~/dev_ws colcon build
-
ABB DRIVER for ROS 2: The installation of the abb_ros2 driver is required for the control of any real ABB robot using ROS 2.
mkdir -p ~/dev_ws/src/ABBDriver cd ~/dev_ws/src/ABBDriver git clone https://github.com/PickNikRobotics/abb_ros2.git -b rolling sudo rosdep init rosdep update vcs import < abb_ros2/abb.repos rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y cd ~/dev_ws colcon build
-
Universal Robots ROS2 Driver: The installation of the ur-robot-driver driver is required for the control of any real UR robot using ROS 2. Binary install, for ROS2 Humble:
sudo apt-get install ros-humble-ur-robot-driver
-
Import and install IFRA_LinkAttacher:
cd ~/dev_ws/src git clone https://github.com/IFRA-Cranfield/IFRA_LinkAttacher.git cd ~/dev_ws colcon build
-
Import and install ros2_SimRealRobotControl:
cd ~/dev_ws/src git clone https://github.com/IFRA-Cranfield/ros2_SimRealRobotControl cd ~/dev_ws colcon build
The Simulation & Control packages of the following Robots are currently available:
This package contains the data structures for the ROS 2 Actions and Messages that are used for the robot movements and sequence executions:
- Move Action: ROS 2 Action that executes the specific Robot Movement (MoveJ, MoveR, MoveL...).
- Sequence Action: ROS 2 Action that contains the whole sequence of "Move.action" actions.
- MSG folder: Custom ROS 2 Messages are kept in this folder. These are used to define specific ROS 2 Actions, which do have a different format according to the type of movement they refer to.
For further detail about the data structures, please click here.
The ros2srrc_execution package contains the source code that executes both individual Robot movements and complete sequences or programs:
- move.cpp: ROS 2 Action Server -> Executes an individual Robot Motion, requested by calling "move.action".
- robmove.cpp: ROS 2 Action Server -> Executes an individual Robot Motion (input: End-Effector Pose), requested by calling "robmove.action".
- sequence.cpp: ROS 2 Action Server -> Executes a sequence, requested by calling "sequence.action".
- sequence.py: Python script that reads the program (sequence) from a ".txt" file, transforms it into the "sequence.action" format and executes it by triggering the ROS 2 Action Server defined in sequence.cpp.
For further detail about how Robot Movements and sequences are executed, please click here.
For the ROS 2-based Robot Simulation and Control to be successfully achieved, 3 different ROS 2 packages are necessary (for each Robot/Application):
- Gazebo package: The Gazebo/Simulation package contains all the information related to the Gazebo Simulation of the Robot Cell/Environment. CAD and mesh files containing visual data and [.urdf]+[.xacro] files containing Robot (ROS-format) data are combined with ROS 2 control and simulation components, and a simple simulation of the Robot (without any motion control) is obtained in Gazebo.
- MoveIt!2 package: For the Robot to be moved and controlled, a ROS 2 MoveIt!2 package is required. This package contains all the information related to the ROS 2 - MoveGroup (moveit2) node that controls the robot and its behaviour.
- Bringup package: The Bringup package acts as the main connection point between ROS 2 and the Real Robot. It contains all the information about the robot controllers, and establishes the connection between moveit2 and the Real Robot. For the connection between ROS 2 and a Real Robot to be established, a ROS 2 Driver is required, which translates the ROS 2-based commands to the Robot Controller. This ROS 2 Driver is usually developed by the Robot vendor or a recognised ROS2-development company.
At IFRA-Cranfield we have developed a ROS2-Gazebo Plugin which enables the attachment of 2 different entity links in Gazebo. The plugin has been designed with the main purpose of simulating object pick and place tasks using Robot Manipulators. The link attachment/detachment feature is available through a ROS2 Service Server, which creates a temporary fixed joint between two links for the "ATTACH" request, and removes the previously generated joint for the "DETACH" service. Thanks to this functionality, objects can be easily attached to any end-effector and pick/place tasks can be simulated in Gazebo-ROS2.
For further detail about the link ATTACHER/DETACHER plugin, please click here.
This repo contains only a few number of robots, end-effectors and simulation environments (layouts). Please do let us know if you wish to include a specific robot/end-effector or application into ros2_SimRealRobotControl!
The exact same thing for the ROS2 Robot Actions/Triggers: A few number of robot movements have been implemented, therefore please do let us know if you have any ideas of a potential Robot motions for our repo!
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, or you find a solution to any of the issues/improvements presented above, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks you very much!
Intelligent Flexible Robotics and Assembly Group
Created on behalf of the IFRA Group at Cranfield University, United Kingdom
E-mail: [email protected]
Licensed under the Apache-2.0 License.
You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
Cranfield University
School of Aerospace, Transport and Manufacturing (SATM)
Centre for Robotics and Assembly
College Road, Cranfield
MK43 0AL, Bedfordshire, UK
You can cite our work with the following statement:
IFRA-Cranfield (2023) ROS 2 Sim-to-Real Robot Control. URL: https://github.com/IFRA-Cranfield/ros2_SimRealRobotControl.
Mikel Bueno Viso - Research Assistant in Intelligent Automation at Cranfield University
E-mail: [email protected]
LinkedIn: https://www.linkedin.com/in/mikel-bueno-viso/
Profile: https://www.cranfield.ac.uk/people/mikel-bueno-viso-32884399
Dr. Seemal Asif - Lecturer in Artificial Intelligence and Robotics at Cranfield University
E-mail: [email protected]
LinkedIn: https://www.linkedin.com/in/dr-seemal-asif-ceng-fhea-miet-9370515a/
Profile: https://www.cranfield.ac.uk/people/dr-seemal-asif-695915
Professor Phil Webb - Professor of Aero-Structure Design and Assembly at Cranfield University
E-mail: [email protected]
LinkedIn: https://www.linkedin.com/in/phil-webb-64283223/
Profile: https://www.cranfield.ac.uk/people/professor-phil-webb-746415