Force_mode with servoj

UR5, software: 3.12

We are currently trying to use force_mode in place of our own force control. We have tested it using a method similar to the one described in Dynamic Force Control and everything seems to be functioning as expected.

We have tried incorporating the functionality into our own script, so far without any luck. See below for the relevant snippet of the script. We have preplanned the entire path. We are using the real time interface to pass every Q vector in this path to the UR every 8ms which is then moved towards using servoj.

We see no difference in the movement of the robot whether we start the force_mode thread or not. My question is whether servoj, or our method in general is somehow incompatible with force_mode? Is there a way to achieve the functionality shown below?

thread Force_properties_calculation_thread_1():
  force_mode_set_damping(0.1)
  while(True)
    force_mode(tool_pose(), [0, 0, 1, 0, 0, 0], [0.0, 0.0, 38.2, 0.0, 0.0, 0.0], 2, [0.1, 0.1, 0.5, 0.349, 0.349, 0.349])
    sync()
  end
end

def runServoQRealtime():
  textmsg("Start Block Servo realtime loop")

  global thread_handler_1 = run Force_properties_calculation_thread_1()

  while servoDataEnd == 0:
    q0 = read_input_float_register(24)
    q1 = read_input_float_register(25)
    q2 = read_input_float_register(26)
    q3 = read_input_float_register(27)
    q4 = read_input_float_register(28)
    q5 = read_input_float_register(29)
    q_full = [q0,q1,q2,q3,q4,q5]
    servoj( q_full , t=0.008, lookahead_time=0.1, gain=1100)
  end

  kill thread_handler_1
  end_force_mode()
  sync()

  textmsg("End Block Servo realtime loop")
end
1 Like

I had a similar problem.You can find the follow content in “scriptManual.pdf”.

Avoid movements parallel to compliant axes and high deceleration (consider inserting a short sleep command of at least 0.02s) just before entering force mode.

Have you got a good solution for this?
thanks.