DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
matthewd92

Hi, 

You can use a thread who will read the value that you will send to your robot with your PLC. You can put that value into a variable. Then, as Matthew said, when you close your gripper you can call this function with your variable instead of a fix number. 

What is the communication protocol are you using between your PLC and your robot ?
The way that @PE_@PE_Germain recommended works but there is a simpler way that does not clog up the variables screen with a variable that is just transferring a value that is already accessible. 

You can put the register where you are storing the value from the PLC directly into the script call.  No need to create a variable and a thread to manage the value stored at the variable.

If you are storing your weight in a GP_Float register such as this (which I would recommend so that you do not have to have integer weight)

zoom

You can then reference that within the script call such as 

zoom
**Please excuse the typo.**

 If you have a need to see the value on the UR then you would need to put it into a variable.  You could write your own custom script such as 

def my_set_payload_mass(m):
  global payload_current = m
  set_payload_mass(m)
end
I saved the above file as payloadScript.script.

Then when you call it in the program like below it would write the value passed to the function to the global variable called payload_current and would appear in the variables list.  This would prevent you from needing a thread to be running continuously to pass the value from the PLC to a variable but only change it when its actually changed on the robot.

zoom

Notice in the before start section of the program I have a script which is loading the custom script that I created.  You can create the script on that line by changing the option in the upper right from line to file, then type in what you want and save it as a file.  You can also just create the file on a computer and transfer to the robot then open it.  You need to include it here so that the definition of the function is included in the program script when it is created.

Just make sure that if the payload is significant that you return the payload back to just the end effector weight when you let go of the part.  I like to change payloads anytime the empty and part in hand weight differ by more than 500 grams.  If I am running a robot fast, I will make the change if the weight difference is more than 100-200 grams.