A question about the way of avoiding penetration between different geoms in mujoco #1941
Replies: 4 comments
-
Hello! Here's the section of the documentation on collision detection that explains how contype and conaffinity work: https://mujoco.readthedocs.io/en/latest/computation/index.html#collision-detection Many models intentionally use these properties to selectively disable collisions between elements of a model. This may be more or less accurate to real life depending on the way it is used. For example, in a lot of models there are meshes/colliders that are touching in the model, which would not touch in the real robot (e.g. thanks to complex concave machined parts, which don't have additional benefits to be modelled in MuJoCo, where simply convex geometry may be used to represent it). Another example would be human/compliant fingers. Due to the way soft tissue is allowed to deform/roll when fingers are touching, the real friction will be much lower than if you model them as rigid bodies touching like in MuJoCo. For this reason collisions are often disabled between models of human/compliant fingers. Therefore its up to you to decide which bodies are supposed to contact each other. If you take an existing model and set everything to collide, then suddenly parts of the body will act differently than designed, which is what you observed in your 2nd point. Find the geom pairs you want to enforce collisions between, and change only those! |
Beta Was this translation helpful? Give feedback.
-
Thanks so much @Balint-H, always so many valuable details and suggestions. Really appreciate. Just a further check about the human fingers example you mentioned, so basically it's better to disable the collision between human fingers due to the much larger potential friction it may bring if collision is defined, right? What about the collision between human fingers and the rigid object simulation in Mujoco, if it would bring some undesirable friction force, moreover, much larger contact force between human fingers and the rigid object, would there be some good method to make the simulation closer to reality? And I guess more work definitely should be done in designing my model file, right? I mean, I need to be pretty clear about all the details about the model file I designed. Actually, during the discussions we had in other issues, something bothers me a lot is that when I found the results demonstrated in simulation deviates a lot from what I expect, and when it comes to some question I guess may relate to collision, damping, stiffness, friction, I always feel that, OK, I need to fine-tune my coarse model file, for instance, to add some damping or frcition, but on the other hand, I will also think about doing some coding work, I mean, if I use some learning method, I can just let the agent explore to get a policy. Mujoco also provides some example robot model files in the mujoco menagerie which definitely saves me a lot time to build the model from the scratch. However, when I hope to make the simulation closer to reality, the first thing I suspect would always be the model file, I will consider, for instance, to add some friction or other properties. Yeah, I guess it's also because I have used mujoco not for quite a long time, the traditional way of solving the problems in development is to search, and I did learn a lot from the issues, so thanks a lot to this great community. But on the other hand, I should also pay more attention to the documentation details. Anyway, thanks a lot, @Balint-H and wishing you all the best. |
Beta Was this translation helpful? Give feedback.
-
Regarding the question: With contype and conaffinity, you can disable collisions between fingers, but keep it (and friction) enabled between the fingers and objects! The points you make after that are all correct. A lot of defining good models ends up being trial and error as it is often difficult to fully anticipate the effect adding a new element to your model will have. Once you define a design space as determined by the parameters in your scene, you can then fine tune and optimize your values to reproduce your expectations/reference data (e.g. using system identification methods, there's a tutorial for that on the main page of this repository). Good luck with your modelling! |
Beta Was this translation helpful? Give feedback.
-
Thanks very much! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I hope you're enjoying a nice day today!
I'm a student and I'm trying to use MuJoCo for robotic simulation.
I'm looking for some help with how to avoid penetration in mujoco.
I am simulating the interaction between a robotic hand and some objects, when I am trying to get a good initial pose for the model by playing the model file in mujoco.viewer, I found that sometimes when they contact, some fingers will just penetrate between each other. To avoid this, I just set the contype and conaffinity both equal to 1 in the gemos of the robotic hand and the object and then I found the penetration disapper, they can collide which is what I expect?
So, my question are as follows,
Thanks and wishing you all the best.
Beta Was this translation helpful? Give feedback.
All reactions