Skip to content

[mujoco] Add native MetaWorld environments#396

Merged
Trinkle23897 merged 9 commits intomainfrom
jiayi/metaworld-native
Apr 13, 2026
Merged

[mujoco] Add native MetaWorld environments#396
Trinkle23897 merged 9 commits intomainfrom
jiayi/metaworld-native

Conversation

@Trinkle23897
Copy link
Copy Markdown
Collaborator

Description

This adds a native C++ EnvPool implementation for the Farama MetaWorld v3 Sawyer manipulation benchmark, pinned to the official Farama-Foundation/Metaworld v3.0.0 source archive. The new family registers every ALL_V3_ENVIRONMENTS task under the MetaWorld/ prefix, keeps Meta-World/ aliases, wires the MetaWorld MuJoCo XML assets through third_party/metaworld_assets, and documents the supported task IDs and public space contract.

Key review points:

  • envpool/mujoco/metaworld/metaworld_env.h contains the native task/state/reward implementation and all per-task variants.
  • envpool/mujoco/metaworld/tasks.h centralizes the generated task metadata for all 50 v3 environments.
  • envpool/mujoco/metaworld/metaworld_align_test.py reset-syncs once against the official MetaWorld oracle, then compares step-level observations, rewards, terminal flags, truncation flags, and exposed info for every task.
  • envpool/mujoco/metaworld/metaworld_render_test.py covers reset and multi-step native rendering across the registered task set.
  • docs/env/metaworld.rst adds the new family documentation and render sample.

Validation run:

  • make ruff py-format
  • make mypy
  • make cpplint
  • make clang-format
  • make buildifier
  • git diff --check
  • bazel test --config=debug --test_output=errors //envpool/mujoco:metaworld_test //envpool/mujoco:metaworld_align_test //envpool/mujoco:metaworld_render_test
  • devbox: make docstyle
  • devbox: make bazel-test BAZEL_TEST_TARGETS=//envpool:make_test

Motivation and Context

MetaWorld is a common MuJoCo manipulation benchmark, but EnvPool did not have a native runtime implementation for it. This ports the full v3 task family without a Python runtime bridge, so users can run the benchmark through EnvPool's standard C++ backend, vectorized API, registry, docs, and packaging flow.

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • New environment (non-breaking change which adds 3rd-party environment)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Implemented Tasks

  • Add native C++ MetaWorld v3 task implementations and pybind registration.
  • Add official-oracle alignment, determinism, registry coverage, and render tests.
  • Add third-party MetaWorld asset packaging and documentation.

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format (required)
  • I have checked the code using make lint (required)
  • I have ensured make bazel-test pass. (required)

Comment thread envpool/entry.py Fixed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d6bd9987f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread envpool/mujoco/metaworld/tasks.h Outdated
return task;
}
}
return kMetaWorldTasks[0];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject unknown MetaWorld task names

GetTaskDef silently falls back to kMetaWorldTasks[0] when a task name is not found, which runs assembly-v3 instead of failing fast. A typo in task_name (or a future registration mismatch) will therefore execute the wrong environment while still reporting the requested ID, producing incorrect benchmark results that are hard to detect. This should raise an error/assert on unknown names instead of defaulting.

Useful? React with 👍 / 👎.

@Trinkle23897 Trinkle23897 force-pushed the jiayi/metaworld-native branch 11 times, most recently from 05350c5 to 1501bc4 Compare April 13, 2026 03:15
@Trinkle23897 Trinkle23897 force-pushed the jiayi/metaworld-native branch from 1501bc4 to d5bac0d Compare April 13, 2026 03:52
Comment thread envpool/entry.py
import envpool.minigrid.registration # noqa: F401
import envpool.mujoco.dmc.registration # noqa: F401
import envpool.mujoco.gym.registration # noqa: F401
import envpool.mujoco.metaworld.registration # noqa: F401
@Trinkle23897 Trinkle23897 force-pushed the jiayi/metaworld-native branch 7 times, most recently from 90fa332 to a38d806 Compare April 13, 2026 21:55
@Trinkle23897 Trinkle23897 force-pushed the jiayi/metaworld-native branch from a38d806 to 78d2f19 Compare April 13, 2026 22:08
@Trinkle23897 Trinkle23897 merged commit 903c288 into main Apr 13, 2026
13 checks passed
@Trinkle23897 Trinkle23897 deleted the jiayi/metaworld-native branch April 13, 2026 22:57
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.

1 participant