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

Typically: "How do I... ", "How can I... " questions
Post Reply
biscuit122
Posts: 38
Joined: 23 Jan 2018, 16:16

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

Post 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

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

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

Post 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

biscuit122
Posts: 38
Joined: 23 Jan 2018, 16:16

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

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

Post Reply