Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Using RoboDk to Control Robotiq 2f-85 Gripper

#1
I have made a program in RoboDk to do a simple Pick-And-Place operation. However when I run it on the robot the gripper does not seem to close. Something I thought of was that I could use a Python script in RoboDk to send a value to the TM Flow listen node whenever I want it to perform a grip action and another value to perform a release action. I wanted to ask if there's any examples of this I could refer to? Thank you in advance.
#2
You'll find the procedure to use a RobotiQ gripper with a UR robot here:
https://robodk.com/forum/Thread-RobotIQ-...ugh-RoboDK
#3
(03-10-2023, 04:00 PM)Benjamin Wrote: I have made a program in RoboDk to do a simple Pick-And-Place operation. However when I run it on the robot the gripper does not seem to close. Something I thought of was that I could use a Python script in RoboDk to send a value to the TM Flow listen node whenever I want it to perform a grip action and another value to perform a release action. I wanted to ask if there's any examples of this I could refer to? Thank you in advance.

I am not sure fully understand the steps that Jeremy mentioned. I unzipped the file in the specified location. Should I then connect to the robot itself in RoboDK or the gripper mechanism itself? Should I interact with the unzipped script in anyway? Or should it just work like normal ie setting up a target to open/close the mechanism and run on robot as seen in program 10 in the image pasted.
#4
(03-11-2023, 02:24 PM)Albert Wrote: You'll find the procedure to use a RobotiQ gripper with a UR robot here:
https://robodk.com/forum/Thread-RobotIQ-...ugh-RoboDK

I have checked out the thread. however I am using a TM-14 robot with a 2F-85 gripper. I am not sure if this functions differently but I cant seem to get the program to work. When I tried using robot.RunInstruction('RQ_2FG_Open', INSTRUCTION_CALL_PROGRAM ), there was nothing happening. Maybe I implemented it in a wrong way. I am now trying to use the TM Flow program to listen to incoming values using the network node. I basically set it to 
Start>Listen>Network>if>gripperclose (yes route)
                                      >return to Listen node (no route)

The network node was set up to receive string variables from my computer connected to the socket using the ethernet poron the robot controller. The "yes" route for the if-block was set to if it receives a value "1" from the socket of my computer. I am basically trying to get the robot to follow the movements set in RoboDK then when I need to pick and place an object, I would run a command that sends a "1" to the controller. However right now, using the python script below, from what I observe, the code sends the "1" value but the gripper does not close. Can I get some recommendation on how to fix this?

Below is the code used. 
import socket

HOST = '(IP Address)'  # replace with your server's IP address or hostname
PORT = 5890  

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
    server.bind((HOST, PORT))
    server.listen()
    print(f"Listening for connections on {HOST}:{PORT}")
    communication_socket, address = server.accept()
    print(f"Connected to {address}")

    communication_socket.sendall(b'1')
    print('sent')
    data = communication_socket.recv(1024)

print('Received', repr(data)) 
#5
The procedure I shared was for a Universal Robot controller, not an Omron-TM robot.

If you use the driver in RoboDK (I believe this is what you are trying to do) you should be able to communicate with your gripper or any device via sockets by triggering a call to a script like the one you shared.

However, it is unclear to me if you need a server socket connection or a client connection. If the robot is waiting for commands you probably need a socket client to connect to the TM robot (server).

Also, if it expects a string I would try adding a new line character or some line ending to indicate the end of the string. Example:

Code:
import socket

HOST = "127.0.0.1" <-- The robot IP
PORT = 5890        # The port used by the robot server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
   s.connect((HOST, PORT))
   str2send = "1\n"
   s.sendall(str2send.encode("utf-8"))
   data = s.recv(1024)
   print("Received:")
   print(data)
#6
(03-16-2023, 10:21 AM)Albert Wrote: The procedure I shared was for a Universal Robot controller, not an Omron-TM robot.

If you use the driver in RoboDK (I believe this is what you are trying to do) you should be able to communicate with your gripper or any device via sockets by triggering a call to a script like the one you shared.

However, it is unclear to me if you need a server socket connection or a client connection. If the robot is waiting for commands you probably need a socket client to connect to the TM robot (server).

Also, if it expects a string I would try adding a new line character or some line ending to indicate the end of the string. Example:

Code:
import socket

HOST = "127.0.0.1" <-- The robot IP
PORT = 5890        # The port used by the robot server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
   s.connect((HOST, PORT))
   str2send = "1\n"
   s.sendall(str2send.encode("utf-8"))
   data = s.recv(1024)
   print("Received:")
   print(data)

When I ran the code that was sent, I ran into the error 
"[font=Söhne, ui-sans-serif, system-ui, -apple-system,][WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
 File "C:\Users\Ben\AppData\Local\Temp\prog18.py", line 9, in <module>
   s.sendall(str2send.encode("utf-8"))" 

[/font]

[font=Söhne, ui-sans-serif, system-ui, -apple-system,]I have tried using the RoboDK driver to control the gripper for example I set the gripper(Mechanism) to an open position and made a target for the gripper and a closed one and made a target. I then made a program and tried to run it on the robot but nothing happened. I was wondering if there was any other way to do this? Thank you.[/font]
#7
This was a quick proof of concept. You may need to adjust the sample script I provided.

Maybe you need to make sure the IP is correct and make sure the connection succeeded before sending data.
  




Users browsing this thread:
2 Guest(s)