Left ArrowBack to discussions page
brsystemesbrsystemes Posts: 6 Apprentice
Hello all and thanks for all your discussion.
I have a UR10 without any force sensor added and we can have different weight on the arm depending of a variable send by a programmable logic controller
How can I used this variable to set my load after I closed the grip?

Best Answer


  • matthewd92matthewd92 Posts: 756Founding Pro, Tactile Sensor Beta Testers Handy
    You can use the script command set_payload(m, CoG) and pass in the new payload in kg's.  With this command you should set both the new payload and new CoG if it's different than the tcp offset.  Call this when you close the gripper, when you open the gripper you can use it to set the payload back to the original weight.    If you only want to update the mass on the arm and not change the CoG you can use the set_payload_mass(m) function which only takes a mass.

    If you use the set_payload and do not pass a CoG, the CoG is set to the TCP offset.  If this is different than your actual CoG it will overwrite it with the new value so be careful.  If you only want to update the mass the best method is set_payload_mass.  

  • brsystemesbrsystemes Posts: 6 Apprentice
    yes  but I dont't know the m for the PAYLOAD this is a variable comming from communication beetween robot and programmable logic controller
  • brsystemesbrsystemes Posts: 6 Apprentice
    I had an UR engineer on phone and effectively we can use Payload with a variable
    Thanks to all for your precious help
  • matthewd92matthewd92 Posts: 756Founding Pro, Tactile Sensor Beta Testers Handy

    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 @[email protected]_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)

    You can then reference that within the script call such as 

    **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
    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.

    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.

  • brsystemesbrsystemes Posts: 6 Apprentice
    Thankyou very much Mattewd92
    great help
Sign In or Register to comment.
Left ArrowBack to discussions page