Hi, I would like to know whether it is possible to programatically (in the code) create parameterized rigid bodies in the world, not via a hand-coded static xml file. For example, I want to create 10 rigid bodies whose sizes or properties are determined by random numbers generated by a numpy's random number generator. But once determined, the properties don't need to be changed during the runtime. Thank you for any help !
Currently you have to go through XML. It is possible to write Python code that generates MuJoCo XML files. Some users have developed such functionality in-house but it is not publicly available yet. For your specific example, it should be straightforward to write Python code that generates the corresponding XML. MuJoCo 1.60 (to be released in a couple of weeks) has a generator for soft bodies, which are composed of many rigid bodies connected with soft constraints. The generators itself is configured through the XML. But it is not a general solution. Internally, MuJoCo has a C++ API for creating models programmatically and then compiling them. However it is not currently exposed because C++ is compiler-dependent. There is a plan to write a C wrapper around it and expose it via the C API. This will hopefully be implemented in the release after 1.60.