Skip to content

Expose exact MyoChallenge P2 model preprocessing for accelerated backends - #405

Draft
mindorigin150 wants to merge 2 commits into
MyoHub:mainfrom
mindorigin150:feature/mjx-table-tennis-p2
Draft

Expose exact MyoChallenge P2 model preprocessing for accelerated backends#405
mindorigin150 wants to merge 2 commits into
MyoHub:mainfrom
mindorigin150:feature/mjx-table-tennis-p2

Conversation

@mindorigin150

@mindorigin150 mindorigin150 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • extract the existing Table Tennis P2 MjSpec transformation into the public preprocess_table_tennis_spec function
  • keep TableTennisEnvV0 and external accelerated backends on the same official model transformation
  • seed P2 before reset-time domain randomization
  • recompute MuJoCo model constants after reset changes paddle mass, ball friction, and ball placement

Motivation

Accelerated backends currently have to duplicate the private TableTennisEnvV0._preprocess_spec implementation to compile the official P2 model. Exposing the existing transformation lets them consume the same cylindrical paddle geometry and collision model without maintaining a downstream copy.

P2 randomizes model arrays before each episode. Seeding only in the base reset happens after those samples are drawn, so repeated reset(seed=...) calls are not reproducible. Mutating body_mass also requires mj_setConst so derived quantities such as subtree mass match the sampled model.

This PR deliberately does not add an accelerated environment, change the official geometry or tolerances, or change MyoSuite's MuJoCo dependency range. Backend-specific simulation and training code remain downstream.

Verification

Tested with both MuJoCo 3.6.0 and 3.12.0:

pytest -q myosuite/tests/test_table_tennis.py
2 passed

The tests cover the official P2 model contract and deterministic reset-time domain randomization, including recomputed derived mass.

@cla-assistant

cla-assistant Bot commented Aug 22, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Aug 22, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mindorigin150 mindorigin150 changed the title Add MJWarp MyoChallenge Table Tennis P2 environment Expose exact MyoChallenge P2 model preprocessing for accelerated backends Aug 22, 2026
@Vittorio-Caggiano

Copy link
Copy Markdown
Collaborator

@mindorigin150 this is a fantastic addition. Can you ping me on slack . Would like to discuss integration on the newest version of myosuite

@mindorigin150
mindorigin150 force-pushed the feature/mjx-table-tennis-p2 branch from b595796 to ed2694b Compare August 24, 2026 08:35
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.

2 participants