I made a simple experiment in a zero gravity environment : By setting the springref of a box, i forced the box into collision with the ground floor (pos="0 0 0"). I noticed that the lesser i set the mass, the higher the penetration into the ground floor. So somehow the hardness of the contact is proportional to the body mass. Why is that? <body pos="0 0 0"> <joint type="slide" springref = "-1" stiffness="30"/> <geom type="box" pos="0 0 0.05" size="0.05 0.05 0.05" mass="0.01"/> </body>
This is by design. The idea is that if two objects of different mass rest on the floor, we want the penetration to be similar. So contact force has to scale with mass. In the real world this happens because the "floor" gets progressively harder as objects penetrate (due to concrete under carpet, or compression of sand etc). But since non-homogeneous materials are hard to model, we are using mass scaling to approximate the effect. Without such scaling, a contact that appears soft for one objects will be too soft for another object. So if you want to cause penetration by applying external force (or spring force in your case) you have to scale that force with mass.
Very interesting! Is that geometry wise or do you take into account the mass due to a chain of bodies as well? Like, a heavy horse on lightweight shoes, will it penetrate according to shoe-mass or according to full-horse-mass?
Full horse, approximately. It uses the end-effector inertia of each body, pre-computed in the model reference configuration. See documentation here: http://www.mujoco.org/book/computation.html#soParameters