Simulation with contact between two humanoid.xml models?

Discussion in 'Simulation' started by erwin coumans, May 5, 2016.

  1. The simulate.cpp example only loads a single humanoid.xml model, and the mj->step function only takes a single model.

    How can Mujoco simulate the interaction between two humanoid.xml models, including contact?
     
  2. Never mind, it looks like we have to merge multiple humanoid bodies into a single xml model file.
     
  3. Emo Todorov

    Emo Todorov Administrator Staff Member

    Yes, everything is loaded from a single XML file, but it can have <include> statements. The Modular Prosthetic Limb (MPL) family of models illustrates its use. Note however that you cannot have replicated element names in the same model; so the second copy of humanoid.xml you include has to be somewhat tweaked. Hopefully one day I will find the time to implement automatic prefixing in <include>.

    Also, you probably want to move the initial position of the root a bit so the two models are not created on top of each other (or else they will fly away at the beginning of the simulation).
     
  4. Thanks for the suggestion.

    If we have multiple URDF files, I would need to write some merge util into Mujoco xml? Does the compiler.cpp do this?
     
  5. Emo Todorov

    Emo Todorov Administrator Staff Member

    The compiler can convert URDF into MJCF. The code sample compile.cpp already does that:

    compile mymodel.urdf mymodel.xml

    Then you can include the resulting MJCFs into a "scene" which is another MJCF with <include> statements (and possibly common settings and other objects).