The difference between setJointMotorControl2 and resetJointState

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
goktug
Posts: 1
Joined: Mon Oct 21, 2019 1:41 pm

The difference between setJointMotorControl2 and resetJointState

Post by goktug » Mon Oct 21, 2019 1:49 pm

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.

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

Re: The difference between setJointMotorControl2 and resetJointState

Post by Erwin Coumans » Thu Oct 24, 2019 1:53 am

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)

Post Reply