Repository navigation
[Feature] MicroDuckEnv: robot-conformant policy_observation - #4625
Merged
Merged
Conversation
Add an opt-in ``policy_observation`` entry holding the 61-D vector the MicroDuck robot runtime feeds its policies: base angular velocity, projected gravity, joint-position error, joint velocity, previous action and the 13-D robot command (vx, vy filled from ``command``, yaw rate, head and body pose left at zero). Linear velocity and the gait clock, which the robot cannot measure, are left out, so ``observation`` stays available as a privileged critic input. With the option on, the env checks that the MJCF actuators drive ``JOINT_NAMES`` in the robot's order instead of silently producing a permuted vector.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4625
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit bf464f5 with merge base c0ca870 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Merged
6 of 7 tasks
…servation policy_observation reads joint positions and velocities in qpos order, but the check only compared the actuator order with JOINT_NAMES. A model whose actuators follow the robot order while its joints are defined in another order passed the check and produced a permuted observation. Both orders must now match. The test adds such a model.
theap06
marked this pull request as ready for review
October 28, 2026 03:54
bsprenger
approved these changes
Oct 29, 2026
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.
Description
Adds an opt-in
policy_observationentry toMicroDuckEnv(MicroDuckEnv(..., policy_observation=True)): the 61-D vector the MicroDuck robot runtime feeds its policies at 50 Hz.policy_observation, 61)observation(56)command, rest zeroBody-frame linear velocity and the gait clock, which the robot cannot measure, are left out.
observationis unchanged and stays available as a privileged critic input, so the skill controller,trajectory_metrics, the closed-form gait and the published checkpoints are untouched.With the option on, the env checks at load time that both the MJCF actuators and the joint definitions (the qpos order the observation reads) follow
JOINT_NAMES, and raises otherwise. TodayJOINT_NAMESis declared but never checked, so a reordered model would produce a silently permuted vector.Motivation and Context
The MicroDuck robot (Pollen Robotics) only runs feed-forward ONNX policies on its own 61-D observation (
model_api: 1,obs_len: 61in the manifest of pollen-robotics/microduck-policies). A policy trained onobservationcannot run on hardware because it reads linear velocity and a gait clock. This is the first half of making TorchRL-trained MicroDuck policies deployable. #4626 addsexport_onnx_policy, which writes feed-forward and LSTM TorchRL policies in the ONNX layout the runtime loads.Validation against the robot's own policies (scripts not committed):
Joint order,
STANDpose and the 50 Hz control rate match the metadata of Pollen's shipped ONNX policies exactly.Pollen's
velstand.onnx, run inMicroDuckEnvonpolicy_observation(8 envs, 500 steps, mesh collisions): 100% survival standing, yaw tracking 1.10 / -1.04 rad/s for +-1.0 commands.Mutants on the same rollout: swapping gyro and gravity, or mirroring the legs, gives 0% survival.
Forward and lateral tracking of that policy is weak in this env. It was trained with a BAM actuator model and full collision meshes, while
MicroDuckEnvuses the XML PD actuators and box proxies by default. That is a dynamics gap to address separately, not a layout issue.I have raised an issue to propose this change (required for new features and bug fixes)
Types of changes
Checklist