0

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.

aurelien_morel
  • 444
  • 3
  • 14

1 Answers1

1

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.

yuval
  • 109
  • 2
  • Thank you !! In my desired framework, individual modules could connect either from multiple attach points either to other modules or to static attach points in the environment (floor, walls, roof). This makes defining all possible constraints beforehand seem hard to scale. If I succeed to access eq_data, I could potentially add a new constraint to the list during runtime ? – aurelien_morel May 09 '22 at 12:32
  • 1
    You would not need to add constraints, as long as the maximum number of active constraints is fixed. By modifying eq_data (and eq_obj1id eq_obj2id) you would effectively be changing everything about this constraint. So all you need is N dormant constraints that you can activate, and then at runtime you would set any available constraint to do what you want and turn it on. – yuval May 10 '22 at 13:20