[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2417":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":8,"pushedAt":8,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":26,"discoverSource":27},2417,"AMP_mjlab","ccrpRepo\u002FAMP_mjlab","ccrpRepo",null,"Python",228,28,1,2,0,13,36,125,39,4.39,false,"main",[],"2026-06-12 02:00:41","# AMP_mjlab\n\n[中文 README](README_zh.md)\n\nDeployment integration code is in [ccrpRepo\u002Fwbc_fsm](https:\u002F\u002Fgithub.com\u002FccrpRepo\u002Fwbc_fsm), under `MJAmp State`.\n\nG1 AMP motion control project built on top of mjlab + rsl_rl.\n\nKey features of this repository:\n\n- A single policy learns both locomotion (walk\u002Frun) and recovery (fall-and-get-up)\n- AMP discriminator regularizes motion style and priors\n- Training and deployment pipelines are consistent, with direct ONNX policy export support\n\n## Core Idea\n\nInstead of training separate policies for locomotion and recovery and switching between them, this project learns both capabilities in one unified policy.\n\nImplementation highlights:\n\n- Motion data split:\n  - Walk\u002FRun data: `src\u002Fassets\u002Fmotions\u002Fg1\u002Famp\u002FWalkandRun`\n  - Recovery data: `src\u002Fassets\u002Fmotions\u002Fg1\u002Famp\u002FRecovery`\n- Delayed termination\u002Freset:\n  - A subset of environments does not reset immediately after termination\n  - These environments receive a recovery window and reset states sampled from recovery clips\n- Unified AMP training:\n  - One actor-critic + One AMP discriminator\n  - Velocity tracking, perturbation robustness, and recovery are learned together\n\nThis reduces discontinuities caused by policy switching and yields more consistent behavior.\n\n## Requirements\n\n- Linux\n- Python 3.11 (recommended)\n- Working MuJoCo and GPU driver setup\n\n## Quick Start\n\n### 1. Install\n\n```bash\nconda activate mjlab\ncd AMP_mjlab\npython -m pip install -e .\n```\n\n### 2. Apply mjlab Patch (Optional)\n\nIf you do not apply this patch, remove `history_ordering` configuration from the code.\n\nWhat this patch does:\n\n- It adds an option for how observation history is flattened: by time (`time`) or by term (`term`).\n- Default mjlab behavior supports only `term` ordering.\n\nPatch file:\n\n- `mjlab_patch\u002Fmjlab\u002Fmanagers\u002Fobservation_manager.py`\n\nExample command:\n\n```bash\ncp mjlab_patch\u002Fmjlab\u002Fmanagers\u002Fobservation_manager.py \\\n  \u002Fhome\u002Fcrp\u002Fminiconda3\u002Fenvs\u002Fmjlab\u002Flib\u002Fpython3.11\u002Fsite-packages\u002Fmjlab\u002Fmanagers\u002Fobservation_manager.py\n```\n\n### 3. List Available Tasks\n\n```bash\npython scripts\u002Flist_envs.py --keyword AMP\n```\n\nMain tasks:\n\n- `Unitree-G1-AMP-Rough`\n- `Unitree-G1-AMP-Flat`\n\n## Training\n\n```bash\npython scripts\u002Ftrain.py Unitree-G1-AMP-Flat --env.scene.num-envs=4096\n```\n\nLogs are saved by default to:\n\n- `logs\u002Frsl_rl\u002Fg1_amp_locomotion\u002F\u003Ctime_stamp_run>\u002F`\n\n## Training Curve Note (Important)\n\n- Around `2w` iterations (about 20k), the policy often suddenly learns fall-recovery behavior.\n- As a result, multiple metrics in `logs` may show abrupt jumps. This is expected and not necessarily a training failure.\n\n![Training log transition example](logs.png)\n\n## Evaluation and Visualization\n\nReplay with a trained checkpoint:\n\n```bash\npython scripts\u002Fplay.py Unitree-G1-AMP-Rough \\\n  --checkpoint-file logs\u002Frsl_rl\u002Fg1_amp_locomotion\u002F\u003Crun_dir>\u002Fmodel_\u003Citer>.pt\n```\n\nNote: ONNX export is enabled by default in both training and play workflows.\n\n## Motion Data Preparation\n\nCSV-to-NPZ conversion script:\n\n```bash\npython scripts\u002Fcsv_to_npz.py --help\n```\n\nRecommended data layout:\n\n- Raw CSV: `motion_data_csv\u002Famp`\n- Converted NPZ: `src\u002Fassets\u002Fmotions\u002Fg1\u002Famp\u002FWalkandRun` and `src\u002Fassets\u002Fmotions\u002Fg1\u002Famp\u002FRecovery`\n\nIf valid NPZ files exist in these folders, training config loads them automatically.\n\n## Repository Structure\n\n- `src\u002Ftasks\u002Famp_loco`: AMP locomotion\u002Frecovery task implementation\n- `src\u002Ftasks\u002Famp_loco\u002Fconfig\u002Fg1`: G1 task registration, env configs, RL configs\n- `src\u002Ftasks\u002Famp_loco\u002Fmdp`: rewards, observations, events, termination logic\n- `scripts\u002Ftrain.py`: training entry point\n- `scripts\u002Fplay.py`: playback entry point\n- `scripts\u002Fcsv_to_npz.py`: motion data conversion tool\n- `mjlab_patch`: required local patch for mjlab\n\n## Highlights\n\n- One policy unifies walk\u002Frun and recovery skills\n- AMP + velocity objective jointly optimize style and task performance\n- Delayed reset with recovery sampling explicitly improves recovery ability\n- End-to-end pipeline supports ONNX export for deployment\n\n## Acknowledgements\n\n- Thanks to [unitreerobotics\u002Funitree_rl_mjlab](https:\u002F\u002Fgithub.com\u002Funitreerobotics\u002Funitree_rl_mjlab) for open-sourcing their work and inspiration.\n- Thanks to [Open-X-Humanoid\u002FTienKung-Lab](https:\u002F\u002Fgithub.com\u002FOpen-X-Humanoid\u002FTienKung-Lab); the rsl_rl AMP part in this project references their implementation.\n","AMP_mjlab 是一个基于 mjlab 和 rsl_rl 的G1 AMP运动控制项目。该项目的核心功能是通过单一策略同时学习行走\u002F跑步和摔倒后起身的能力，使用AMP判别器来规范动作风格和先验。训练和部署流程保持一致，并支持直接导出ONNX格式的策略模型。适用于需要机器人在复杂环境中进行连续、平滑运动控制的场景，如机器人导航和救援任务。实现过程中，通过对运动数据进行分类处理以及延迟终止\u002F重置机制，减少了因策略切换带来的不连续性，从而提高了行为的一致性和鲁棒性。","2026-06-11 02:49:52","CREATED_QUERY"]