Page 1 of 1

Torque Control

Posted: 23 Feb 2022, 18:21
by amirmmi
Hello,
It would be good to add a function that applies the desired amount of torque directly to a joint, even negative or positive torque.

Re: Torque Control

Posted: 24 Feb 2022, 09:04
by coppelia
Hello,

from CoppeliaSim V4.3.0.rev4 on, you will be able to use sim.setJointTargetForce, which accepts a signed value

Cheers

Re: Torque Control

Posted: 25 Feb 2022, 12:41
by amirmmi
When will V4.3.0.rev4 be released?

Re: Torque Control

Posted: 25 Feb 2022, 13:21
by coppelia
Not sure...
But you can use the following function as a workaround in the mean time:

Code: Select all

function sim.setJointTargetForce(jointHandle,forceOrTorque)
    local v=sim.getJointTargetVelocity()
    if v*forceOrTorque<0 then
        sim.setJointTargetVelocity(-v)
    end
    sim.setJointMaxForce(jointHandle,math.abs(forceOrTorque))
end
Cheers