[mujoco] add native frame_stack across Gym, DMC, and robotics#380
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
frame_stacksupport for Gym MuJoCo, dm_control suite envs, and Gymnasium-Robotics envs. This does not add pixel observations to the main obs pipeline.frame_stack > 1prepends a stack dimension per observation leaf, reset fills the stack with the first frame, step rolls and appends the latest frame, andframe_stack = 1preserves existing shapes and values.This diff adds native frame stacking for MuJoCo state observations across Gym, DMC, and robotics env families.
Technical Details
WriteState.envpool/mujoco/frame_stack.h: sharedStackSpecand per-keyFrameStackBuffer.envpool/mujoco/gym/mujoco_env.h: Gym MuJoCo single-observation frame-stack path.envpool/mujoco/dmc/mujoco_env.h: DMC multi-leaf observation frame-stack plumbing.envpool/mujoco/robotics/mujoco_env.h: robotics multi-leaf observation frame-stack plumbing.envpool/mujoco/robotics/kitchen.h: per-goal-leaf stack handling for Franka Kitchen.frame_stack = 1is intentionally a no-op in both spec shape and write-path behavior.Test Plan
Automated
git diff --check: passed.bazel test //envpool/mujoco:mujoco_envpool_test: passed.bazel test //envpool/mujoco:mujoco_gym_deterministic_test --test_filter=frame_stack: passed.bazel test //envpool/mujoco:mujoco_dmc_suite_deterministic_test --test_filter=frame_stack: passed.bazel test //envpool/mujoco:robotics_test --test_filter=frame_stack: passed.Suggested Manual
python - <<'PY'from envpool.registration import make_gymnasiumenv = make_gymnasium("HalfCheetah-v5", num_envs=1, frame_stack=4)obs, _ = env.reset()print(obs.shape)PYVerify a simple Gym MuJoCo env reports the expected stacked observation shape.