Note: This tutorial describes the process of starting communications between ROS-Industrial nodes and a Universal Robots UR5 (controller CB3). While tested with the UR5, the same procedure should apply to the UR10.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Getting Started with a Universal Robot and ROS-Industrial

Description: This tutorial guides you through the process of establishing first contact between ROS-Industrial and a Universal Robot controller.

Keywords: Industrial, Universal Robot, UR5, UR10

Tutorial Level: INTERMEDIATE

Deprecation notice

This tutorial is kept for archival purposes only. Packages mentioned may not be available any more and the procedure outlined below may stop working at any time.

The ur_modern_driver should not be used any more for CB3 controllers and newer (including e-Series).

See ur_robot_driver for its replacement.

Prerequisites

In order to complete this tutorial, you should have access to the following:

  1. A computer with ROS installed (>= Hydro)

  2. ROS-Industrial's universal_robot package

This particular tutorial was tested on a UR5 robotic arm running firmware version 3.0. The connecting computer was the training virtual-machine running Ubuntu 12.04 (see Virtual Machine Setup).

Driver compatibility

Please check the universal_robot page for compatibility of the various driver and UR control box / system software versions. Make sure to use a compatible combination.

Note that if you use the virtual-machine for this tutorial, you will likely need to change your virtual machine's network settings for the Ethernet line to bridged adaptor, the settings for which are found (before starting the VM) under VirtualBox -> Machine -> Settings -> Network.

Overview

The universal_robot metapackage communicates with hardware via Ethernet connection. Upon establishing a connection, ROS-Industrial will upload a program written in URScript, Universal Robots' own Python-like scripting language. This program is responsible for listening for messages sent via ROS-Industrial's simple_messages package and interpreting those messages into hardware commands.

You do not need to explicitly install any program on the Universal Robot to communicate with it via ROS-Industrial.

Steps

Install necessary software

If you haven't already, we'll first need to install the necessary software packages.

Depending on the ROS release that you are using, you can either install the packages using apt-get (preferred) or you'll have to build them from sources. See the main universal_robot page for installation instructions.

After you've installed the packages, return to this tutorial.

Configure your hardware

The next step is to ensure that your hardware, the controlling computer and robot, are properly configured to talk to each-other. Note that by default, the Universal Robot’s networking capabilities are disabled. To enable networking, use the UR’s teach-pendant to navigate to the Setup Robot -> Setup Network Menu (shown in the below attachment).

If you are an experienced user, feel free to skip the remainder of this section after you have made note of the robot’s IP address.

thumb

A full discussion of static and dynamic (DHCP) IP assignment is beyond the scope of this tutorial. If you are unsure of your settings and are at an organization with an IT department, consult them. If you are experimenting on your own local network using a router/switch, it is likely that you are using DHCP.

If you want the UR to have a fixed internet address select the Static Address option and manually input the desired address information. If you are behind a network switch or router, consult the associated manual to find compatible settings. After entering, your information press the Apply button before leaving the page.

If you are looking to get started quickly with a network router and don't mind the possibility of your UR's IP address changing later, select DHCP, then Apply.

In either case, if the robot does not seem to properly obtaining a network configuration, try rebooting the controller and pressing Update again. A valuable debugging tool is your operating system's ping command. Open a terminal on your computer (for Windows, run cmd.exe) and then enter

ping IP_OF_THE_ROBOT

If nothing appears to happen or an error is thrown, the robot is unreachable from your computer. Ensure that your network settings are correct, both on your computer and the robot, and try press Update on the UR controller.

Describing the arm to ROS

The launch file below will attempt to launch the ur_description package. If you have not already done so install it now. A xacro file is sent to the parameter server so that a description of the arm can be read in by the the driver at runtime.

Making contact with UR v1.5.x to v1.8.x

Warning: If you are using a UR version 3.0 and above, you may need to try running the ur_modern_driver package. A description of the compatible way to make contact can be found below.

There are launch files available to bringup a real robot - either UR5 or UR10. In the following the commands for the UR5 are given. For the UR10, simply replace the prefix accordingly.

Don't forget to source the correct setup shell files and use a new terminal for each command!

To bring up the real robot, run the following command after replacing IP_OF_THE_ROBOT with the actual hardware's address:

roslaunch ur_bringup ur5_bringup.launch robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]

Remember that you should always have your hands on the big red button in case there is something in the way or anything unexpected happens.

In a new terminal, a simple test script that moves the robot to predefined positions can be executed like this:

rosrun ur_driver test_move.py

Making contact with UR v3.x

There are launch files available to bringup a real robot - either UR5 or UR10. In the following the commands for the UR5 are given. For the UR10, simply replace the prefix accordingly.

Don't forget to source the correct setup shell files and use a new terminal for each command!

First make sure you have installed or sourced the ur_modern_driver package to be run with the newer versions of a UR. To bring up the real robot, run the following command after replacing IP_OF_THE_ROBOT with the actual hardware's address:

roslaunch ur_modern_driver ur5_bringup.launch robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]

Remember that you should always have your hands on the big red button in case there is something in the way or anything unexpected happens.

Using MoveIt! with hardware

Additionally, you can use MoveIt! to control the robot. There exist MoveIt! configuration packages for both robots.

For setting up the MoveIt! nodes to allow motion planning run (assumes the connection is already established from section 4.3 above):

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch

For starting up RViz with a configuration including the MoveIt! Motion Planning plugin run:

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

Note that as MoveIt! seems to have difficulties with finding plans for the UR with full joint limits [-2pi, 2pi], there is a joint_limited version using joint limits restricted to [-pi,pi]. In order to use this joint limited version, simply use the launch file arguments 'limited', i.e.:

roslaunch ur_bringup ur5_bringup.launch limited:=true robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

Wiki: universal_robot/Tutorials/Getting Started with a Universal Robot and ROS-Industrial (last edited 2020-06-18 13:42:59 by GvdHoorn)