jacknlliu / ur_modern_driver

The new driver for the UR3/UR5/UR10 robot arms from universal robots. A refactor version see https://github.com/Zagitta/ur_modern_driver
Apache License 2.0
1 stars 0 forks source link

ur_modern_driver

A new driver for the UR3/UR5/UR10 robot arms from Universal Robots. It is designed to replace the old driver transparently, while solving some issues, improving usability as well as enabling compatibility of ros_control.

Improvements

Installation

Just clone the repository into your catkin working directory and make it with catkin_make.

Note that this package depends on ur_msgs, hardware_interface, and controller_manager so it cannot directly be used with ROS versions prior to hydro.

Usage

The driver is designed to be a drop-in replacement of the ur_driver package. It won't overwrite your current driver though, so you can use and test this package without risking to break your current setup.

If you want to test it in your current setup, just use the modified launch files included in this package instead of those in ur_bringup. Everything else should work as usual.

If you would like to run this package to connect to the hardware, you only need to run the following launch file.

roslaunch ur_modern_driver urXX_bringup.launch robot_ip:=ROBOT_IP_ADDRESS

Where ROBOT_IP_ADDRESS is your UR arm's IP and XX is '5' or '10' depending on your robot. The above launch file makes calls to both roscore and the launch file to the urXX_description so that ROS's parameter server has information on your robot arm. If you do not have your ur_description installed please do so via:

sudo apt install ros-<distro>-ur-description

Where is the ROS distribution your machine is running on. You may want to run MoveIt to plan and execute actions on the arm. You can do so by simply entering the following commands after launching ur_modern_driver:

roslaunch urXX_moveit_config ur5_moveit_planning_executing.launch
roslaunch urXX_moveit_config moveit_rviz.launch config:=true

If you would like to use the ros_control-based approach, use the launch files urXX_ros_control.launch, where XX is '5' or '10' depending on your robot.

Note: If you are using the ros_control-based approach you will need 2 packages that can be found in the ur_driver package. If you do not have the ur_driver package in your workspace simply copy these packages into your workspace /src folder:

The driver currently supports two position trajectory controllers; a position based and a velocity based. They are both loaded via the launch file, but only one of them can be running at the same time. By default the velocity based controller is started. You can switch controller by calling the appropriate service:

rosservice call /universal_robot/controller_manager/switch_controller "start_controllers:
- 'vel_based_pos_traj_controller'
stop_controllers:
- 'pos_based_pos_traj_controller'
strictness: 1"

Be sure to stop the currently running controller either before or in the same call as you start a new one, otherwise it will fail.

The position based controller should stay closer to the commanded path, while the velocity based react faster (trajectory execution start within 50-70 ms, while it is in the 150-180ms range for the position_based. Usage without ros_control as well as the old driver is also in the 170ms range, as mentioned at my lightning talk @ ROSCon 2013).

Note that the PID values are not optimally tweaked as of this moment.

To use ros_control together with MoveIt, be sure to add the desired controller to the controllers.yaml in the urXX_moveit_config/config folder. Add the following

controller_list:
 - name: /vel_based_pos_traj_controller #or /pos_based_pos_traj_controller
   action_ns: follow_joint_trajectory
   type: FollowJointTrajectory
   default: true
   joints:
      - shoulder_pan_joint
      - shoulder_lift_joint
      - elbow_joint
      - wrist_1_joint
      - wrist_2_joint
      - wrist_3_joint

Using the tool0_controller frame

Each robot from UR is calibrated individually, so there is a small error (in the order of millimeters) between the end-effector reported by the URDF models in https://github.com/ros-industrial/universal_robot/tree/indigo-devel/ur_description and the end-effector as reported by the controller itself.

This driver broadcasts a transformation between the base link and the end-effector as reported by the UR. The default frame names are: base and tool0_controller.

To use the tool0_controller frame in a URDF, there needs to be a link with that name connected to base. For example:

<!-- Connect tool0_controller to base using floating joint -->
<link name="tool0_controller"/>
<joint name="base-tool0_controller_floating_joint" type="floating">
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <parent link=base"/>
  <child link="tool0_controller"/>
</joint>

Now, the actual transform between base and tool0_controller will not be published by the robot_state_publisher but will be taken from this driver via /tf.

NOTE: You need an up-to-date version of robot_state_publisher that is able to deal with floating joints, see: https://github.com/ros/robot_state_publisher/pull/32

Compatibility

Should be compatible with all robots and control boxes with the newest firmware.

Tested with:

*Real UR10 with CB2 running 1.8.14035

*Real UR5 with CB2 running 1.8.14035

*Simulated UR3 running 3.1.18024

*Simulated UR5 running 3.0.16471

*Simulated UR5 running 1.8.16941

*Simulated UR5 running 1.7.10857

*Simulated UR5 running 1.6.08725

Credits

Please cite the following report if using this driver

@techreport{andersen2015optimizing, title = {Optimizing the Universal Robots ROS driver.}, institution = {Technical University of Denmark, Department of Electrical Engineering}, author = {Andersen, Thomas Timm}, year = {2015}, url = {http://orbit.dtu.dk/en/publications/optimizing-the-universal-robots-ros-driver(20dde139-7e87-4552-8658-dbf2cdaab24b).html} }

The report can be downloaded from http://orbit.dtu.dk/en/publications/optimizing-the-universal-robots-ros-driver(20dde139-7e87-4552-8658-dbf2cdaab24b).html