Feat/a2 joystick flat#671
Open
lemon-star608 wants to merge 4 commits into
Open
Conversation
Self-contained robots/a2/ (meshes copied from the A2+Airbot composite), 12 position-style leg actuators with A2-strength gain classes, Go2- compatible IMU/foot sensors. No arm, no keyframe (keyframe lives in the task scene, per the asset/XML structure contract).
The A2 leg-only MJCF mirrors the Go2 joystick sensor/geom/leg-ordering contract and uses <position> actuators, so the task reuses Go2WalkTask unchanged. Only the A2 identity differs: scene path, standing pose, and per-joint PD gains. - A2 flat scene (scene_flat.xml) with four foot-contact sensors and a home keyframe aligned to unitree_rl_mjlab INIT_STATE (height 0.4, thigh 0.9, calf -1.8, hips +-0.1); default_angles derive from it automatically. - A2JoystickCfg / A2JoystickFlatEnv registered and wired into the locomotion registry bootstrap. - Per-joint PD gains via PdControlConfig.position_gains() (hip/thigh kp=100/kd=4, calf kp=150/kd=6) forwarded to the backend; the scalar default keeps Go2 behaviour byte-for-byte unchanged. - a2_joystick_flat/mujoco owner YAML carrying training + reward. - End-to-end contract tests (XML compiles, 12-DOF, obs layout, per-joint model gains, finite step) and support-matrix refresh.
Enable the sim2real DR suite on A2JoystickFlat (budget 500 iters; A2 is ~2.8x Go2 mass) and let the policy stand still at zero command instead of marching in place. Domain randomization: - A2JoystickDomainRandomizationProvider supplies per-joint base gains so randomize_kp/kd scales each actuator off its true baseline (calf off 150, not the shared scalar), and caches the pristine dof-armature + geom-friction tables via the public backend getters (cold path, no feature leak) so randomize_dof_armature and randomize_ground_friction are effective; the floor geom is the priority geom for friction. - com_offset_y/z declared so the base COM randomizes in all three axes. - DR ranges reference unitree_rl_mjlab A2 events (joint_armature scale 0.9-1.1, foot friction 0.3-1.6); body_mass and gravity stay off. Zero-command standing (gated so Go2's default behaviour is unchanged): - RewardConfig.command_threshold gates the phase-driven gait rewards (swing_feet_z / contact) and the gait phase clock: while standing (||command|| <= threshold) the phase freezes per-env and a planted robot earns full contact reward. Default 0.0 keeps Go2's reward vector and phase advance byte-for-byte unchanged. - New rewards stand_still / hip_deviation / stand_feet_air penalize residual micro-stepping and stance drift at zero command, all gated by command_threshold so they cost locomotion nothing. - sample_commands_with_standing is the single source of truth for the standing-aware command distribution, shared by the reset path (DR provider) and mid-episode resampling (resampling_time > 0). Tests: DR-on env constructs and steps finite, friction/armature baselines cached once, floor geom dominates friction; Go2 stand-still contract (phase freeze, gated rewards, command sampling).
TATP-233
reviewed
Jul 2, 2026
…ding_fraction Review on #671 flagged that the standing-command logic our A2 PR added to common/commands.py already existed elsewhere. It did: the block "zero a random rel_standing_envs fraction of rows to zero" was copy-pasted inline in six DR provider sites (go1/rough, go2/rough, go2w/rough, go2w/joystick reset+resample, g1/joystick) with no shared helper. Extract the block into common.commands.apply_standing_fraction() (in-place, same RNG guard) and route all six sites plus sample_commands_with_standing through it. Per-site zero_small_xy thresholds (0.08 for rough, 0.2 default for g1/go2w) and heading handling are preserved, and the rough.py resample paths that only do zero_small_xy (no standing fraction) are left untouched. Behaviour-preserving: make test-all still 1431 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
加入A2_joystick/mujoco任务
Linked Work
Validation
make checkuv run pytest -m "not slow"Commands actually run:
# paste exact commands hereImpact
mujoco/motrix/ both / noneArtifacts
Checklist