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.24k stars 130 forks source link

How to enforce joint limits (if they are supported)? #171

Open vittorione94 opened 3 years ago

vittorione94 commented 3 years ago

Hello,

I've recently started playing around with Tiny and I've reached the point where I'd like to limit the joint angles of the laikago model. I've tried to change the joint type in the urd file from continuous to revolute and specifying the lower and upper parameters but that didn't seem to affect the simulation at all. Going through the code it seems like joint limits are not implemented (but it might just be me looking in the wrong places).

Is there a better way of doing this than what I've described above?

Also if interested I have a working example of an OpenGL TDS viewer used via Python that could be added to the main repo :)

Thanks in advance for your time.

Best, -Vittorio

erwincoumans commented 3 years ago

Thanks. We haven't implemented joint limits as constraints yet. For now, one option is to implement joint limits using PD controllers. Another is to avoid reaching the joint limits in your controller (for example, when training a neural network, terminate the episode when the joints come close to the limit).

vittorione94 commented 3 years ago

I see thanks for the answer! :)