In dynamic force mode,how to move in compliant axis

Application scenario: Push TCP along a dynamically calculated direction D, and restrict TCP to move only in the D direction.
Current solution: Update D value by RpcServer in dynamic force mode (Refer to Universal Robots - URScript: Dynamic Force Control), control TCP move to target pose P through ‘servoj’.
Problem: It can’t move along D in dynamic force mode.
Question: How can I move TCP(by code) in compliant axis under dynamic force mode.

You need to decide if you want to servo on force (force mode) or position (move commands). You cannot do both as their solutions would be different.

Here are some options:

  1. In force mode you can limit the speed of motion in a complient direction.
  2. In force mode you can monitor the distance travelled in a thread and terminate the force mode when you have achieved your desired position.
  3. When making moves without force mode, you can monitor force in a thread an stop the move if the force reaches a threshold.