Reader small image

You're reading from  Mastering ROS for Robotics Programming, Third edition - Third Edition

Product typeBook
Published inOct 2021
PublisherPackt
ISBN-139781801071024
Edition3rd Edition
Concepts
Right arrow
Authors (2):
Lentin Joseph
Lentin Joseph
author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph

Jonathan Cacace
Jonathan Cacace
author image
Jonathan Cacace

Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received his Master's degree in computer science, and a Ph.D. degree in Information and Automation Engineering, from the University of Naples Federico II. Currently, he is an Assistant Professor at the University of Naples Federico II. He is also a member of PRISMA Lab where he is involved in different research projects focused on industrial and service robotics in which he has developed several ROS-based applications integrating robot perception and control.
Read more about Jonathan Cacace

View More author details
Right arrow

Chapter 15: ROS for Industrial Robots

Until now, we have been mainly discussing interfacing personal and research robots with ROS, but some of the main areas where robots are extensively used are in industries such as manufacturing, the automotive industry, and packaging. Does ROS support industrial robots? Are there any companies that use ROS to handle manufacturing processes? ROS-Industrial comes with a solution to interface industrial robot manipulators to ROS and control them using its powerful tools, such as MoveIt, Gazebo, and RViz.

In this chapter, we will discuss the following topics:

  • Understanding and getting started with ROS-Industrial packages
  • Creating a URDF for an industrial robot and interfacing it with MoveIt
  • Working with the MoveIt configuration for a Universal Robots arm and ABB robots
  • Understanding ROS-Industrial robot support packages
  • Understanding ROS-Industrial robot client and driver packages
  • Working with IKFast algorithms...

Technical requirements

To follow this chapter, you need a standard laptop running Ubuntu 20.04 with ROS Noetic installed. The reference code for this chapter can be downloaded from the following Git repository: https://github.com/PacktPublishing/Mastering-ROS-for-Robotics-Programming-Third-edition.git. The code is contained in the Chapter15/ abb_irb6640_moveit_plugins and Chapter15/ikfast_demo folders.

Understanding ROS-Industrial packages

ROS-Industrial basically extends the advanced capabilities of ROS software to industrial robots employed in manufacturing processes. ROS-Industrial consists of many software packages, which help us to control industrial robots. These packages are BSD (legacy)/Apache 2.0 (preferred) licensed programs, which contain libraries, drivers, and tools with a standard solution for industrial hardware. ROS-Industrial is now guided by the ROS-Industrial Consortium. The official website of ROS-Industrial (ROS-I) can be found at http://rosindustrial.org/.

Goals of ROS-Industrial

The main goals behind ROS-Industrial development are as follows:

  • Combining the strength of ROS with existing industrial technologies to explore the advanced capabilities of ROS in the manufacturing process
  • Developing reliable and robust software for industrial robot applications
  • Providing an easy way to do research and development in industrial robotics
  • Creating a wide community supported by researchers and professionals for industrial robotics
  • Providing industrial-grade ROS applications and becoming a one-stop location for industry-related applications

Before exploring the capabilities of ROS-Industrial with a set of industrial robots, let's briefly introduce it, discussing its history, architecture, and installation.

ROS-Industrial – a brief history

In 2012, the ROS-Industrial open source project started as a collaboration of Yaskawa Motoman Robotics (http://www.motoman.com/), Willow Garage (https://www.willowgarage.com/), and the Southwest Research Institute (SwRI) (http://www.swri.org/) for using ROS in industrial manufacturing. ROS-I was founded by Shaun Edwards in January 2012.

In March 2013, the ROS-I Consortium Americas and Europe were launched, led by SwRI in Texas and Fraunhofer IPA in Germany, respectively. In the following list, a set of benefits that ROS-I provides to the community are detailed:

  • Explores the features in ROS: The ROS-Industrial packages are tied to the ROS framework so that we can use all the ROS features in industrial robots too. Using ROS, we can create custom inverse kinematic solvers for each robot and implement object manipulation, using 2D/3D perception.
  • Out-of-the-box applications: The ROS interface enables advanced perception in robots...

Installing ROS-Industrial packages

The main repository of ROS-Industrial packages can be found at the following link: https://github.com/ros-industrial. In this repository, developers can find different packages used to interface their ROS system with typical industrial tools and devices, such as Programmable Logic Controller (PLC), or directly communicate with the hardware driver of popular industrial manipulators such as Kuka, abb, or Fanuc. Apart from this, the main repository for ROS-Industrial resources is the industrial_core stack, which can be downloaded from the following Git repository:

git clone https://github.com/ros-industrial/industrial_core

This repository is still under development to assure full compatibility with ROS Noetic. However, the industrial-core stack includes the following set of ROS packages:

  • industrial-core: This stack contains packages and libraries for supporting industrial robotic systems. The package consists of nodes for communicating...

Creating a URDF for an industrial robot

Creating the URDF file for an ordinary robot and an industrial robot are the same, but industrial robots require some standards that should be strictly followed during their URDF modeling, which are as follows:

  • Simplify the URDF design: The URDF file should be simple and readable and only need the important tags.
  • Develop a common design: Develop a common design formula for all industrial robots by various vendors.
  • Modularize the URDF: The URDF needs to be modularized using XACRO macros and it can be included in a large URDF file without much hassle.

The following points are the main differences in the URDF design followed by ROS-I:

  • Collision-aware: Industrial robot IK planners are collision-aware, so the URDF should contain an accurate collision 3D mesh for each link. Every link in the robot should export to STL or DAE with a proper coordinate system. The coordinate system that ROS-I is following is the x axis pointing...

Creating the MoveIt configuration for an industrial robot

The procedure for creating the MoveIt interface for industrial robots is the same as the other ordinary robot manipulators, except for some standard conventions. The following procedure gives a clear idea about these standard conventions:

  1. Launch the MoveIt setup assistant by using the following command:
    roslaunch moveit_setup_assistant setup_assistant.launch
  2. Load the URDF from the robot description folder or convert xacro to URDF and load the setup assistant.
  3. Create a self-collision matrix with Sampling Density of ~ 80,000. This value can increase the accuracy of collision checking in the arm.
  4. Add a virtual joint, as shown in the following screenshot. Here, the virtual and parent frame names are arbitrary:

    Figure 15.2 – Adding MoveIt – virtual joints

  5. In the next step, we are adding planning groups for the manipulator and end effectors. Here, also, the group names are arbitrary...

Updating the MoveIt configuration files

After creating the MoveIt configuration, we should update the ros_controllers.yaml file inside the config folder of the MoveIt package. Here is an example of ros_controllers.yaml:

controller_list: 
  - name: "" 
    action_ns: follow_joint_trajectory 
    type: FollowJointTrajectory 
    joints: 
      - shoulder_pan_joint 
      - shoulder_lift_joint 
      - elbow_joint 
      - wrist_1_joint 
      - wrist_2_joint 
      - wrist_3_joint 

In the previous file, we have to pay attention to the action_ns field. This field represents the name of the action server used to send the trajectory to the simulated or real robotic platform. We will discuss in the next section how to configure...

Installing ROS-Industrial packages for Universal Robots arms

Universal Robots (http://www.universal-robots.com/) is an industrial robot manufacturer based in Denmark. The company mainly produces three arms: UR3, UR5, and UR10. The robots are shown in the following figure:

Figure 15.8 – UR3, UR5, and UR10 robots

The specifications of these robots are given in the following table:

Figure 15.9 – Universal Robots robot properties

In the next section, we will install the Universal Robots packages and work with the MovetIt interface to simulate industrial robots in Gazebo.

Installing the ROS interface for Universal Robots

We get the Universal Robots ROS-I packages by downloading them from the following repository:

git clone https://github.com/ros-industrial/universal_robot.git  

The Universal Robots packages are as follows:

  • ur_description: This package consists of the robot description and Gazebo description of UR-3, UR-5, and UR-1.
  • ur_driver: This package contains client nodes, which can communicate with the UR-3, UR-5, and UR-10 robot hardware controllers.
  • ur_bringup: This package consists of launch files to start communication with the robot hardware controllers to start working with the real robot.
  • ur_gazebo: This package consists of Gazebo simulations of UR-3, UR-5, and UR-10.
  • ur_msgs: This package contains ROS messages used for communication between various UR nodes.
  • urXX_moveit_config: These are the moveit config files of Universal Robots manipulators. One different package exists for each type of arm...

Understanding the MoveIt configuration of a Universal Robots arm

The MoveIt configuration for Universal Robots arms is in the config directory of each moveit_config package (ur10_moveit_config for the UR-10 configuration).

Here is the default content of the controller.yaml file of UR-10:

controller_list: 
  - name: "" 
    action_ns: follow_joint_trajectory 
    type: FollowJointTrajectory 
    joints: 
      - shoulder_pan_joint 
      - shoulder_lift_joint 
      - elbow_joint 
      - wrist_1_joint 
      - wrist_2_joint 
      - wrist_3_joint 

To properly connect the MoveIt side, we must set the correct action_ns element. Let's change this file in the following way:

controller_list: 
  - name: ...

Getting started with real Universal Robots hardware and ROS-I

After testing our control algorithms in simulation using Gazebo, we can start to perform manipulation tasks with a real Universal Robots arm. The main difference between performing a trajectory simulating the robot and using real hardware is that we need to start the driver that will contact the arm controller to set the desired joint positions.

The default driver of Universal Robots arms is released with the ur_driver package of ROS-I. This driver has been successfully tested with system versions ranging from v1.5.7 to v1.8.2. The last version of Universal Robots controllers is v3.2, so the default version of the ROS-I driver might not be fully compatible. For the newer versions of these systems (v3.x and up), it is recommended to use the unofficial ur_modern_driver package:

  1. To download ur_modern_driver, use the following Git repository:
    git clone https://github.com/ros-industrial/ur_modern_driver.git
  2. After...

Working with MoveIt configuration for ABB robots

We will work with two of the most popular ABB industrial robot models: IRB 2400 and IRB 6640. The following are photographs of these two robots and their specifications:

Figure 15.12 – ABB IRB 2400 and IRB 6640

The specifications of these robotic arms are given in the following table:

Figure 15.13 – ABB IRB robot properties

To work with ABB packages, clone the ROS packages of the robot into the catkin workspace. We can use the following command to do this task:

git clone https://github.com/ros-industrial/abb

Then, build the source packages using catkin_make. Actually, this package mainly contains configuration files, so nothing related to C++ code needs to be compiled. However, in the abb folder, we have a particular package defining kinematic plugins to speed up the inverse kinematic calculation. More details on this topic will be provided in the next section.

...

Understanding the ROS-Industrial robot support packages

The ROS-I robot support packages are a new convention followed for industrial robots. The aim of these support packages is to standardize the ways of maintaining ROS packages for a wide variety of industrial robot types of different vendors. Because of the standardized way of keeping files inside support packages, we don't have any confusion in accessing the files inside them. We can demonstrate a support package of an ABB robot and can see the folders and files and their uses.

We have already cloned the ABB robot packages, and inside this folder, we can see three support packages that support three varieties of ABB robots. Here, we are taking the ABB IRB 2400 model support package: abb_irb2400_support. The following list shows the folders and files inside this package:

  • config: As the name of the folder, this contains the configuration files of joint names, RViz configuration, and robot model-specific configuration...

The ROS-Industrial robot client package

The industrial robot client nodes are responsible for sending robot position/trajectory data from ROS MoveIt to the industrial robot controller. The industrial robot client converts the trajectory data to simple_message and communicates to the robot controller using the simple_message protocol. The industrial robot controller runs a server and industrial robot client nodes connect to this server and start communicating with it.

Designing industrial robot client nodes

The industrial_robot_client package contains various classes to implement industrial robot client nodes. The main functionalities that a client should have include updating the robot's current state from the robot controller, and also sending joint position messages to the controller. There are two main nodes that are responsible for getting the robot state and sending joint position values:

  • The robot_state node: This node is responsible for publishing the robot's current position, status, and so on.
  • The joint_trajectory node: This node subscribes to the robot's command topic and sends the joint position commands to the robot controller via the simple message protocol.

The following figure gives the list of APIs provided by the industrial robot client:

Figure 15.17 – A list of the industrial robot client APIs

We can briefly go through these APIs and their functionalities, as follows...

The ROS-Industrial robot driver package

In this section, we will discuss the industrial robot driver package. If we take the ABB robot as an example, it has a package called abb_driver. This package is responsible for communicating with the industrial robot controller. This package contains industrial robot clients and launches the file to start communicating with the controller. We can check what is inside the abb_driver/launch folder. The following is a definition of a launch file called robot_interface.launch:

<launch> 
  <!-- robot_ip: IP-address of the robot's socket-messaging server --> 
  <arg name="robot_ip" /> 
  <!-- J23_coupled: set TRUE to apply correction for J2/J3 parallel linkage --> 
  <arg name="J23_coupled" default="false" /> 
 
  <!-- copy the specified arguments to the Parameter Server, for use by nodes below --> 
  <param name...

Understanding the MoveIt IKFast plugin

One of the default numerical IK solvers in ROS is KDL. This library is used to calculate the direct and inverse kinematics of a robot using the URDF. KDL mainly uses DOF > 6. In DOF <= 6 robots, we can use analytic solvers, which are much faster than numerical solvers, such as KDL. Most industrial arms have DOF <= 6, so it will be good if we make an analytical solver plugin for each arm. The robot will work on the KDL solver too, but if we want a fast IK solution, we can choose something such as the IKFast module to generate analytical solver-based plugins for MoveIt. We can check which are the IKFast plugin packages present in the robot (for example, universal robots and ABB):

  • ur_kinematics: This package contains IKFast solver plugins of UR-5 and UR-10 robots from Universal Robotics.
  • abb_irb2400_moveit_plugins/irb2400_kinematics: This package contains IKFast solver plugins for the ABB robot model IRB 2400.

We...

Creating the MoveIt IKFast plugin for the ABB IRB 6640 robot

We have seen the MoveIt package for the ABB robot IRB 6640 model. This robot works with a default numerical solver. In this section, we will discuss how to generate an IK solver plugin using IKFast, a powerful inverse kinematics solver provided within Rosen Diankov's OpenRAVE motion planning software. At the end of this section, we will be able to run the MoveIt demo of this robot, using our custom inverse kinematic plugin.

In short, we will build an IKFast MoveIt plugin for the robot ABB IRB 66400. This plugin can be selected during the MoveIt setup wizard or we can mention it in the config/kinematics.yaml file of the moveit-config package.

Prerequisites for developing the MoveIt IKFast plugin

The following is the configuration we have used for developing the MoveIt IKFast plugin:

  • Ubuntu 20.04 LTS
  • ROS Noetic desktop, full installation
  • OpenRave

The OpenRave and IKFast modules

OpenRave is a set of command lines and GUI tools for developing, testing, and deploying motion planning algorithms in real-world applications. One of the OpenRave modules is IKFast, which is a robot kinematics compiler. OpenRave was created by a robotic researcher called Rosen Diankov. The IKFast compiler analytically solves the inverse kinematics of a robot and generates optimized and independent C++ files, which can be deployed in our code for solving IK. The IKFast compiler generates analytic solutions of IK, which is much faster than numerical solutions provided by KDL. The IKFast compiler can handle any number of DOFs, but practically it is well suited for DOF <= 6. IKFast is a Python script that takes arguments such as IK types, robot model, the joint position of the base link, and end effectors.

The following are the main IK types supported by IKFast:

  • Transform 6D: This end effector should calculate the commanded 6D transformation...

Creating the COLLADA file of a robot to work with OpenRave

In this section, we will discuss how to use URDF robot models with OpenRave. Firstly, we will see how to convert a URDF in a collada file (.dae) format; this file will then be used to generate the IKFast source file. To convert a URDF model into a collada file, we can use a ROS package called collada_urdf. This can be installed with the following command:

sudo apt-get install ros-noetic-collada-urdf

We will work with the ABB IRB 6640 robot model, which can be found in the abb_irb6600_support package in the /urdf folder named irb6640.urdf. Alternatively, you can take this file from the ikfast_demo folder released with the book's source code. Copy this file into your working folder and run the following command for the conversion:

roscore && rosrun collada_urdf urdf_to_collada irb6640.urdf irb6640.dae  

The output of the previous command is the robotic model in the collada file format.

...

Generating the IKFast CPP file for the IRB 6640 robot

After getting the link information, we can start to generate the inverse kinematic solver source file for handling the IK of this robot. All the files needed to follow the tutorial of this section are available in the source code folder, ikfast_demo, provided with this book. Alternatively, you can download this code by cloning the following Git repository:

git clone https://github.com/jocacace/ikfast_demo.git  

Use the following command to generate the IK solver for the ABB IRB 6640 robot:

python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot=irb6640.dae --iktype=transform6d --baselink=1 --eelink=8 --savefile=ikfast61.cpp  

The preceding command generates a CPP file called ikfast61.cpp, in which the IK type is transform6d, the position of the baselink link is 1, and the end effector link is 8. We need to mention the robot DAE file as the robot argument.

Before using...

Creating the MoveIt IKFast plugin

Creating a MoveIt IKFast plugin is quite easy. There is no need to write code; everything can be generated using some tools. The only thing we need to do is to create an empty ROS package. The following is the procedure to create a plugin:

  1. Create an empty package in which the name should contain the robot name and model number. This package is going to convert into the final plugin package, using the plugin generation tool:
    catkin_create_pkg abb_irb6640_moveit_plugins
  2. Then, build the workspace by using the catkin_make command.
  3. After building the workspace, copy ikfast.h to abb_irb6640_moveit_plugins/include.
  4. Copy the switch ikfast61.cpp, previously created in the package folder, renaming it abb_irb6640_manipulator_ikfast_solver.cpp. This filename consists of the robot's name, model number, type of robot, and so on. This kind of naming is necessary for the generating tool.

After performing these steps, open two terminals...

Summary

In this chapter, we discussed a new interface of ROS for industrial robots called ROS-Industrial. We looked at the basic concepts of developing industrial packages and installing them in Ubuntu. After installation, we looked at the block diagram of this stack, and discussed developing the URDF model for industrial robots and also creating the MoveIt interface for an industrial robot.

After covering these topics in detail, we installed the industrial robot packages for Universal Robots and ABB. We learned the structure of the MoveIt package and then shifted to the ROS-Industrial support packages. We discussed them in detail and switched to concepts such as the industrial robot client and how to create the MoveIt IKFast plugin. Finally, we used the developed plugin in the ABB robot.

In the next chapter, we will look at troubleshooting and best practices in ROS software development.

Here are some questions that will help you better understand this chapter.

Questions

  • What are the main benefits of using ROS-Industrial packages?
  • What are the conventions followed by ROS-I in designing a URDF for industrial robots?
  • What is the purpose of ROS' support packages?
  • What is the purpose of ROS' driver packages?
  • Why do we need the IKFast plugin for our industrial robot, rather than the default KDL plugin?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering ROS for Robotics Programming, Third edition - Third Edition
Published in: Oct 2021Publisher: PacktISBN-13: 9781801071024
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph

author image
Jonathan Cacace

Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received his Master's degree in computer science, and a Ph.D. degree in Information and Automation Engineering, from the University of Naples Federico II. Currently, he is an Assistant Professor at the University of Naples Federico II. He is also a member of PRISMA Lab where he is involved in different research projects focused on industrial and service robotics in which he has developed several ROS-based applications integrating robot perception and control.
Read more about Jonathan Cacace