Code Monkey home page Code Monkey logo

ur5_simulation's Introduction

UR5 Simulation

Overview

This ROS package aims to provide an environment to spawn the UR5 arm with Robotiq 2F 140 Gripper on a Gazebo world with two tables and a beer can, as can seen below.

Example image

Keywords: ur5, robotiq, gazebo

License

The source code is released under a MIT license.

Author: Mateus Menezes
Maintainer: Mateus Menezes, [email protected]

The ur5_simulation package has been tested under [ROS] Melodic on Ubuntu 18.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.

Installation

Building from Source

Dependencies

Clone each package in your catkin_ws:

cd catkin_ws/src
git clone --branch melodic-devel https://github.com/ros-industrial/universal_robot.git
git clone --branch improve-transmission-xacro https://github.com/mateusmenezes95/robotiq.git
git clone https://github.com/roboticsgroup/roboticsgroup_upatras_gazebo_plugins.git

Building

To build from source, clone the latest version from this repository into your catkin workspace and compile the package using

cd catkin_ws/src
git clone https://github.com/mateusmenezes95/ur5_simulation
cd ../
rosdep install --from-paths . --ignore-src
catkin_make

Note: You can also use the catkin tools to build the packages. It is my preference!

Usage

Run only the Gazebo simulation:

roslaunch ur5_simulation ur5.launch

The same launch file enables to open two ROS tools: RViz and rqt_joint_trajectory_controller. In RViz you will see the frames of the robot based in kinematic evaluation using Denavit-Hartenberg notation. In the rqt you can controll the robot's joints and gripper individually.

If you want open RViz and the Joint Trajectory controller GUI, run:

roslaunch ur5_simulation ur5.launch open_rviz:=true open_joint_trajectory_controller_gui:=true

Config files

Launch files

  • ur5_upload.launch: Load the UR5 and Robotiq 2F 140 Gripper

    • ur5_transmission_hw_interface: Hardware interface used in UR5 joints control by gazebo-ros-control. (default: hardware_interface/PositionJointInterface).
    • eef_transmission_hw_interface: Hardware interface used in Robotiq Gripper joints control by gazebo-ros-control. (default: hardware_interface/PositionJointInterface).
  • ur5.launch: Launch the UR5 Gazebo simulation

    • gripper_controller_type: Gripper joint controller. Choose for effort or position. (default: position).
    • open_rviz: Gripper joint controller. Choose for effort or position. (default: false).
    • open_joint_trajectory_controller_gui: Open rqt gui to control the UR5 and Robotiq Gripper joints. (default: false).

Example

It was also created in this package a simple node to use the simulation. The node aims to compare the kinematics evaluations provided by the ROS ecosystem and the evaluations done “by hand”, both using the Denavit-Hartenberg notation (this explains the statics tfs put in ur5.launch). It reads from the config a list of joints state to send to the arm controller and get the forward kinematic using the ROS tf2 and the inverse kinematic reading from /joint_states topic. In the end of the algorithm, a chart is generated to show the difference between the kinematic performed by hand and performed in the ROS. The GIF below shows one step of the algorithm.

GIF Explanation

This is just an example of what could be tested using this simulation environment. Feel free to implement your own algorithm.

Example usage

First launch the UR5 simulation as explained above. After that, run:

roslaunch ur5_simulation kinematics_evaluations.launch

Wait until the arm perform all movements listed in the arm_kinematics joints set.

Bugs & Feature Requests

Please report bugs and request features using the Issue Tracker.

ur5_simulation's People

Contributors

mateusmenezes95 avatar rafaelsqueiroz avatar matosinho avatar

Stargazers

Russell avatar  avatar  avatar Zhifeng Qian avatar  avatar luckyhwp avatar  avatar 李涛 avatar Caio Amaral avatar  avatar

Watchers

 avatar

Forkers

hwpengtristin

ur5_simulation's Issues

Joint controller with execution issues

The exeception in line 48 of joint_controller.py is not working because ROSExecption is not recognized. I changed from:
except ROSException as error: to except rospy.exceptions.ROSException as error:

But then another problem happened:

[ERROR] [1621224970.628369]: timeout exceeded while waiting for message on topic /joint_states
Traceback (most recent call last):
  File "/ros_workspaces/ws_ur5_project/src/ur5_simulation/scripts/joints_controller_node.py", line 43, in <module>
    if max(abs(joint_set - joint_controller.get_joints_state())) < 0.05:    # avoid unnecessary movement
  File "/ros_workspaces/ws_ur5_project/src/ur5_simulation/src/ur5_simulation/joint_controller.py", line 95, in get_joints_state
    return np.array(self.__get_joints_state_ordered().position)
AttributeError: 'NoneType' object has no attribute 'position'

I'm wondering if the updated file was merged in the last PR.

Wrong calculations in inverse kinematics

Method calculate_inverse_kinematics, from #5, is not reliable. For a certain dh matrix, it outputs the proper joint angles, whilst for others it doesn't.

Examples below:

for q = [0, -1.57, 0, 0, 0, 1.32]:

tf:
[[ 0.969 0.247 0. -0.095]
[-0. 0. -1. -0.191]
[-0.247 0.969 0. 0.906]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 0.00 0.089159 0.00000 0.000000
i2 -1.57 0.000000 0.00000 1.570796
i3 0.00 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 0.00 0.094650 0.00000 1.570796
i6 1.32 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[-0.004 -1.891 0.942 0. 0.004 2.892]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [1.2, -0.47, 0.73, 0, 0, 1.32]:

tf:
[[-0.003 -0.362 0.932 -0.087]
[-0.009 -0.932 -0.362 -0.753]
[ 1. -0.009 0. 0.089]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 1.20 0.089159 0.00000 0.000000
i2 -0.47 0.000000 0.00000 1.570796
i3 0.73 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 0.00 0.094650 0.00000 1.570796
i6 1.32 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[ 1.201 -0.549 0.88 0. 0.018 1.58 ]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [0, -1.57, 0, 0, 0, 1.57]:

tf:
[[ 1. 0. 0. -0.095]
[-0. 0. -1. -0.191]
[ 0. 1. 0. 0.906]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 0.00 0.089159 0.00000 0.000000
i2 -1.57 0.000000 0.00000 1.570796
i3 0.00 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 0.00 0.094650 0.00000 1.570796
i6 1.57 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[-0.004 -1.891 0.942 0. 0.004 3.142]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [1.64, -0.45, 0.45, 0, 3.14, 1.57]:

tf:
[[ 0. -0.071 -0.997 0.08 ]
[-0.001 0.997 -0.071 -0.771]
[ 1. 0.001 -0. 0.179]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 1.64 0.089159 0.00000 0.000000
i2 -0.45 0.000000 0.00000 1.570796
i3 0.45 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 3.14 0.094650 0.00000 1.570796
i6 1.57 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[ 1.64 -0.452 0.456 0. 3.111 1.57 ]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [0, -1.57, 0, 0, 0, 1.57]:

tf:
[[ 1. 0. 0. -0.095]
[-0. 0. -1. -0.191]
[ 0. 1. 0. 0.906]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 0.00 0.089159 0.00000 0.000000
i2 -1.57 0.000000 0.00000 1.570796
i3 0.00 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 0.00 0.094650 0.00000 1.570796
i6 1.57 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[-0.004 -1.891 0.942 0. 0.004 3.142]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [1.39, -0.87, 1.41, -0.5, 1.32, 0]:

tf:
[[ 0.998 -0.007 0.07 0.004]
[ 0.07 -0.039 -0.997 -0.698]
[ 0.01 0.999 -0.039 0.115]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 1.39 0.089159 0.00000 0.000000
i2 -0.87 0.000000 0.00000 1.570796
i3 1.41 0.000000 -0.42500 0.000000
i4 -0.50 0.109100 -0.39225 0.000000
i5 1.32 0.094650 0.00000 1.570796
i6 0.00 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[ 1.39 -0.872 1.412 -0.5 1.32 -0. ]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

for q = [0, -1.57, 0, 0, 0, 1.57]:

tf:
[[ 1. 0. 0. -0.095]
[-0. 0. -1. -0.191]
[ 0. 1. 0. 0.906]
[ 0. 0. 0. 1. ]]

DH matrix:
θi di a(i-1) α(i-1)
i1 0.00 0.089159 0.00000 0.000000
i2 -1.57 0.000000 0.00000 1.570796
i3 0.00 0.000000 -0.42500 0.000000
i4 0.00 0.109100 -0.39225 0.000000
i5 0.00 0.094650 0.00000 1.570796
i6 1.57 0.082300 0.00000 -1.570796

Calculated inverse matrix from DH matrix:
[-0.004 -1.891 0.942 0. 0.004 3.142]

Missing dependency python-tk

It would be nice to add that python-tk is also a dependency in the readME dependency section. Here is the command that I've used to install it: apt-get install python-tk

Missing file common.gazebo.xacro in ur_description package

I encountered an issue while trying to run the ur5.launch launch file in the ur5_simulation package. The error message suggests that the file common.gazebo.xacro is missing in the universal_robot package, causing a file not found error during the launch process.

Steps to Reproduce:

  1. Clone the universal_robot package from the GitHub repository.
    
  2. Set up a ROS workspace and compile the packages.
    
  3. Run the ur5.launch launch file using the following command:
    

    roslaunch ur5_simulation ur5.launch

Expected Behavior:
The ur5.launch launch file should execute successfully without any file not found errors.

Actual Behavior:
The following error message is displayed:


xacro: in-order processing became default in ROS Melodic. You can drop the option.
No such file or directory: /home/hridwn1/pick_ws/src/universal_robot/ur_description/urdf/common.gazebo.xacro [Errno 2] No such file or directory: u'/home/hridwn1/pick_ws/src/universal_robot/ur_description/urdf/common.gazebo.xacro'
when processing file: /home/hridwn1/pick_ws/src/ur5_simulation/urdf/ur5_robotiq_eef_macro.xacro
included from: /home/hridwn1/pick_ws/src/ur5_simulation/urdf/ur5_robotiq_eef.xacro
RLException: while processing /home/hridwn1/pick_ws/src/ur5_simulation/launch/ur5_upload.launch:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/melodic/lib/xacro/xacro', '--inorder', '/home/hridwn1/pick_ws/src/ur5_simulation/urdf/ur5_robotiq_eef.xacro', 'ur5_transmission_hw_interface:=hardware_interface/PositionJointInterface', 'eef_transmission_hw_interface:=hardware_interface/PositionJointInterface']] returned with code [2].

Additional Information:

  • The file /home/hridwn1/pick_ws/src/universal_robot/ur_description/urdf/common.gazebo.xacro is missing in the universal_robot package.
    
  • I have verified that the correct path for the file is /home/hridwn1/pick_ws/src/universal_robot/ur_description/urdf/inc/common.gazebo.xacro.
    
  • I have already updated the file paths in ur5_robotiq_eef_macro.xacro and ur5_robotiq_eef.xacro files accordingly.
    
  • Despite updating the file paths, the error still persists.
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.