erwincoumans / tiny-differentiable-simulator

Tiny Differentiable Simulator is a header-only C++ and CUDA physics library for reinforcement learning and robotics with zero dependencies.
Apache License 2.0
1.2k stars 129 forks source link

Adding friction property #198

Closed jotix16 closed 2 years ago

jotix16 commented 2 years ago

Combining the friction requires the friction_coefs of the two bodies in contact. Since contacts are computed between geometries, I suggest a friction property should be added to the Geometry class.

To keep it compatible, we can add a friction property on RigidBody andMultiBody also.

The idea is to go one level above if friction is not defined, i.e. Geometry -> Rigid-/MultiBody -> World. A negative coefficient can indicate that the property is not defined.

I can go ahead and implement this if I get approval.

(edit 1) Just as a side note, my motivation is to perform system identification on the friction coefficients.

Related to : https://github.com/erwincoumans/tiny-differentiable-simulator/blob/c1a9e06de33756bceacfaddeecc6bc4b6c98560c/src/world.hpp#L186-L190 and https://github.com/erwincoumans/tiny-differentiable-simulator/blob/c1a9e06de33756bceacfaddeecc6bc4b6c98560c/src/world.hpp#L266-L270

erwincoumans commented 2 years ago

If this is useful to you, it is probably best if you just implement this in a fork.