Skip to content

mjx support for flex elements? Status confusing. #2656

@aespielberg

Description

@aespielberg

Intro

Hi!

I am a researcher using mujoco for developing capabilities on manipulation.

My setup

I'm using mjx 0.6.1, in cpu mode, on Ubuntu 24.

What's happening? What did you expect?

When I run the flex bunny.xml in a jitted mjx simulation, the flexvert_xpos data is completely empty.

If this is unsupported, that is fine, but there is nothing to suggest that it is not supported.

https://mujoco.readthedocs.io/en/stable/mjx.html#

Flex elements are not listed as any of the features that are not supported. In fact, it is even worse: the documentation states that "MJX will raise an exception if asked to copy to device an mjModel with field values referencing unsupported features."

However, you can copy flex elements to and from mjModels without any exceptions. Since flex elements do not seem to be supported in mjx, the bug is that this needs to raise an exception, but does not. Otherwise, like me, you spend time thinking your simulations are succeeding and wondering why you are unable to get any data out of your soft-bodied simulation.

It was only when I searched the flex modeling folder on github that I realized that while the fields are there, there is no logic supported for flex elements in mjx: https://github.com/search?q=repo%3Agoogle-deepmind%2Fmujoco+flex+language%3APython&type=code&l=Python

(Incidentally, it would be great if the documentation can be updated to describe if flex elements are coming soon or unsupported.)

Steps for reproduction

  1. Load the bunny.xml.
  2. Convert it to an mjx model.
  3. jit the simulation function.
  4. Run the simulation.
  5. Try to extract flexvert_xpos - it will be all 0s. And the initial mjx_data struct will be empty.

Minimal model for reproduction

No response

Code required for reproduction

No response

Confirmations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions