https://github.com/roboticsleeds/ur5controller
OpenRAVE Controller Plugin for UR5 (Universal Robots UR5) Robot
https://github.com/roboticsleeds/ur5controller
openrave openrave-conroller plugin robotics ros ur5 ur5-robot
Last synced: 17 days ago
JSON representation
OpenRAVE Controller Plugin for UR5 (Universal Robots UR5) Robot
- Host: GitHub
- URL: https://github.com/roboticsleeds/ur5controller
- Owner: roboticsleeds
- License: gpl-3.0
- Created: 2017-11-08T15:03:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-22T09:36:33.000Z (almost 5 years ago)
- Last Synced: 2024-08-04T03:08:25.605Z (10 months ago)
- Topics: openrave, openrave-conroller, plugin, robotics, ros, ur5, ur5-robot
- Language: Python
- Homepage:
- Size: 5.64 MB
- Stars: 34
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- MATLAB-Guide - ur5controller - source OpenRAVE controller for UR5 robot integrated with ROS. (Robotics Tools and Frameworks)
README
# UR5 Controller for OpenRAVE
![]()
![]()
![]()
Currently we support different models (we only provide controllers for the UR5 and the two-finger gripper in this project):
- Clearpath Ridgeback + UR5 + Force Torque Sensor 150 + RobotiQ Two Finger Gripper
- Clearpath Ridgeback + UR5 + RobotiQ Two Finger Gripper
- Clearpath Ridgeback + UR5This 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`](scripts/control_ur5.py) 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](https://artificial-intelligence.leeds.ac.uk/robot-manipulation/) in the School of Computing at the University of Leeds.
- Author: [Rafael Papallas](http://rpapallas.com).
- Current maintainor: [Rafael Papallas](http://rpapallas.com).## 2. License
UR5 OpenRAVE controller is licensed under GNU General Public License v3.0. The full license is available [here](https://github.com/roboticsleeds/ur5controller/blob/master/LICENSE).## 3. Includes
This repository includes the following:
- The custom written controller for OpenRAVE and UR5 robot.
- The URDF and SRDF files for UR5 itself, Robotiq Two-Finger Gripper, and
Clearpath Ridgeback moving base.## 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.
Using Singularity container
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](https://www.sylabs.io/guides/3.0/user-guide/quick_start.html#quick-installation-steps).
2. Then, follow the instructions from [here](https://github.com/roboticsleeds/ur5controller_singularity).Built from source on your own machine
If you wish to build this control on your host machine, you can find the instructions below.
#### Dependencies
- [ur_modern_driver](https://github.com/ThomasTimm/ur_modern_driver) needs to be installed on the computer that controls the robot and you need to run `roslaunch ur_modern_driver ur5_bringup.launch robot_ip:=THE_IP_OF_UR5_ROBOT`.
- You need to install the [openrave_catkin](https://github.com/personalrobotics/openrave_catkin).
- You need to install and configure another OpenRAVE plugin called `or_urdf` this plugin is available [here](https://github.com/personalrobotics/or_urdf). I have written a small guide on
how to install this plugin if you struggle to find a solution, find the tutorial [here](https://gist.github.com/rpapallas/171cad0e881769647d0851b8780cc545).
- **(OPTIONAL)** Install the Robotiq controller.
1. `cd ~/catkin_ws/src`
2. `git clone [email protected]:ros-industrial/robotiq.git`
3. `cd robotiq`
4. `git checkout indigo-devel`
5. `rosdep install robotiq_modbus_tcp`
6. `sudo apt-get install ros-indigo-soem`
7. `cd ~/catkin_ws`
8. `catkin_make`#### Installation
- Go to your catkin worksapce e.g `cd ~/catkin_ws/src` and clone this repository: `git clone [email protected]:roboticsleeds/ur5controller.git`
- Add the following line in your `~/.bashrc` file located under your home
directory by running the following command in the terminal: `echo
'export OPENRAVE_PLUGINS=$OPENRAVE_PLUGINS:~/catkin_ws/devel/share/openrave-0.9/plugins' >> ~/.bashrc`
- Run `source ~/.bashrc`.
- Go to your catkin workspace `cd ~/catkin_ws` and run `catkin_make`. You should
see a successful message on build in which case you are ready to go. If you get
any errors at this stage, please review what went wrong.
- Add in your `.bashrc` the Python path to the UR5 class by running
```bash
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.## 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:
Show code
```python
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.
## 6. Controller explained
1. Load the robot in OpenRAVE using the URDF plugin:Show code
```python
import IPythonenv = 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)
```2. You now need to attach the controllers (UR5 and the Robotiq controllers) to
the robot using the `MultiController`.Show code
```python
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.## 7. Other Notes
Checking ROS topics for attaching controllers
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](https://stackoverflow.com/questions/49552755/openrave-controllerbase-is-blocking-at-the-isdone-method-and-never-returns/49552756#49552756)
## 8. TroubleshootingRuntimeError: maximum recursion depth exceeded while calling a Python object
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.
TypeError: argument of type 'Poly' is not iterable
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.
Executing the trajectory on the real robot causes unintended actions
**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).