robotology / gym-ignition

Framework for developing OpenAI Gym robotics environments simulated with Ignition Gazebo
https://robotology.github.io/gym-ignition
GNU Lesser General Public License v3.0
224 stars 26 forks source link

Enable self-collision for Panda #314

Closed FirefoxMetzger closed 3 years ago

FirefoxMetzger commented 3 years ago

I don't know if this issue should live here or in the gym_ignition_models repo.

Currently, Panda doesn't seem to have self-collisions enabled. Collision with other objects works fine. See for example this video (at around 0:08 - 0:09):

https://user-images.githubusercontent.com/4402489/113131592-43b49580-91d2-11eb-863c-84bcdb292fee.mp4

Would it be possible to enable it by default, or provide an option to enable it?

diegoferigo commented 3 years ago

Contacts and collisions are part of what I call the bottleneck features. When enabled, simulations could slow down considerably.

For this reason, contact detection and self collisions are disabled by default (contacts [1], collisions). You can enable self collisions model-wise with the following method:

https://github.com/robotology/gym-ignition/blob/bba62416e97fe5788019e32cae66355bcb9fe70a/cpp/scenario/gazebo/include/scenario/gazebo/Model.h#L174-L183

[1] I actually realized that contacts are enabled by default. We should understand what is the impact to the real time factor, and if it makes sense to disable them by default.

FirefoxMetzger commented 3 years ago

In python this will need to be cast to_gazebo() first:

panda.to_gazebo().enable_self_collisions(True)

I should first read the docs more thoroughly before opening new issues 🥇 I totally forgot to check the Gazebo API and just looked at the core API. Closing...

diegoferigo commented 3 years ago

No worries, we can consider issues as part of a project's documentation :wink: One nice thing with SWIG (much more difficult to get with pybind11) is that the C++ doxygen documentation is copied to the Python's docstring. I admit that, as you, I rarely rely on the online documentation. Nowadays autocompletion is much faster.