Page 1 of 1

Manipulating Kuka-robot joint using Torque-control

Posted: Wed Apr 03, 2019 6:36 am
by pierre_wueth
Hi everyone,

I am new to pybullet and thanks a lot to the developers for providing a nice simulation platform!

I recently tried to use pybullet's torque-control mode to manipulate the simulated kuka robot in the example code which can be found in the pybullet_envs directory. I am focusing on only controlling one joint of the robot for now, and although my script is able to run, the selected joint does not move in the GUI if the force passed into the setJointMotorCommand2-function is below a certain value (240). I have printed out some values and figured out the following so far:

Forces below 240: The robot joint does not move. Passed force into setJointMotorCommand2-function and the value of appliedJointMotorTorque from the getJointState-function are approximately the same (with a minus sign in front)

Forces above 240: The robot arm moves. The appliedJointMotorTorque from the joint-sensor outputs maximally -240, regardless of what the desired torque value was.

It seems to me that the robot arm only is able to move above this threshold, but I expected that the joint would start rotating at much lower values and that the force applied to the joint would be continuous (right now, it seems to be a sort of on/off situation). Is this behavior to be expected by the torque-control mode? Is my implementation of torque-control wrong or is it a bug?

I have made a github repo with my minimally changed code:

I would greatly appreciate some comments and advice from people who have experience using the torque-control mode. Thanks a lot in advance!

Re: Manipulating Kuka-robot joint using Torque-control

Posted: Fri Apr 12, 2019 1:33 am
by Erwin Coumans
You need to first unlock/disable the default velocity/position motor:

pybullet.setJointMotorControl2(objUid, linkIndex, p.VELOCITY_CONTROL, force=0)

Otherwise, your force/torque has to exceed the default motor.

Instead of using 0, you can also use a very small force limit, to mimic joint friction.

I added a note in the setJointMotorControl2/Array section of the quickstart guide:
See ... of6bt5vhut

Re: Manipulating Kuka-robot joint using Torque-control

Posted: Mon Apr 15, 2019 6:05 am
by pierre_wueth
Hi Erwin,

Thank you very much for your insightful response and adding a note in the guide!

Your advice on how to create joint friction is really helpful as well, I was looking for a way to simulate such joint dynamics. :)

Thanks again and best regards,