Is there a convenient way to dynamically create constraints between two bodies in MuJoCo?

279 Views Asked by At

I am trying to use MuJoCo to create a modular robotics framework to study learning of reconfiguration and locomotion.

In order to do this, I need to model connection and disconnection by dynamically creating constraints between two modules during simulation (probably elastic constraints to keep the simulation stable in case of over-constrained configurations).

What would be the best way to achieve this ?

The only solution that I see right now is to directly modify the world model (sim.model) but I am not sure how stable this can be.

1

There are 1 best solutions below

2
On

What you want to do is easy, if the constraints can be defined in advance.

Equality constraints have an eq_active property that you can turn on and off during runtime with no side-effects. However, if you want the relative location of the constraint to also be set at runtime, you would need to modify the values eq_data. This is also possible and not too hard, but since the values in eq_data are currently not fully documented, this might prove more difficult.