In general, we don’t provide detailed documentation on the PhysX solver. While we document how to use our simulators and what physical interpretation parameters such as, for example, a drive stiffness have, we consider the simulation technology that we develop an implementation detail and want to be free to change and improve that transparently to our users as we develop innovations.
As for gains, I am referring to the drive stiffness and damping - in control theory, these are equivalent to a proportional and derivative gain, respectively. How exactly these gains are used to compute a torque that is applied to the joint will determine the closed-loop dynamics that you observe. My suspicion is that the difference you are seeing in the plot is from the implicit formulation of the PhysX joint drives, which will appear more “damped” compared to an explicit approach that you may have in the Matlab simulation.
So hence my question: Is the Matlab drive/controller using an explicit formulation where the torque is computed from the beginning-of-timestep joint position and velocity and then assumed constant over the timestep?
If you do want to figure out the exact updates for PhysX, I think that should be straightforward for the simple example of a beam on a revolute joint without any constraints. Just:
- Compute the drive torque using the joint position and velocity at the end of a timestep
- Assume that the computed drive torque is constant during the time step to compute the velocity update, i.e. velAfter = velBefore + 1/inertia * dt * driveTorque
- Use an implicit euler update on the joint position, i.e. posAfter = posBefore + dt * velAfter
- Solve for velAfter from combining all equations above.
Note that my comment above about the TGS/PGS effective time step is wrong - they both use the full timestep in the equations above.