Home

Awesome

UR5 Controller for OpenRAVE

<p float="left"> <img src="repo_assets/ridgeback_ur5_fts150_gripper.png" width="250" /> <img src="repo_assets/ridgeback_ur5_gripper.png" width="250" /> <img src="repo_assets/ridgeback_ur5.png" width="250" /> </p>

Currently we support different models (we only provide controllers for the UR5 and the two-finger gripper in this project):

This controller will listen to ROS topic that publishes the joint values of the UR5 robot in real time and will visualise the current state of a UR5 robot in OpenRAVE.

Another important functionality of this plugin is that is able to execute trajectories generated by OpenRAVE planners on the real robot.

There is a test program that demonstrates this functionality under scripts/control_ur5 in which case will load UR5 in OpenRAVE and then let you control the UR5 robot above a table (move left, right, forward, backwards and rotate the gripper clockwise and anti-clockwise).

1. Developers and Contributors

UR5 OpenRAVE controller was developed by the Robot Manipulation Lab in the School of Computing at the University of Leeds.

2. License

UR5 OpenRAVE controller is licensed under GNU General Public License v3.0. The full license is available here.

3. Includes

This repository includes the following:

4. Installation

You can either get this controller using a Singularity container or by building the controller as a catkin package on your host machine. The advantage of using a singularity container over building it on your host machine is that you can have a different Ubuntu and ROS version on your host machine and have UR5 Controller within a singularity container that runs Ubuntu 14.04 and ROS Indigo. For example you can have a host machine with Ubuntu 18.04 and run UR5 Controller with the Singularity container.

<details> <summary>Using Singularity container</summary> </br> The easiest way to get up and running with this controller is to use our Singularity container.
  1. Install Singularity on your machine by following this.
  2. Then, follow the instructions from here.
</details> <details> <summary>Built from source on your own machine</summary> </br> If you wish to build this control on your host machine, you can find the instructions below.

Dependencies

Installation

echo 'export PYTHONPATH=$PYTHONPATH:~/catkin_ws/src/ur5controller/pythonsrc/ur5_robot' >> ~/.bashrc`

This will let Python know where the Python classes for creating UR5 robot instances in OpenRAVE are.

</details>

5. Testing the controller

There is a file called control_ur5.py under scripts that you can run and test the controller on the real robot.

With the Python class in place, creating a UR5 robot in OpenRAVE is super easy:

<details> <summary>Show code</summary> </br>
import IPython
from ur5_factory import UR5_Factory
ur5_factory = UR5_Factory()

# If you want to specify all the configuration settings (is_simulation, has_ridgeback etc)
env, robot = ur5_factory.create_ur5_and_env(is_simulation=True,
                                            has_ridgeback=True,
                                            gripper_name="robotiq_two_finger",
                                            has_force_torque_sensor=True,
                                            env_path="test_env.xml",
                                            viewer_name="qtcoin",
                                            urdf_path="package://ur5controller/ur5_description/urdf/",
                                            srdf_path="package://ur5controller/ur5_description/srdf/")

# The above is equivalent to the following (the `create_ur5_and_env` has set to defaults the values used above):
env, robot = ur5_factory.create_ur5_and_env()
IPython.embed()

If you would like to use the model with no gripper, then you need to pass None to the gripper_name argument.

</details>

6. Controller explained

  1. Load the robot in OpenRAVE using the URDF plugin:
<details> <summary>Show code</summary> </br>
import IPython

env = Environment()
env.Load('test_env.xml')
env.SetViewer('qtcoin')

urdf_path = "package://ur5controller/ur5_description/ur5.urdf"
srdf_path = "package://ur5controller/ur5_description/ur5.srdf"

module = RaveCreateModule(env, 'urdf')
with env:
  name = module.SendCommand('LoadURI {} {}'.format(urdf_path, srdf_path))
  robot = env.GetRobot(name)

env.Add(robot, True)
</details>
  1. You now need to attach the controllers (UR5 and the Robotiq controllers) to the robot using the MultiController.
<details> <summary>Show code</summary> </br>
multicontroller = RaveCreateMultiController(env, "")
robot.SetController(multicontroller)

robot_controller = RaveCreateController(env,'ur5controller')
hand_controller = RaveCreateController(env, 'robotiqcontroller')

multicontroller.AttachController(robot_controller, [2, 1, 0, 4, 5, 6], 0)
multicontroller.AttachController(hand_controller, [3], 0)

IPython.embed()

You are now set. The OpenRAVE robot should update as you change the configuration of the actual robot, and should also execute trajectories from OpenRAVE to the actual robot.

</details>

7. Other Notes

<details> <summary>Checking ROS topics for attaching controllers</summary> </br>

This package will check (in ur5_factory.py) if certain topics are being published (i.e CModelRobotInput and CModelRobotOutput) if you chose a gripper name equal to "robotiq_two_finger_" and will not attach the corresponding controller if those topics are not being published. This is a defensive mechanism to avoid IsDone() method of the end-effector gripper returning false and blocking the program execution. For more discussion, see here

</details>

8. Troubleshooting

<details> <summary>RuntimeError: maximum recursion depth exceeded while calling a Python object</summary> </br>

If you get this error while the IK are being generated, then you probably have a version of sympy > 0.7.1. Downgrade your sympy version to 0.7.1:

pip install --upgrade sympy==0.7.1

This should fix this issue.

</details> <details> <summary>TypeError: argument of type 'Poly' is not iterable</summary> </br>

If you get this error while the IK are being generated, then you probably have a version of sympy > 0.7.1. Downgrade your sympy version to 0.7.1:

pip install --upgrade sympy==0.7.1

This should fix this issue.

</details> <details> <summary>Executing the trajectory on the real robot causes unintended actions</summary> </br>

Issue: While OpenRAVE generates a trajectory that is smooth and valid in simulation during real execution the robot is strangely executing the trajectory.

Possible solution: We came across this issue and the problem is probably down to the UR modern driver. When UR modern driver is installed using apt-get the problem appeared. The solution was to install UR modern driver as a catkin package (make sure to checkout the branch kinetic-devel although is kinetic is also working with indigo).

</details>