Page 1 of 1

The difference between setJointMotorControl2 and resetJointState

Posted: Mon Oct 21, 2019 1:49 pm
by goktug
When I was working with baxter robot in pybullet simulation environment, I noticed that there is a sample inverse kinematics code in following GitHub link: https://github.com/erwincoumans/pybulle ... ik_demo.py

I examined the code, and tried it to move end effector of my baxter to particular location. It worked; there is no problem. However, why was not the function "setJointMotorControl2" used in line 123 ? Is there a difference between "resetJointState" and "setJointMotorControl2" functions ?

I replaced it with "setJointMotorControl2" function in line 123. The end effector moved to my particular location, but when I tried to print the variable "newPos", I noticed that it did not change. It was changing when I used "resetJointState" function.

Re: The difference between setJointMotorControl2 and resetJointState

Posted: Thu Oct 24, 2019 1:53 am
by Erwin Coumans
reset* functions teleport the robot into some state, ignoring all dynamics.

setJointMotorControl2 will set some targets and let the simulation try to achieve those, so they obey the laws of physics.

The examples may use one or the other.
It is best to never use reset* functions while simulating, only when you reset your application/episode (unless you know that the dynamics won't be violated)