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

Hello,

in Polyscope I can use differnt types. Now I like to transfer the same functionality using the script methode force_mode.

I understand that in simple mode the movement is only in z- axis, that works fine.

Can you please tell me which parameters I have to pass when I want the “simple type”.
Is it possible to do the same in force mode using the Polyscope or the script method?

Can you please explain the difference or application examples for the other force control types?

My idea is to align a object with a surface, the robot should move until contact and then rotate the object until it is parallel to the surface. How would you do that, can I program this using UR Script.

Thanks in advance.

@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

Hello Jacob,

thanks very much for the quick reply.

I was able to use the script method force_mode(…) instead of the GUI.

Thanks very much!

Hello, jbm,
How could I determin x/y/z axis of the real force control reference frame?