Hello, I am trying to apply admittance control to UR3e, and before that, I am trying following tutorial ([Universal Robots - URScript: Dynamic Force Control]) with python3 and ur_rtde ([Introduction — ur_rtde 1.5.0 documentation]). Following is the code i made:
import time import threading import rtde_control import rtde_receive rtde_c = rtde_control.RTDEControlInterface("robot_ip") rtde_r = rtde_receive.RTDEReceiveInterface("robot_ip") amp = 0.1 init_q = [pi/2, -pi/2, pi/2, -pi/2, -pi/2, pi/2] DT = 0.01 def fmode(): while True: rtde_c.forceMode([0,0,0,0,0,0],[1,1,1,0,0,0],[0,0,0,0,0,0],2,[50,50,50,5,5,5]) time.sleep(DT) rtde_c.moveJ(init_q, .5, .5) rtde_c.zeroFtSensor() global fm fm = threading.Thread(target=fmode) fm.daemon = True fm.start() init_pos = rtde_r.getActualTCPPose() print("main start") moveL(init_pos+[0.1,0,0,0,0,0],0.5,0.5) moveL(init_pos,0.5,0.5) rtde_c.forceModeStop()
What I tried to do is make the robot’s end-effector move to the position that is 0.1 m away from the original position in x-direction, then return to the original position while forcemode is activated. However, the robot didn’t move even though “main start” was printed. What is the problem and how can I make the robot to move?
※ I replaced ‘sync()’ from tutorial to ‘time.sleep(DT)’ because I don’t know the namespace of the ‘sync()’. Is this caused the problem? if that is true, what could be the namespace of the ‘sync()’?
For anyone who might have same problem with me, the problem is data type of the input for rtde_c.moveL (I forgot to write moveL as rtde_c.moveL) After I made those input to list (ex: [init_pos+0.1, init_pos, init_pos, init_pos, init_pos, init_pos]) the robot moved as I intended.