Torque Control

Requests or suggestions for new features
Post Reply
amirmmi
Posts: 23
Joined: 08 Jan 2022, 23:38

Torque Control

Post 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.

coppelia
Site Admin
Posts: 9485
Joined: 14 Dec 2012, 00:25

Re: Torque Control

Post by coppelia »

Hello,

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

Cheers

amirmmi
Posts: 23
Joined: 08 Jan 2022, 23:38

Re: Torque Control

Post by amirmmi »

When will V4.3.0.rev4 be released?

coppelia
Site Admin
Posts: 9485
Joined: 14 Dec 2012, 00:25

Re: Torque Control

Post 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

Post Reply