Question Regarding stepSimulation()

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Dyu
Posts: 4
Joined: Sun Oct 11, 2020 1:17 pm

Question Regarding stepSimulation()

Post by Dyu »

Hi,
I'm trying to understand 2 things:
1) I have the franka_panda urdf file loaded. When I run

Code: Select all

p.setJointMotorControl2(objUid, jointIndex, controlMode=p.POSITION_CONTROL, targetPosition=2)
p.stepSimulation()
The robot doesn't complete the entire motion even though the target position is within the joint limits: which is understandable, because "stepSimulation" runs only for 1/240 seconds. But how is this final position calculated? Does the physics client take the maximum joint velocity into account and calculate the position accordingly? Like so:

Code: Select all

final_pos = max_joint_velocity * (1/240)
2) While using realTimeSimulation, the actions seem to be completed instantaneously. Would I be correct in saying that the maximum joint velocity is not taken into account in this case? If this is true how can I regulate the joint to stay withing its maximum joint velocity limit?
User avatar
Erwin Coumans
Site Admin
Posts: 4235
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Question Regarding stepSimulation()

Post by Erwin Coumans »

The position is achieved taken all constraints into account, including the maximum force and joint limits, contact, friction etc.

There is a maxVelocity argument to clamp the maximum velocity. Alternatively, keep the max force low.
You can also use classical PD control.
Post Reply