google-deepmind / mujoco

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

Sensors in MuJoCo XLA? #1513

Closed eleninisioti closed 1 week ago

eleninisioti commented 5 months ago

I see in the documentation of MuJoCO XLA (https://mujoco.readthedocs.io/en/stable/mjx.html) that sensors are under development, any chance this feature has been added? If so, are there any examples?

breakds commented 5 months ago

At this moment, I just implement them with jax functions following the logic implemented in c++: https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_sensor.c#L525

yuvaltassa commented 5 months ago

Does anyone want to send us a PR implementing this in the MJX codebase? That would be welcome.

breakds commented 5 months ago

Does anyone want to send us a PR implementing this in the MJX codebase? That would be welcome.

Never contributed to MuJoCo before, but I would like to give it a try if no one is currently working on it.

My current implementation is very pre-mature, and does not respect <sensor> tag yet. It is a function that takes a mjx.Data as input.

kevinzakka commented 1 week ago

Sensors will be part of the next MJX release.