Manipulating Kuka-robot joint using Torque-control

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
pierre_wueth
Posts: 2
Joined: Wed Apr 03, 2019 4:27 am

Manipulating Kuka-robot joint using Torque-control

Post by pierre_wueth » Wed Apr 03, 2019 6:36 am

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: https://github.com/pierrewuethrich/pybullet_envs

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

User avatar
Erwin Coumans
Site Admin
Posts: 4196
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Manipulating Kuka-robot joint using Torque-control

Post by Erwin Coumans » Fri Apr 12, 2019 1:33 am

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 https://docs.google.com/document/d/10sX ... of6bt5vhut

pierre_wueth
Posts: 2
Joined: Wed Apr 03, 2019 4:27 am

Re: Manipulating Kuka-robot joint using Torque-control

Post by pierre_wueth » Mon Apr 15, 2019 6:05 am

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,
Pierre

Post Reply