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.19k stars 128 forks source link

any example about the gradient calculation? #7

Open foolyc opened 4 years ago

foolyc commented 4 years ago

is there any demo about calculating the gradient of system output q, q_{dot} with respect to physical properties parameters(link length/ mass/ inertia...) in python?

erwincoumans commented 4 years ago

Only the C++ has gradients, the Python bindings don't expose the gradients yet. It will be exposed.

erwincoumans commented 4 years ago

Latest version has pytinydiffsim_dual using dual numbers (forward mode). There is a trivial example here: https://github.com/google-research/tiny-differentiable-simulator/blob/master/python/examples/z_dual_numbers.py

The current code is also uploaded to pypi as revision 0.0.3, on Windows or Linux you can use

pip3 install pytinydiffsim --upgrade --user

Will look into a more interesting example later.