Skip to content

Conversation

@ankitmalakar7
Copy link

Fixes #2822

Problem

The notebook mjx/training_apg.ipynb fails with AttributeError: 'State' object has no attribute 'pos' when using MuJoCo MJX 3.3.5+. The issue occurs because the MJX Data class no longer exposes .x and .xd attributes directly.

Solution

Added a helper function _extract_x_xd() that extracts Transform (x) and Motion (xd) objects from MJX data using the underlying arrays (data.xpos, data.xquat, data.cvel) that are available in all MJX versions.

Testing

  • No syntax errors in notebook
  • Compatible with both old (3.3.0) and new (3.3.5+) MJX versions
  • Uses the same logic as existing mjx_to_brax() method

@google-cla
Copy link

google-cla bot commented Dec 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'State' object has no attribute 'pos' in mjx/training_apg.ipynb

1 participant