How to change payload and center of gravity settings using URScript
Why setting the active payload and center of gravity is important
Examples are valid for:
CB3 Software version: 3.3 and onwards
e-Series Software version: All versions
Note that newer software versions may behave differently.
This article is based on e-Series software version 5.5.1
Why setting the active payload and center of gravity is important
UR robots use the user-defined active payload and center of gravity (CoG) settings to correctly control the joint motors during Freedrive, jogging, and program execution. Incorrect settings can lead to incorrect movements which then lead to protective stops and damage to the robot as well as unsafe operation.
Installation TCP settings
The active payload and CoG set in the Installation TCP tab are the values used when a program starts execution. If the program is normally run with a gripper attached but the gripper is not holding a workpiece at the start of the program, then only the gripper’s weight should be considered in the Installation settings.
However, the Installation TCP tab settings are also used when moving the robot via Freedrive or jogging when a program is not being run. If the total payload changes during the programming process, such as teaching waypoints while the gripper is closed on a workpiece, these settings should be temporarily changed to reflect the total active payload and CoG of the gripper and workpiece before continuing to teach. Please be sure to set the payload back to just the gripper when the workpiece is released.
Changing the active payload and center of gravity during program execution
The recommended method to set the active payload and CoG while the program is running is by using URScript. There are three available functions:
- set_payload(mass, CoG)
- set_payload_mass(mass)
- set_payload_cog(CoG)
mass = payload weight in kilograms (kg)
CoG = a list of three positions [ Cx, Cy, Cz ] in meters (m)
The function set_payload() or both set_payload_mass() and set_payload_cog() should be used any time the payload settings change. This includes picking a workpiece and placing it or other situations such as changing tools. Please note that these functions are deprecated and replaced by set_target_payload() refer to the URScript manual for more details on these functions.
Best practices
It is recommended to assign all values that will be used to variables. By editing the variable name to an easy to understand label, your program will become easier to read and understand. Using variables also makes the program easier to edit. If a value changes, it is only necessary to change it in one place rather than editing each command individually. Furthermore, using variables helps avoid simple mistakes and typos that might occur when manually inputting number values directly.
Here is a screenshot of a sample program using these best practices. Each variable is declared and initialized in the BeforeStart sequence. Each time the tool is activated the active payload and CoG are modified to reflect either picking a workpiece or placing it.
In line 14, the active payload weight is set to include both the gripper (hand) and the workpiece (work). The two weights have been added inside the function to make it clear what this payload mass setting means. In line 21, after the workpiece has been placed, the command only contains the gripper (hand) weight.
Because CoG calculations are more complicated than simple addition, the combined CoG for the gripper and workpiece was pre-calculated and declared in the Payload Settings folder (line 7). In this case, a variable name was chosen to reflect this.
Because the workpiece (1.35kg) in this example is significantly heavier than the gripper (0.8kg) and its CoG is much farther from the robot’s tool flange (180mm vs 52mm), we see a significant change in the total CoG when the workpiece is grabbed, from 52mm to 132mm. This is why it is important to adjust the CoG (lines 15 and 22) in addition to the active payload mass.
Calculating the center of gravity
If the CoG of individual objects, such as a gripper and a workpiece, are known, the combined CoG can be calculated. For n objects, a single axis can be calculated using the following formula:
m = mass
d = distance from the center of the tool flange
For two objects, the formula expands to the following. The right-hand side shows the values for the gripper and workpiece in the previous screenshot example. Note that the units are kilograms (kg) and meters (m).
If the CoG of either the hand or the workpiece are not directly on the robot’s tool Z-axis, the X- and Y-axes should also be calculated in the same way.