google-deepmind / google-deepmind/mujoco

Keyframe validation error when using replicate tags

Open
#3,071 4 comments 3 reactions 1 assignee Claimed by @yuvaltassa View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

Hi!

I am a robotics engineer at NASA, we use mujoco for sim to real testing and capabilities development, primarily through the [ros2_control](https://github.com/ros-controls/mujoco_ros2_control) wrappers.

### My setup

MuJoCo version 3.4.0, using the included `compile` and `simulate` applications on Ubuntu Linux (both x86 and arm64 architectures).

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

We're trying to define keyframes that include an attached via a `freejoint`, and have run into an odd issue with `qpos` size validation that only pops up when using `replicate` tags in included files.

The specific error being:

```
XML Error: Error: Keyframe 'test' has invalid qpos size, got 8, should be 1
Element 'replicate', line 0
```

Even though 8 is the correct size of qpos for the model. I haven't tracked it down yet but is it possible we should only be [validating these sizes](https://github.com/google-deepmind/mujoco/blob/main/src/user/user_model.cc#L4070) if the model has already been compiled?

### Steps for reproduction

1. Load the model below.

2. Run the code below and get an error:

```bash
$ ${MUJOCO_DIR}/mujoco-3.4.0/bin/compile scene.xml
XML Error: Error: Keyframe 'test' has invalid qpos size, got 8, should be 1
Element 'replicate', line 0
```

3. Comment out the replicate tag in `robot.xml` and rerun:

```bash
$ ${MUJOCO_DIR}/mujoco-3.4.0/bin/compile scene.xml
Done.
First compile: 0.001485s
Second compile: 0.0008158s
```

### Minimal model for reproduction

This only seems to pop up with included files where the free joint isn't lumped in with where the `replicate` tag is used:

scene.xml:

```xml










```

robot.xml:

```xml











```

### Code required for reproduction

N/A, can see with included `compile` and `simulate` applications.

### 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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.