google-deepmind / google-deepmind/mujoco

User sensor's dim does not change model's signature

Open
#3,307 2 comments 0 reactions 1 assignee Claimed by @quagla 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 researcher at University of Ljubljana, I use MuJoCo for my research.

### My setup

MuJoCo 3.9.0 (C API), x86, Fedora 44 KDE

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

Changing the dimension of the `mjSENS_USER` sensor type does not result in the compiled-model's signature being different. As a result, models with different `nsensordata` end up having the same signature, despite having a different memory layout.

### Steps for reproduction

1. Use different sensor's `dim` and type of sensor `mjSENS_USER`.

### Minimal model for reproduction

No model needed (actually two different ones are needed for comparisson), specification creation is fine.

### Code required for reproduction

Python:
```python
import mujoco as mj

spec = mj.MjSpec()

world = spec.worldbody

sensor = spec.add_sensor()
sensor.type = mj.mjtSensor.mjSENS_USER
sensor.dim = 100
sensor.name = "user_sensor"

m = spec.compile()
print(f"M1 nsensordata: {m.nsensordata}")
model_1_signature = m.signature

spec.delete(spec.sensor("user_sensor"))

sensor = spec.add_sensor()
sensor.type = mj.mjtSensor.mjSENS_USER
sensor.dim = 200
sensor.name = "user_sensor"

m = spec.compile()
print(f"M2 nsensordata: {m.nsensordata}")
model_2_signature = m.signature

assert model_1_signature != model_2_signature

```

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