Universal Robots Forum

Movement when dynamically changing force mode compliant axis

Hi all.
I’m trying to dynamically control which axis are compliant during force mode, however I’m having an issue with non-compliant axis becoming compliant.
Currently I have integrated with the xml-rpc library and am using it to get the compliant axis list from an external server. Some example code can be seen below:

def loop():
  rpc= rpc_factory("xmlrpc", "http://IPADDRESS:3000/RPC")
  while (rpc.isConnected()):
    currentAxis = rpc.getForceParams()
    wrench = [0,0,0,0,0,0]
    force_mode(p[0.0,0.0,0.0,0.0,0.0,0.0],  currentAxis,  [ 0, 0, 0, 0, 0, 0 ],  2, [ 0.15, 0.15, 0.15, 0.15, 0.15, 015 ])
  end
end

It seems if there is an external force on a non-compliant axis, say the z-axis, just before the axis then becomes compliant and the force is then released, the TCP of the robot will move in the opposite direction of the force that was previously applied.

For example:

I set force_mode to the following:

force_mode(p[0.0,0.0,0.0,0.0,0.0,0.0], [0,1,0,0,0,0], [0,0,0,0,0,0], 2, [0.02, 0.15, 0.02, 0.02, 0.02, 0.02])

I then apply a force of -15N to the z-axis.
I then apply the new force mode, making the z-axis compliant, whilst stopping force applied to the z-axis:

force_mode(p[0.0,0.0,0.0,0.0,0.0,0.0], [0,1,1,0,0,0], [0,0,0,0,0,0], 2, [0.02, 0.15, 0.02, 0.02, 0.02, 0.02]) 

The TCP will now move in the positive z direction with a force of 15N.

It is my understanding that this last behavior should not happen. Is this indeed the case? If so, is there a way to stop the TCP from moving when switch a non-compliant axis to a compliant axis?

Thanks in advance!