Procedurally created sections

Discussion in 'Simulation' started by wilbert pumacay, Sep 16, 2018.

  1. Hi.

    Thanks for the great library. I'm working in some python bindings for MuJoCo and I was trying to implement procedural terrains. I have basically three questions:

    * How could I create objects at runtime?. I saw a post in which you suggested to write to the xml and load it. I tried loading a separate xml at runtime (apart from the loaded model) but it crashed. My guess is that mjModel can't be changed (as stated in the docs, for efficiency). In the meantime, I'm using object pools to save some initial objects and then use them as I need them.

    * Which would be the way to generate procedural terrains (creating and deleting the bodies in the simulation as needed) to get something similar to the video below ?. The sections seem simple enough to be generated by object pools, and spawning and connecting them as needed; but maybe there is an easier way.



    * Also, I was thinking of making environments that would be a bit more complex, like combinations of heightfields and other sections, so could it be possible change the properties of the objects in runtime (to make them wider, taller, with different heightfields, etc.)?

    Thanks in advance.

    Wilbert.
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

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

    You can always load another XML at runtime, but that will produce a new mjModel. You cannot use the previous mjData with the new mjModel -- they need to be compatible.
     
  3. Thanks, I will consider that for my implementation.