# ur5_ROS-Gazebo **Repository Path**: techat2021/ur5_ROS-Gazebo ## Basic Information - **Project Name**: ur5_ROS-Gazebo - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-18 - **Last Updated**: 2024-11-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### Implementation of UR5 pick and place in ROS-Gazebo with a USB cam and vacuum grippers.
This repository demonstrates UR5 pick-and-place in ROS and Gazebo. The UR5 uses a USB cam to detect a red box on a conveyor ([`ur5_vision.py`](https://github.com/lihuang3/ur5_ROS-Gazebo/blob/master/ur5_vision.py)), and publish its position. UR5 plans its motion ([`ur5_mp.py`](https://github.com/lihuang3/ur5_ROS-Gazebo/blob/master/ur5_mp.py)) to follow the box. Once the end-effector gets close enough to the box, it approaches the box with vacuum grippers turning on ([`ur5_gripper.py`](https://github.com/lihuang3/ur5_ROS-Gazebo/blob/master/ur5_gripper.py)). Since the vacuum gripper only provides limited force, we placed multiple grippers in order to lift the object.
- Video demos:
[`Simulation video`](https://youtu.be/Yj5DEocFa48)
[`Hardware video`](https://youtu.be/FAYPbAhYoXw)
- Hardware implementation in UR3:
[`ur3_ROS-hardware`](https://github.com/lihuang3/ur3_ROS-hardware.git)
- Update: based on feebacks from the community, we have made several key changes to this repository on 09/16/2018. Please update your code in case you have trouble reproducing the results.
- How to cite this repository:
```
Huang, L., Zhao, H., Implementation of UR5 pick and place in ROS-Gazebo with a USB cam and vacuum grippers, (2018), GitHub repository, https://github.com/lihuang3/ur5_ROS-Gazebo.git
```
or BibTex
```
@misc{Huang2018,
author = {Huang, L., Zhao, H.},
title = {Implementation of UR5 pick and place in ROS-Gazebo with a USB cam and vacuum grippers},
year = {2018},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/lihuang3/ur5_ROS-Gazebo.git}}
}
```
#### How to use this repository
- This project was tested in Ubuntu 16.04 with ROS kinetic.
- Make sure you have installed Python2.7 and some useful libraries/packages, such as Numpy, cv2, etc.
- Install ROS kinetic, Gazebo, universal robot, Moveit, RViz.
- Assuming your universal robot workspace is named as `ur_ws`, download the repository to `ur_ws/src/`
```
$ cd ur_ws/src
$ git clone https://github.com/lihuang3/ur5_ROS-Gazebo.git
```
- Under `ur_ws/src`, there are two folders: one is the official `universal_robot`, and the other is `ur5_ROS-Gazebo`. Open file `ur5_joint_limited_robot.urdf.xacro` under `ur_ws/src/universal_robot/ur_description/urdf/`, and __make the following change to the joint limit:__
```
shoulder_pan_lower_limit="${-2*pi}" shoulder_pan_upper_limit="${2*pi}"
```
- In the same directory, make a copy of `common.gazebo.xacro` and `ur5.urdf.xacro` in case of any malfunction.
These two default files do not include camera and vacuum gripper modules.
So we would replace these two files with customized files.
Under directory `ur_ws/src/ur5_ROS-Gazebo/src/ur_description/`, copy `common.gazebo.xacro` and `ur5.urdf.xacro` to `ur_ws/src/universal_robot/ur_description/urdf/`.
- Build the code under directory `ur_ws/`,
```
$ catkin_make
$ source devel/setup.bash
```
- Run the code with ROS and Gazebo
```
$ roslaunch ur5_notebook initialize.launch
```
- Things to work on: (1) vacuum grippers only provide limited force for lifting, so we had to use so many of them in order to pick up a light box. If you have any suggestions, please let us know. (2) UR5 motion planning is not in realtime, and hence you can ovserve a non-smooth motion of the end-effect in the camera view.
#### 0. References
- [__`GitHub: utecrobotics/ur5`__](https://github.com/utecrobotics/ur5) testing ur5 motion
- [__`Very useful ROS blog`__](http://www.guyuehome.com/column/ros-explore) ROS探索
- [__`ROS下如何使用moveit驱动UR5机械臂`__](http://blog.csdn.net/jayandchuxu/article/details/54693870)
- [__`ROS UR industrial`__](http://wiki.ros.org/universal_robot/Tutorials/Getting%20Started%20with%20a%20Universal%20Robot%20and%20ROS-Industrial)
- [__`ROS modern driver`__](https://github.com/iron-ox/ur_modern_driver)
- [__`ur_hardware_interface.cpp`__](https://github.com/iron-ox/ur_modern_driver/blob/883070d0b6c0c32b78bb1ca7155b8f3a1ead416c/src/ur_hardware_interface.cpp) Replace this cpp
if there is hardware interface error during catkin make
__######## Warning! The rest of this README is still under construction ###########__
#### 1. Universal Robot 5 Installation
[`Official installation tutorial`](http://wiki.ros.org/universal_robot)
The following command lines are for ur5 installation in ros-kinetic
```angularjs
mkdir -p ur5_ws/src
cd ur5_ws/src
# retrieve the sources
git clone -b kinetic-devel https://github.com/ros-industrial/universal_robot.git
cd ~/ur5_ws
# checking dependencies
rosdep install --from-paths src --ignore-src --rosdistro kinetic
# buildin,
catkin_make
# if there is any error, try
# pip uninstall em
# pip install empy
# source this workspace (careful when also sourcing others)
cd ~/ur5_ws
source devel/setup.bash
```
To run UR5 in Gazebo and rviz (`source devel/setup.bash`)
```angularjs
roslaunch ur_gazebo ur5.launch limited:=true
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true limited:=true
roslaunch ur5_moveit_config moveit_rviz.launch config:=true
```
To test UR5 motion, run [`testmotion.py`](src/testmotion.py)
Look into this link for [`straight line motion`](http://answers.gazebosim.org/question/15402/ur5-straight-line-motion/)
#### 2. Moveit
[`Official tutorial`](http://docs.ros.org/kinetic/api/moveit_tutorials/html/)
##### 2.0 Install Moveit
```
sudo apt-get install ros-kinetic-moveit
```
launch teh Moveit Setup Assistant
```
roslaunch moveit_setup_assistant setup_assistant.launch
1. Click on the "Create New MoveIt Configuration Package" button,click the "Browse" button, select the xacro file you created in the Previous Chapter, and click on the "Load Files" button.
PATH: /src/universal_robot/ur_description/urdf/ur5.urdf.xacro
2. Go to the "Self-Collisions" tab, and click on the "Regenerate Collision Matrix" button.
3. move to the "Virtual Joints" tab. Here, you will define a virtual joint for the base of the robot. Click the "Add Virtual Joint" button, and set the name of this joint to FixedBase, and the parent to world.
4. open the "Planning Groups" tab and click the "Add Group" button. Now, you will create a new group called manipulator, which uses the KDLKinematicsPlugin.
3. Move Group Python InterFace Tutorial[`Official tutorial`](http://docs.ros.org/indigo/api/moveit_tutorials/html/doc/pr2_tutorials/planning/scripts/doc/move_group_python_interface_tutorial.html)
```
##### 2.1 Use Moveit Interface
[`Move Group Interface Tutorial`](http://docs.ros.org/indigo/api/moveit_tutorials/html/doc/pr2_tutorials/planning/src/doc/move_group_interface_tutorial.html#cartesian-paths)
##### 2.2 Use Moveit in Python
[`Cartesian Path Planning`](src/motionplanner2.py)
Using the ur5 with the MoveIt Motion Planning Framework for quick motion planning.
Install the package from package management, and run the MoveIt! planning demo:
```angularjs
$ sudo apt-get install ros-kinetic-ur5-moveit-config
$ roslaunch ur5_moveit_config demo.launch
```
Our goal is to move the universal robot (ur5) end effector moving in straight line (Cartesian path) with Moveit-Python interface.