24.01.2020 16:19

# Universal Robots arm and ROBOTIS Hand Setup with ROS Driver

## Robot Assembly

The settings and software installtions are tested for UR10e, but it is expected to work for variants as well.

• The robot is shipped in a big box in a disassembled manner.
• The robot ships with 1x teach pendant, 1x UR arm, 1x bracket, 1x control box, 1x power cable.
• To assemble and mount the robot a hard surface a pallete or a table is needed.
• Mount the robot on a hard surface with bracket provided and connect the robot to the control box.
• Connect the teach pendant to the control box and power cable to the teach pendant.
• Turn on the robot from the power button on teach pendant.
• After turning on the robot,activate the robot from left down corner (initially Power off), power on by toucing to the left down corner and than start the robot.
• Now the robot is ready to recieve the commands, you can test the robot by navigating to 'Move' tab from right upper corner.

## Gripper Setup

• In this tutorial the two finger Robotis hand H-P12-RN-UR inegrated.
• The robot hand ships with 1x gripper, 1x bracket, 1x cable cover, 1x USB stick, 3x sets of screws, 1x robot cable and 2x L-wrenchs.
• Allign the bracket with gripper point on the robot and fix it.
• Allign the connector point with the robot and mount it on the braket.
• Make sure the robot is turned off and connect the robot and the gripper.

Now the hardware part is setup. The next point is to configure the gripper in Unieversal Robot's software.

• To intergrate the gripper in the Universal Robot's software a URCAP s needed which can be downloaded from here, Robotis site.
• After downloading the URCAP copy it in a USB and insert the USB in teach pendent.
• In the right upper corner touch the hamburger sign and go to settings.
• In settings go to URCAPS in the left side and press + button.
• Select the URCAP file from the USB and restart.
• Now the URCAP for the Robotis two finger is instlled. Just goto Installation tab than URCAPS and Gripper to check whether the Dynamixel controller Daemon is running.
• In Program tab and in URCAPS gripper related actions can be found. These are namely Gripper Torque, Move and Detection. The gripper maximum and minimum values cvan be set here and can be closed or opened from this option.

## Universal Robots ROS driver

Universal robots ROS driver needs a realtime preemtble Kernel. Not every Linux Kernel is realtime preemtible and hence not are released frequently. Here the details of Linux realtime Kernels can be found.

### PREEMPT_RT Kernel [1]

• You can check the Kernel version in your PC by running (without !):
In [1]:
!uname -v

#40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019

In [2]:
!uname -r

5.0.0-37-generic

• So I decided to move to Linux 4.9 Kernel as be the closest one. You can chose the closes to your Kernel version from here adn than download the respective patch.

• Let's make new folder and process everything inside it. All next commands are executed inside this folder.

mkdir ~/kernel && cd ~/kernel

tar -xzf linux-4.9.84.tar.gz

• Rename the folder cotaingin the patch name.

mv linux-4.9.84 linux-4.9.84-rt62

• Download the patch and than unzip it.

wget ftp.ntu.edu.tw/linux/kernel/projects/rt/4.9/older/patch-4.9.84-rt62.patch.gz

gunzip patch-4.9.84-rt62.patch.gz

• Change directory to the downloaded kernel directory.

cd linux-4.9.84-rt62/

• Applying the real time Patch to the Kernel.

patch -p1

• To use Ubuntu config to have all the features (GUI etc.).

cp /boot/config-4.13.0-38-generic .config

• To enable all Ubuntu configurations do:

yes '' | make oldconfig

• To change the Kernel settings, we need a tool:

sudo apt install libncurses5-dev build-essential libssl-dev ccache

• To setup Kernel settings run the follwoing command and select Realtime Kernel (and choose under “Processor Type and Features” — “Preemption Model” — “Fully Preemptible kernel (RT)”).

• Exit the settings and run the follwing command (if your PC have more core run 'make -j4' for fast processing).

make

• Make the Kernel modules with:

sudo make modules_install

• Install all the compiled packages with:

sudo make install

• Reboot the PC and select the Ubuntu Kernel 4.9 and verify the Kernel version with:

uname -a

• After setting up the Kernel, we need to setup the user priviliges so that when running the ROS driver, it have permissions for realtime processing. To do that run the following commands.

sudo usermod -aG realtime \$(whoami)

• Make sure that /etc/security/limits.conf contains the following:

@realtime soft rtprio 99

@realtime soft priority 99

@realtime soft memlock 102400

@realtime hard rtprio 99

@realtime hard priority 99

@realtime hard memlock 102400

• You have to logout to get the changes takes effect.
In [3]:
!uname -v

#1 SMP PREEMPT RT Mon Jan 20 09:09:49 CET 2020

In [4]:
!uname -r

4.9.84-rt62


### ROS Driver (Remote PC) [2]

• source global ros.

source /opt/ros//setup.bash

• create a catkin workspace.

mkdir -p catkin_ws/src && cd catkin_ws

• Clone the driver.

git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver

Clone fork of the description to use the calibration feature

git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot

• install dependencies.

sudo apt update -qq

rosdep update

rosdep install --from-path src --ignore-src -y

• Build the workspace.

catkin_make

• Activate the workspace (ie: source it).

source devel/setup.bash

### External Control URCAP

• At last we just have to configure the Universal Robot's arm to accept external commands adn control. This can be achieved by a URCAP in the teach pendent.

#### URCAP Installation for e Series Robot [3]

To use the ROS driver for Univerdsal Robot arms, a URCAP named externalcontrol-1.0.urcap needs to be installed which can be found in the resources folder of the driver.

Note: For this installation a minimum PolyScope version of 5.1 is required.

• To install the external control URCAP, copy it to a USB drive and insert the USB into the teach pendent's USB port.

• Now on teach pendent touch the hamburger icon on the right upper corner and go to settings and than to URCAPS in the menu on the left side.

• In URCAPS touch the '+' icon and navigate to USB drive and select the external control urcap.

• Now this urcap is selected you just need to restart the teach pendant and it can be used.

#### URCAP Installation for cb3 Series Robot [4]

To use the ROS driver for Univerdsal Robot arms, a URCAP named externalcontrol-1.0.urcap needs to be installed which can be found in the resources folder of the driver.

Note: For this installation a minimum PolyScope version of 3.7 is required.

• To install the external control URCAP, copy it to a USB drive and insert the USB into the teach pendent's USB port.

• Now on the welcome screen select Setup Robot and then URCaps to enter the URCaps installation screen.

• In URCAPS touch the '+' icon and navigate to USB drive and select the external control urcap.

• Now this urcap is selected you just need to restart the teach pendant and it can be used.

## Network Setup

• The robotic arm can be connected via Wifi or a network but this can have latency, which will introduce warning and disconnect/connect the robot to remote PC (if the network has latencies).
• To avoid latency remote PC and the robot can be connected directly.
• Just set up a static connection on the remote PC with:

IP: 10.0.0.1

• Set up a static connection in teach pendent (Settings and than Network):

IP: 10.0.0.2

##### Setting IP in the URCAPS
• The URCAPS installed in the last section needs to set the IP address of the remote PC so that the robot can later recive the commands.

• To do so, navigate to navigate to program tab in the menu than URCAPS and so in Extermnal Control.

• Here you can set the IP of the remote PC in the 'Please set the remote host's IP:' field. For now please leave the field 'Please setup the custom port' untouched.

## Sending control commands to the robotic arm

• After the connecting the robot and remote PC over network, in remote PC run the following the command:

roslaunch ur_robot_driver _bringup.launch robot_ip:=

• On the robot make a program which just have an 'External Control' urcap in the program body adn run it (you should be able to see the informative messages in the terminal for the robot bringup).

• In another terminal run:

roslaunch _moveit_config moveit_rviz.launch config:=true

• To send the control commands to the robot /scaled_pos_traj_controller/follow_joint_trajectory action server can be used. For test it can be controlled with other packages like rqt_joint_trajectory_controller can be used. In a new terminal run:

rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller

• By running the above the robot can be controlled remotely over network using ROS.

## References

1. Building Realtime Linux for ROS 2 [community-contributed], viewed January 24, 2020 https://index.ros.org/doc/ros2/Tutorials/Building-Realtime-rt_preempt-kernel-for-ROS-2/ >

2. Universal_Robots_ROS_Driver, viewed January 24, 2020 https://github.com/UniversalRobots/Universal_Robots_ROS_Driver >

3. Installing a URCap on a s-Series robot, viewed January 24, https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/master/ur_robot_driver/doc/install_urcap_e_series.md >

4. Installing a URCap on a CB3 robot, viewed January 24, https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/master/ur_robot_driver/doc/install_urcap_cb3.md >