Skip to content

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

@davidhozic

Description

@davidhozic

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions