SintefManufacturing / python-urx

Python library to control a robot from 'Universal Robots' http://www.universal-robots.com/
GNU Lesser General Public License v3.0
520 stars 272 forks source link

How to use the Object Detection Feature of the Robotiq Grippers from urx script. #58

Open masmura opened 5 years ago

masmura commented 5 years ago

I'd like to use the object detection feature of the Robotiq Gripper from python script. When the gripper grasps some object, I want to get the OBJ value (and POS). I executed bellow script, but the last POS and OBJ are both the values when the gripper was fully close despite grasping object.

UR5 + Robotiq 2F-85


import socket import time import urx from urx.robotiq_two_finger_gripper import Robotiq_Two_Finger_Gripper

rob = urx.Robot("192.168.0.100") robotiqgrip = Robotiq_Two_Finger_Gripper(rob)

PORT = 63352 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("192.168.0.100", PORT))

s.send(b"socket_send_string(\"GET POS\", \"gripper_socket\")") data = s.recv(1024) print(data)

robotiqgrip.open_gripper() time.sleep(2.)

s.send(b"socket_send_string(\"GET POS\", \"gripper_socket\")") data = s.recv(1024) print(data)

robotiqgrip.close_gripper() time.sleep(2.)

s.send(b"socket_send_string(\"GET POS\", \"gripper_socket\"") data = s.recv(1024) print(data) s.send(b"socket_send_string(\"GET OBJ\", \"gripper_socket\")") data = s.recv(1024) print(data)

s.close()

Thank you for your help.

dlerner97 commented 3 years ago

Did you ever find a solution?