Page 1 of 1

Can force/torque control of joint achieve positive and negative motion during one control loop?

Posted: 05 Nov 2018, 02:46
by biscuit122
In this tutorial, I set a sin function to define a joint force control. But it only move in one direction, so if I do not change target velocity, do you have method to move joint in two direction during one control loop? https://github.com/feig122/force_test

Re: Can force/torque control of joint achieve positive and negative motion during one control loop?

Posted: 07 Nov 2018, 08:02
by coppelia
Hello,

you can only set the amplitude of the force/torque. The sign is set via the joint target velocity. So set following:

Code: Select all

sim.setJointForce(handle,math.abs(f))
if f~=0 then
    sim.setJointTargetVelocity(handle,math.abs(vel)*f/math.abs(f))
end
Cheers

Re: Can force/torque control of joint achieve positive and negative motion during one control loop?

Posted: 07 Nov 2018, 20:37
by biscuit122
coppelia wrote: 07 Nov 2018, 08:02 Hello,

you can only set the amplitude of the force/torque. The sign is set via the joint target velocity. So set following:

Code: Select all

sim.setJointForce(handle,math.abs(f))
if f~=0 then
    sim.setJointTargetVelocity(handle,math.abs(vel)*f/math.abs(f))
end
Cheers
Thanks for your brilliant tutorial, which helps me a big deal!