Computational effort weld constraint

Discussion in 'Priority support' started by florianw, Jul 20, 2018.

  1. Is there a computational difference between having a body with multiple geoms and having a single geom per body, fixed together by a weld constraint?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    Yes, there is a significant difference. You should always use a single body with multiple geoms when possible. Same goes for joints: if for example you need a universal joint (composed of 2 hinge joints) there is no need for a dummy body in between. Instead you can simply define two hinge joints in the same body.

    The idea of a body with multiple geoms, joints and sites is somewhat unique to MuJoCo, and as a result people used to other modeling conventions often implement inefficient MuJoCo models where each geom is a separate body. This is particularly problematic when importing URDF models. MuJoCo 1.60 has a new compiler optimization feature which automatically fuses parent-child bodies without joints between them. But if the bodies are not parent-child (as you are thinking) they will not be fused, and it is up to the model designer to do it.