Spawning a mesh at run time

Discussion in 'Simulation' started by mike_k, Sep 5, 2018.

  1. Hi there,
    I was wondering if there is a way to use mjv_addGeoms (or some other method) to spawn meshes in the simulation at runtime. I am a little bit confused about how mujoco converts stl files to data in mjModel. My aim here is to be able to add objects to the scene (meshes or primitives) after the simulation started as opposed to using xml files.

    Thanks,
    Mike
     
  2. As a follow up question - I've been having troubles adding even primitives to the model object. Is an option to add bodies to the model on the fly at all supported by Mujoco? If so, could you provide a code snippet?

    Thanks,
    Mike
     
  3. Emo Todorov

    Emo Todorov Administrator Staff Member

    MuJoCo models are compiled. The only way to add objects is to recompile. You could have a pool of unused objects hidden somewhere, and bring them into the relevant workspace when needed.

    An API for model building at runtime is on the todo list for a future release.