UR Script function: force mode(task frame, selection vector, wrench, type, limits)

@generalmidi,

Everything you can do in the Force Mode GUI node, can also be achieved in URScript, since the GUI node eventually just translates into a few lines of script code.

This article explains a bit more about the force_mode() script command.

The force mode commands has the syntax:
force_mode( feature, compliance, force, type, limits)
Where:

  • feature is a pose variable, could typically be tool_pose() if relative to the tool, or any other Feature/refrence frame that the user selects.
  • compliance is a 6D list of 0/1’s of which axis are force compliant, e.g. [0, 0, 1, 0, 0, 1] for compliance in Z and RZ relative to the given feature.
  • force is a 6D list of desired forces and torques, e.g. [0.0, 0.0, 15.0, 0.0, 0.0, 6.0] for 15 N in Z and 6 Nm in RZ.
  • type is an integer describing the transformation of forces, relative to the feature. 2 = no transformation, hence use 2 for frame force or simple force. 1 = point force, and 3 = motion force.
  • limits is a 6D list of limits. If the axis is compliant, e.g. Z and RZ above, the limit is a speed limit in respectively m/s and rad/s. If the axis is non-compliant, the limit specifies the allowed deviation from the original frame in m and rad.

For the simple type force relative to the Tool Feature and with 15 Newtons of force, the script code could look like:

force_mode( tool_pose(), [0,0,1,0,0,0], [0.0, 0.0, 10.0, 0.0, 0.0, 0.0], 2, [0.1, 0.1, 0.2, 0.17, 0.17, 0.17])
   # Insert your compliant movements here
end_force_mode()
stopl(5.0)

Typically, the use of frame force is the most common.
However uses of e.g. point force where the force is directed towards a point and not a “plane” is clever for applying force to an arc or circle to have the force parallel to the normal of the surface. See example below.

2 Likes