Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

UR10e Force Mode and Reconnect through API

#1
Hello,

I have a python program that triggers a few Robodk force programs to run on a UR10e. The force programs are pretty simple:

force_program_1:
Code:
def force_program_1():
  force_mode(p[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, -125, 0, 0, 0], 2, [0.1, 0.1, 0.01, 0.1, 0.1, 0.1])
end

force_program_1()

force_program_2:
Code:
def force_program_2():
  force_mode(p[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 50, 0, 0, 0], 2, [0.1, 0.1, 0.01, 0.1, 0.1, 0.1])
  count = 0
  while count < 200:  # Run for n seconds   
    count = count + 1
    sync() # 2ms cycle
  end
  end_force_mode()
end

force_program_2()

Snippet of python program:
Code:
program_name = 'force_program_1'
prog = RDK.Item(program_name, ITEM_TYPE_PROGRAM)
prog.MakeProgram('', RUNMODE_MAKE_ROBOTPROG_AND_START)
   
robot.Disconnect()
robot.Stop()
robot.ConnectSafe(robot.robot_ip, max_attempts=1, wait_connection=1)
robot.Joints()

program_name = 'force_program_2'
prog = RDK.Item(program_name, ITEM_TYPE_PROGRAM)
prog.MakeProgram('', RUNMODE_MAKE_ROBOTPROG_AND_START)

robot.Disconnect()
robot.Stop()
robot.ConnectSafe(robot.robot_ip, max_attempts=1, wait_connection=1)
robot.Joints()


The problem I have is that the reconnection to the robot once the force programs are done is not repeatable. Sometimes it reconnects properly and I can continue with the rest of the python program. Sometimes I get this error in the image. I think I am doing something incorrect with the way I'm reconnecting to the robot. Am I unintentionally trying to connect to the robot as the robot is executing the force program and that's causing the connection fail? Or is it some other problem? Thanks!


Attached Files Image(s)
   
#2
Are you using the latest version of RoboDK?
Can you increase the max attempts to 2 or more and increase the wait_connection delay to 2 seconds?

Or maybe adding a 1 or 2 second delay before trying to connect should work.

Let us know if it works any better. If you still have issues, it would help us if you can provide the full log of the RoboDK connection and the robot controller log.
  




Users browsing this thread:
1 Guest(s)