{"id":23296057,"url":"https://github.com/unitreerobotics/unitree_rl_gym","last_synced_at":"2026-01-18T01:07:18.153Z","repository":{"id":199658283,"uuid":"703406051","full_name":"unitreerobotics/unitree_rl_gym","owner":"unitreerobotics","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-06T09:06:08.000Z","size":58205,"stargazers_count":314,"open_issues_count":9,"forks_count":62,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-12-06T09:31:19.794Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unitreerobotics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-11T07:24:59.000Z","updated_at":"2024-12-06T09:12:46.000Z","dependencies_parsed_at":"2024-12-06T09:36:46.757Z","dependency_job_id":null,"html_url":"https://github.com/unitreerobotics/unitree_rl_gym","commit_stats":null,"previous_names":["unitreerobotics/unitree_rl_gym"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitreerobotics%2Funitree_rl_gym","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitreerobotics%2Funitree_rl_gym/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitreerobotics%2Funitree_rl_gym/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unitreerobotics%2Funitree_rl_gym/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unitreerobotics","download_url":"https://codeload.github.com/unitreerobotics/unitree_rl_gym/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230547632,"owners_count":18243227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-20T07:01:29.787Z","updated_at":"2026-01-18T01:07:18.138Z","avatar_url":"https://github.com/unitreerobotics.png","language":"Python","funding_links":[],"categories":["Python","Repos","1. 机器人项目 | Robots"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eUnitree RL GYM\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cspan\u003e 🌎English \u003c/span\u003e | \u003ca href=\"README_zh.md\"\u003e 🇨🇳中文 \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eThis is a repository for reinforcement learning implementation based on Unitree robots, supporting Unitree Go2, H1, H1_2, and G1.\u003c/strong\u003e \n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n| \u003cdiv align=\"center\"\u003e Isaac Gym \u003c/div\u003e | \u003cdiv align=\"center\"\u003e  Mujoco \u003c/div\u003e |  \u003cdiv align=\"center\"\u003e Physical \u003c/div\u003e |\n|--- | --- | --- |\n| [\u003cimg src=\"https://oss-global-cdn.unitree.com/static/32f06dc9dfe4452dac300dda45e86b34.GIF\" width=\"240px\"\u003e](https://oss-global-cdn.unitree.com/static/5bbc5ab1d551407080ca9d58d7bec1c8.mp4) | [\u003cimg src=\"https://oss-global-cdn.unitree.com/static/244cd5c4f823495fbfb67ef08f56aa33.GIF\" width=\"240px\"\u003e](https://oss-global-cdn.unitree.com/static/5aa48535ffd641e2932c0ba45c8e7854.mp4) | [\u003cimg src=\"https://oss-global-cdn.unitree.com/static/78c61459d3ab41448cfdb31f6a537e8b.GIF\" width=\"240px\"\u003e](https://oss-global-cdn.unitree.com/static/0818dcf7a6874b92997354d628adcacd.mp4) |\n\n\u003c/div\u003e\n\n---\n\n## 📦 Installation and Configuration\n\nPlease refer to [setup.md](/doc/setup_en.md) for installation and configuration steps.\n\n## 🔁 Process Overview\n\nThe basic workflow for using reinforcement learning to achieve motion control is:\n\n`Train` → `Play` → `Sim2Sim` → `Sim2Real`\n\n- **Train**: Use the Gym simulation environment to let the robot interact with the environment and find a policy that maximizes the designed rewards. Real-time visualization during training is not recommended to avoid reduced efficiency.\n- **Play**: Use the Play command to verify the trained policy and ensure it meets expectations.\n- **Sim2Sim**: Deploy the Gym-trained policy to other simulators to ensure it’s not overly specific to Gym characteristics.\n- **Sim2Real**: Deploy the policy to a physical robot to achieve motion control.\n\n## 🛠️ User Guide\n\n### 1. Training\n\nRun the following command to start training:\n\n```bash\npython legged_gym/scripts/train.py --task=xxx\n```\n\n#### ⚙️ Parameter Description\n- `--task`: Required parameter; values can be (go2, g1, h1, h1_2).\n- `--headless`: Defaults to starting with a graphical interface; set to true for headless mode (higher efficiency).\n- `--resume`: Resume training from a checkpoint in the logs.\n- `--experiment_name`: Name of the experiment to run/load.\n- `--run_name`: Name of the run to execute/load.\n- `--load_run`: Name of the run to load; defaults to the latest run.\n- `--checkpoint`: Checkpoint number to load; defaults to the latest file.\n- `--num_envs`: Number of environments for parallel training.\n- `--seed`: Random seed.\n- `--max_iterations`: Maximum number of training iterations.\n- `--sim_device`: Simulation computation device; specify CPU as `--sim_device=cpu`.\n- `--rl_device`: Reinforcement learning computation device; specify CPU as `--rl_device=cpu`.\n\n**Default Training Result Directory**: `logs/\u003cexperiment_name\u003e/\u003cdate_time\u003e_\u003crun_name\u003e/model_\u003citeration\u003e.pt`\n\n---\n\n### 2. Play\n\nTo visualize the training results in Gym, run the following command:\n\n```bash\npython legged_gym/scripts/play.py --task=xxx\n```\n\n**Description**:\n\n- Play’s parameters are the same as Train’s.\n- By default, it loads the latest model from the experiment folder’s last run.\n- You can specify other models using `load_run` and `checkpoint`.\n\n#### 💾 Export Network\n\nPlay exports the Actor network, saving it in `logs/{experiment_name}/exported/policies`:\n- Standard networks (MLP) are exported as `policy_1.pt`.\n- RNN networks are exported as `policy_lstm_1.pt`.\n\n### Play Results\n\n| Go2 | G1 | H1 | H1_2 |\n|--- | --- | --- | --- |\n| [![go2](https://oss-global-cdn.unitree.com/static/ba006789e0af4fe3867255f507032cd7.GIF)](https://oss-global-cdn.unitree.com/static/d2e8da875473457c8d5d69c3de58b24d.mp4) | [![g1](https://oss-global-cdn.unitree.com/static/32f06dc9dfe4452dac300dda45e86b34.GIF)](https://oss-global-cdn.unitree.com/static/5bbc5ab1d551407080ca9d58d7bec1c8.mp4) | [![h1](https://oss-global-cdn.unitree.com/static/fa04e73966934efa9838e9c389f48fa2.GIF)](https://oss-global-cdn.unitree.com/static/522128f4640c4f348296d2761a33bf98.mp4) |[![h1_2](https://oss-global-cdn.unitree.com/static/83ed59ca0dab4a51906aff1f93428650.GIF)](https://oss-global-cdn.unitree.com/static/15fa46984f2343cb83342fd39f5ab7b2.mp4)|\n\n---\n\n### 3. Sim2Sim (Mujoco)\n\nRun Sim2Sim in the Mujoco simulator:\n\n```bash\npython deploy/deploy_mujoco/deploy_mujoco.py {config_name}\n```\n\n#### Parameter Description\n- `config_name`: Configuration file; default search path is `deploy/deploy_mujoco/configs/`.\n\n#### Example: Running G1\n\n```bash\npython deploy/deploy_mujoco/deploy_mujoco.py g1.yaml\n```\n\n#### ➡️ Replace Network Model\n\nThe default model is located at `deploy/pre_train/{robot}/motion.pt`; custom-trained models are saved in `logs/g1/exported/policies/policy_lstm_1.pt`. Update the `policy_path` in the YAML configuration file accordingly.\n\n#### Simulation Results\n\n| G1 | H1 | H1_2 |\n|--- | --- | --- |\n| [![mujoco_g1](https://oss-global-cdn.unitree.com/static/244cd5c4f823495fbfb67ef08f56aa33.GIF)](https://oss-global-cdn.unitree.com/static/5aa48535ffd641e2932c0ba45c8e7854.mp4)  |  [![mujoco_h1](https://oss-global-cdn.unitree.com/static/7ab4e8392e794e01b975efa205ef491e.GIF)](https://oss-global-cdn.unitree.com/static/8934052becd84d08bc8c18c95849cf32.mp4)  |  [![mujoco_h1_2](https://oss-global-cdn.unitree.com/static/2905e2fe9b3340159d749d5e0bc95cc4.GIF)](https://oss-global-cdn.unitree.com/static/ee7ee85bd6d249989a905c55c7a9d305.mp4) |\n\n\n---\n\n### 4. Sim2Real (Physical Deployment)\n\nBefore deploying to the physical robot, ensure it’s in debug mode. Detailed steps can be found in the [Physical Deployment Guide](deploy/deploy_real/README.md):\n\n```bash\npython deploy/deploy_real/deploy_real.py {net_interface} {config_name}\n```\n\n\n#### Parameter Description\n- `net_interface`: Network card name connected to the robot, e.g., `enp3s0`.\n- `config_name`: Configuration file located in `deploy/deploy_real/configs/`, e.g., `g1.yaml`, `h1.yaml`, `h1_2.yaml`.\n\n#### Deployment Results\n\n| G1 | H1 | H1_2 |\n|--- | --- | --- |\n| [![real_g1](https://oss-global-cdn.unitree.com/static/78c61459d3ab41448cfdb31f6a537e8b.GIF)](https://oss-global-cdn.unitree.com/static/0818dcf7a6874b92997354d628adcacd.mp4) | [![real_h1](https://oss-global-cdn.unitree.com/static/fa07b2fd2ad64bb08e6b624d39336245.GIF)](https://oss-global-cdn.unitree.com/static/ea0084038d384e3eaa73b961f33e6210.mp4) | [![real_h1_2](https://oss-global-cdn.unitree.com/static/a88915e3523546128a79520aa3e20979.GIF)](https://oss-global-cdn.unitree.com/static/12d041a7906e489fae79d55b091a63dd.mp4) |\n\n---\n\n#### Deploy with C++\nThere is also an example of deploying the G1 pre-trained model in C++. the C++ code is located in the following directory.\n\n```\ndeploy/deploy_real/cpp_g1\n```\n\nFirst, navigate to the directory above.\n\n```base\ncd deploy/deploy_real/cpp_g1\n```\n\nThe C++ implementation depends on the LibTorch library, download the LibTorch\n\n```bash\nwget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.7.1%2Bcpu.zip\nunzip libtorch-cxx11-abi-shared-with-deps-2.7.1+cpu.zip\n```\n\nTo build the project, executable the following steps\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake -j4\n```\n\nAfter successful compilation, executate the program with:\n\n```base\n./g1_deploy_run {net_interface}\n```\n\nReplace `{net_interface}` with your actual network interface name (e.g., eth0, wlan0).\n\n## 🎉 Acknowledgments\n\nThis repository is built upon the support and contributions of the following open-source projects. Special thanks to:\n\n- [legged\\_gym](https://github.com/leggedrobotics/legged_gym): The foundation for training and running codes.\n- [rsl\\_rl](https://github.com/leggedrobotics/rsl_rl.git): Reinforcement learning algorithm implementation.\n- [mujoco](https://github.com/google-deepmind/mujoco.git): Providing powerful simulation functionalities.\n- [unitree\\_sdk2\\_python](https://github.com/unitreerobotics/unitree_sdk2_python.git): Hardware communication interface for physical deployment.\n\n---\n\n## 🔖 License\n\nThis project is licensed under the [BSD 3-Clause License](./LICENSE):\n1. The original copyright notice must be retained.\n2. The project name or organization name may not be used for promotion.\n3. Any modifications must be disclosed.\n\nFor details, please read the full [LICENSE file](./LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitreerobotics%2Funitree_rl_gym","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funitreerobotics%2Funitree_rl_gym","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitreerobotics%2Funitree_rl_gym/lists"}