## Computed Torque Controller

Typically: "How do I... ", "How can I... " questions
Essa6
Posts: 8
Joined: 24 Jun 2020, 15:33

### Computed Torque Controller

Hi,
I designed a computed torque controller for UR5 robot and i have a csv file that contains the values of torques for all joints for 100 iterations, the size of csv file is 100*6
I connect the python to vrep and i want to send torque values to vrep from python but the robot didn't respond to any value please i need help for my project, this is part of my code i made for loop 2D to iterate over the csv file :

Code: Select all

sim.simxPauseCommunication(clientID, True)
for i in range(100):
for j in range(6):
sim.simxSetJointTargetVelocity(clientID, joint_handles[j],   10000000000, sim.simx_opmode_oneshot);
sim.simxSetJointForce(clientID, joint_handles[j], taumat[i][j], sim.simx_opmode_oneshot)
sim.simxPauseCommunication(clientID, False)
I have another question, i made a trajectory generation for UR5 and the robot didn;t respond to any value

Code: Select all

for i in range(100):
for j in range(6):
sim.simxSetJointPosition(clientID, joint_handles[j], traj[i][j], sim.simx_opmode_oneshot)

coppelia
Posts: 7977
Joined: 14 Dec 2012, 00:25

### Re: Computed Torque Controller

Hello,

Code: Select all

for i in range(100):
sim.simxPauseCommunication(clientID, True)
for j in range(6):
sim.simxSetJointTargetVelocity(clientID, joint_handles[j],   10000000000, sim.simx_opmode_oneshot);
sim.simxSetJointForce(clientID, joint_handles[j], taumat[i][j], sim.simx_opmode_oneshot)
sim.simxPauseCommunication(clientID, False)
pause for a few ms

otherwise all 100x6 values will be sent at the same time and applied at the same time!

Make sure your joints are dynamically enabled, the motor is enabled and the control loop is disabled.

In your second problem, your joint should be in position control mode (motor enabled and control loop enabled too, in position control). Is this the case? Here too, you are almost sending instantaneously 100x6 values at once...

Cheers

Essa6
Posts: 8
Joined: 24 Jun 2020, 15:33

### Re: Computed Torque Controller

Thank you very much, its work