google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
7.79k stars 776 forks source link

Performance differs with added disabled actuators/groups #1838

Closed eufrizz closed 1 month ago

eufrizz commented 1 month ago

Hi, I've just started testing using actuatorgroupdisable to allow my model to switch between position and intvelocity control. However, I've noticed that it changes the performance of the model.

  1. With just one group of actuators, the model behaves as expected and gets to the setpoint nicely.

  2. If I add a second group of actuators to the XML (e.g. velocity control), and then deactivate them, I now find that the model overshoots the setpoint a bit before settling. I would expect performance to be the same, as the only enabled actuators are exactly the same as in the first example, same gain parameters etc. I do NOT have both groups of actuators enabled at the same time, and I disable them under the Physics panel as well as under the Group Activation panel (Group Activation panel makes no difference).

  3. Interestingly, this behaviour goes away when I decrease the timestep from 0.002 to 0.001 - the model performs like the first example again.

I don't fully understand it but seems like the extra unused actuators are perhaps slowing down/changing the simulation calculations in some way. Is this expected behaviour?

I can provide a minimal example if you'd like.

yuvaltassa commented 1 month ago

Yes please, a minimal example would be much appreciated.

eufrizz commented 1 month ago

I've just been comparing by loading the models directly into the GUI and playing with the controls. Here are a couple of videos so you can see the (subtle) overshoot when it changes position. Model files attached below.

One actuator group (baseline): one_actuator_group

Two actuator groups: two_actuator_groups

mujoco_actuator_test.zip

yuvaltassa commented 1 month ago

This is a bug!

Thanks, will fix shortly.