Applied Force growing when in Loop

We are programming a UR10e to polish weld seams and would like it to go back and forth along the weld a predetermined number of times.

We are using Force Mode to apply uniform force on the surface, and so the cobot adjusts as the weld seam is flattened. However, we have found that if the Force is nested inside of a loop, the Force grows with each passing loop which is not what we want, it should stay uniform. (We confirmed this by printing out the values of get_force_val(), and it grew each time.)

We are unsure why this is happening and how to avoid it. If the Loop is nested inside of the Force, we do not have this problem, but this is undesirable as we need to program some movements in the Loop that do not have Force mode activated.

I feel like I remember seeing this as well when we did a similar grinding application. I can’t remember how/if we fixed it. You can try putting “end_force_mode()” at the end of the loop, to maybe stop it and restart it. Or use the “zero_ftsensor()” command to zero out the sensor. It’s accumulating force somehow, so trying to reset it would be my suggestion.

The Force template node issues a zero_ftsensor() script command each time it is executed. Rather than placing the Force template in the Loop, place the Loop in your Force template node.

Alternatively, you can use the script version of force mode, and issue your own zero and end force mode commands where needed. These script functions are available in the script manual on the downloads page.