google-deepmind / google-deepmind/mujoco

Loading MJCF in python that contains an actuator subclass default overwrites other subclass params

Open
#3,561 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

I'm working on an RL environment, and wanted to compare various actuator settings' effects on the learning. I noticed that having defaults of one subclass of actuators in an MJCF sets the params of other subclasses defined.

I know that the actuator subclasses are just shorthands for parameter settings and that almost everything is implemented as general actuators under the hood (with a bit of special treatment for muscles), but this is still a surprising outcome for me.

### My setup

Using Linux and the Python API, MuJoCo version 3.12.

### What's happening? What did you expect?

I would expect that defining defaults for one actuator subclass would leave other actuators unaffected. i.e., if I have a `position` default defined, and a `position` , a `motor` and a `muscle` actuator in the MJCF, only the `position` actuator should be affected.

### Steps for reproduction

1. Load the model below in Python.
2. Print biasprm.

### Minimal model for reproduction

minimal XML

```XML











```

### Code required for reproduction

```python
import mujoco
xml_path="mvp.xml"
print(mujoco.MjModel.from_xml_path(xml_path).actuator_biasprm[0])
```

### Confirmations

- [x] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [x] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

Contributor guide

Open the contributing guide

Research direction

Start with the minimal MJCF and reproduce it through Python's MjModel.from_xml_path, then inspect actuator_biasprm for the motor actuator. Trace how the position defaults are applied while loading the actuator definitions; the fix is complete when motor and muscle parameters remain unaffected by defaults for another actuator subclass, with regression coverage for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.