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

**URL:** https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147
**Category:** URScript
**Created:** [August 3, 2016, 4:08pm UTC](https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147 "2016-08-03T16:08:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anon2960714](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@anon2960714](https://forum.universal-robots.com/u/anon2960714)
#### Post date: [August 3, 2016, 4:08pm UTC](https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147/1 "2016-08-03T16:08:02Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/697219cbcbecdf812437822ac3b02e4651966379.jpg)

---

<div class="post-metadata">

### Author: ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)
#### Post date: [August 4, 2016, 7:07am UTC](https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147/2 "2016-08-04T07:07:46Z")

</div>

@anon2960714,

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](http://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/urscript-dynamic-force-control-20571/) 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](http://forum.universal-robots.com/t/base-coordinate-system-documentation/140/2) and with 15 Newtons of force, the script code could look like:

```auto
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.

 ![](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/16c44c644d5a8c756eefac78f741700164910570.jpg)

---

<div class="post-metadata">

### Author: ![anon2960714](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@anon2960714](https://forum.universal-robots.com/u/anon2960714)
#### Post date: [August 5, 2016, 9:30am UTC](https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147/3 "2016-08-05T09:30:41Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![highouse1990](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@highouse1990](https://forum.universal-robots.com/u/highouse1990)
#### Post date: [May 21, 2021, 2:23pm UTC](https://forum.universal-robots.com/t/ur-script-function-force-mode-task-frame-selection-vector-wrench-type-limits/147/4 "2021-05-21T14:23:09Z")

</div>

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