lihuang3 / ur5_ROS-Gazebo

Universal Robot (UR5) Pick and Place Simulation in ROS-Gazebo with a USB Cam and Vacuum Grippers
441 stars 133 forks source link

How to use this in a real ur robot? #3

Closed WwYyFan closed 6 years ago

WwYyFan commented 6 years ago

I am new to ROS,, if I want to run in a real ur robot,how can I start?

Abduoit commented 6 years ago

@WwYyFan

Did you run it with gazebo first, I run the following without errors but the arm does not move !!

roslaunch ur5_notebook initialize.launch

python testvisionplanner.py
lihuang3 commented 6 years ago

@WwYyFan Please refer to https://github.com/lihuang3/ur3_ROS-hardware.git for hardware implementations. However, the hardware programs are based on UR3 instead of UR5. We are going to polish our ROS repos after ICRA 2019 submissions.

lihuang3 commented 6 years ago

@Abduoit I suggust try the following code first, https://github.com/lihuang3/ur5_ROS-Gazebo/blob/master/src/motionplanner2.py. Sometimes Cartesian path planning might not work because of the joint limit settings in UR configurations. The default [-pi, pi] joint range may not work for some planned goals.
We are going to polish our ROS repos after ICRA 2019 submissions.

Abduoit commented 6 years ago

@lihuang3 I already run this, it is working fine. I was thinking to run the tracking part with red box, to understand more the code. I am interested more with vision tracking and kinematics.

WwYyFan commented 6 years ago

@Abduoit @lihuang3 I have run it with gazebo first,the arm can move , but can't visually track red boxes .

roslaunch ur5_notebook initialize.launch

python testvisionplanner.py
lihuang3 commented 6 years ago

@WwYyFan Only red box detection and motion planning modules are tested in this .py file. To follow/track the red box, please refer to ur5_vision.py and ur5_mp.py

WwYyFan commented 6 years ago

@lihuang3 Thanks for your reply. I have try ur5_vision.py, but the arm does not move and terminal does not have any output , when I try ur5_mp.py,the terminal output 2018-09-13 09-48-23

how to fix it ?

lihuang3 commented 6 years ago

@WwYyFan Because those are not standalone files. The proper way to run it is using roslaunch command:

roslaunch ur5_notebook initialize.launch
WwYyFan commented 6 years ago

@lihuang3 I have roslaunch ur5_notebook initialize.launch before python ur5_mp.py

lihuang3 commented 6 years ago

@WwYyFan That's weird. Does Gazebo display the conveyor and moving red boxes?

Haoran-Zhao commented 6 years ago

And did you see the camera view window?

On Wed, Sep 12, 2018 at 9:07 PM WwYyFan notifications@github.com wrote:

@lihuang3 https://github.com/lihuang3 I have roslaunch ur5_notebook initialize.launch before python ur5_mp.py

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lihuang3/ur5_ROS-Gazebo/issues/3#issuecomment-420858744, or mute the thread https://github.com/notifications/unsubscribe-auth/AQFkEAffqe9q0ZDCfDDi_se10VLn-JMuks5uab37gaJpZM4WlHd5 .

-- Haoran Zhao

Graduate Research Assistant

Electrical & Computer Engineering, University of Houston

WwYyFan commented 6 years ago

@lihuang3 yes, Gazebo display the conveyor and moving red boxes. 2018-09-13 10-16-15

WwYyFan commented 6 years ago

@Haoran-Zhao I can't see the camera view window

lihuang3 commented 6 years ago

@WwYyFan When zooming in the screenshot, I cannot see the green camera module on the end-effector. There might be something wrong with the camera module. capture

lihuang3 commented 6 years ago

@WwYyFan When you use roslaunch, all related nodes for this demo would be initialized. So you don't need to run .py files separately. Please check the camera module in URDF or related files. It seems the camera is not configured.

WwYyFan commented 6 years ago

@lihuang3 I check the conveyor_belt.sdf , Can't find anything about the camera module,Is the code you uploaded incorrect?

lihuang3 commented 6 years ago

@WwYyFan It should be within these two files:

      ur5_ROS-Gazebo/src/ur_description/ur5.urdf.xacro
      ur5_ROS-Gazebo/src/ur_description/common.gazebo.xacro

You can either replace the default files in UR5/ur_description with these files, or grab the camera module config and insert it into the default files.

Besides, your vacuum gripper module is missing too.

WwYyFan commented 6 years ago

@lihuang3 I have added the file to that location , but still can't not see the camera .

WwYyFan commented 6 years ago

@lihuang3 I check the initialize.launch again and can't not find where to load ur5_joint_limited_robot.urdf.xacro

Haoran-Zhao commented 6 years ago

I dont have my computer right, but if you look at the launch file there is a section for spawning ur5 model. It’s in another folder for universal robot. Your will find them under ur5 folder. You can try to search ur_description in the workspace folder.

On Wed, Sep 12, 2018 at 10:43 PM WwYyFan notifications@github.com wrote:

@lihuang3 https://github.com/lihuang3 I check the initialize.launch https://github.com/lihuang3/ur5_ROS-Gazebo/launch/initialize.launch again and can't not find where to load ur5_joint_limited_robot.urdf.xacro https://github.com/lihuang3/ur5_ROS-Gazebo/src/ur_description/ur5_joint_limited_robot.urdf.xacro

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/lihuang3/ur5_ROS-Gazebo/issues/3#issuecomment-420873726, or mute the thread https://github.com/notifications/unsubscribe-auth/AQFkEEETfSIp-MiyddpJ5LTJ6KKKBwlvks5uadRfgaJpZM4WlHd5 .

-- Haoran Zhao

Graduate Research Assistant

Electrical & Computer Engineering, University of Houston

lihuang3 commented 6 years ago

@WwYyFan The Universal Robot itself should call .xacro file, not initialize.launch. Please refer to the offical launch file: ur5_upload.launch and the default .xacro files common.gazebo.xacro, ur5.urdf.xacro

If you can wait till next week, we would provide a step-by-step readme to reproduce the results. Thank you for your patience.

WwYyFan commented 6 years ago

@lihuang3 Thanks a lot , I will wait until next week.

WwYyFan commented 6 years ago

Looking forward to your update

Abduoit commented 6 years ago

I am getting same as @WwYyFan the conveyor is moving with red boxes, but there is no camera mounted on the arm.

WwYyFan commented 6 years ago

@lihuang3 Thanks for your update, I have done it with the new README.md , I can see the camera module and vacuum gripper module now ,but the robotic arm can only pick up the red box and cannot put it in the bule box. and the terminal output error message:

[ERROR] [1537234590.091685889, 28.220000000]: Trajectory message contains waypoints that are not strictly increasing in time.
[ WARN] [1537234590.091792380, 28.220000000]: Controller  failed with error code INVALID_GOAL
[ WARN] [1537234590.091825310, 28.220000000]: Controller handle  reports status FAILED
[ INFO] [1537234590.091851421, 28.220000000]: Completed trajectory execution with status FAILED ...
[ INFO] [1537234590.091920918, 28.220000000]: Execution completed: FAILED
gripper status = True
[ERROR] [1537234590.092339, 28.221000]: bad callback: <bound method ur5_mp.tracking_callback of <__main__.ur5_mp instance at 0x7f091931f878>>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/efun/git/learn/ur_learn/src/ur5_ROS-Gazebo/ur5_mp.py", line 174, in tracking_callback
    self.execute()
  File "/home/efun/git/learn/ur_learn/src/ur5_ROS-Gazebo/ur5_mp.py", line 236, in execute
    self.arm.set_joint_value_target(self.transition_pose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_commander/move_group.py", line 227, in set_joint_value_target
    raise MoveItCommanderException("Error setting joint target. Is the target within bounds?")
MoveItCommanderException: Error setting joint target. Is the target within bounds?
lihuang3 commented 6 years ago

@WwYyFan According to

 line 227, in set_joint_value_target
    raise MoveItCommanderException("Error setting joint target. Is the target within bounds?")
MoveItCommanderException: Error setting joint target. Is the target within bounds?

Did you change the joint limit as mentioned in the tutorial?

  shoulder_pan_lower_limit="${-2*pi}" shoulder_pan_upper_limit="${2*pi}"

Or you can try to set all joint limit to [-2pi, 2pi] inur5_joint_limited_robot.urdf.xacro

WwYyFan commented 6 years ago

@lihuang3 Thanks a lot , I modify the ur5_joint_limited_robot.urdf.xacro , and it's work now.I will close this issue, thank you for your guidance during this time.

lihuang3 commented 6 years ago

@WwYyFan Sounds great!

WwYyFan commented 6 years ago

@lihuang3 I will try ur3_ROS-hardware next.If I encounter a problem, I will ask you again.Thank you or your help !