[software] 添加16DOF早期训练仿真与Sim2Real闭环

This commit is contained in:
2026-07-21 16:15:14 +08:00
parent 9bd22225f9
commit e9e2c946b3
681 changed files with 137221 additions and 8 deletions
+140
View File
@@ -0,0 +1,140 @@
![Project banner](https://raw.githubusercontent.com/mujocolab/mjlab/main/docs/source/_static/mjlab-banner.jpg)
# mjlab
[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/mujocolab/mjlab/ci.yml?branch=main)](https://github.com/mujocolab/mjlab/actions/workflows/ci.yml?query=branch%3Amain)
[![Documentation](https://github.com/mujocolab/mjlab/actions/workflows/docs.yml/badge.svg)](https://mujocolab.github.io/mjlab/)
[![License](https://img.shields.io/github/license/mujocolab/mjlab)](https://github.com/mujocolab/mjlab/blob/main/LICENSE)
[![Nightly Benchmarks](https://img.shields.io/badge/Nightly-Benchmarks-blue)](https://mujocolab.github.io/mjlab/nightly/)
[![PyPI](https://img.shields.io/pypi/v/mjlab)](https://pypi.org/project/mjlab/)
[![PyPI downloads](https://img.shields.io/pypi/dm/mjlab?color=blue)](https://pypistats.org/packages/mjlab)
mjlab combines [Isaac Lab](https://github.com/isaac-sim/IsaacLab)'s manager-based API with [MuJoCo Warp](https://github.com/google-deepmind/mujoco_warp), a GPU-accelerated version of [MuJoCo](https://github.com/google-deepmind/mujoco).
The framework provides composable building blocks for environment design,
with minimal dependencies and direct access to native MuJoCo data structures.
## Getting Started
mjlab requires an NVIDIA GPU for training. macOS is supported for evaluation only.
**Try it now:**
Run the demo (no installation needed):
```bash
uvx --from mjlab --refresh demo
```
Or try in [Google Colab](https://colab.research.google.com/github/mujocolab/mjlab/blob/main/notebooks/demo.ipynb) (no local setup required).
**Install from source:**
```bash
git clone https://github.com/mujocolab/mjlab.git && cd mjlab
uv run demo
```
For alternative installation methods (PyPI, Docker), see the [Installation Guide](https://mujocolab.github.io/mjlab/main/source/installation.html).
## Training Examples
### 1. Velocity Tracking
Train a Unitree G1 humanoid to follow velocity commands on flat terrain:
```bash
uv run train Mjlab-Velocity-Flat-Unitree-G1 --env.scene.num-envs 4096
```
**Multi-GPU Training:** Scale to multiple GPUs using `--gpu-ids`:
```bash
uv run train Mjlab-Velocity-Flat-Unitree-G1 \
--gpu-ids "[0, 1]" \
--env.scene.num-envs 4096
```
See the [Distributed Training guide](https://mujocolab.github.io/mjlab/main/source/training/distributed_training.html) for details.
Evaluate a policy while training (fetches latest checkpoint from Weights & Biases):
```bash
uv run play Mjlab-Velocity-Flat-Unitree-G1 --wandb-run-path your-org/mjlab/run-id
```
### 2. Motion Imitation
Train a humanoid to mimic reference motions. See the [motion imitation guide](https://mujocolab.github.io/mjlab/main/source/training/motion_imitation.html) for preprocessing setup.
```bash
uv run train Mjlab-Tracking-Flat-Unitree-G1 --registry-name your-org/motions/motion-name --env.scene.num-envs 4096
uv run play Mjlab-Tracking-Flat-Unitree-G1 --wandb-run-path your-org/mjlab/run-id
```
### 3. Sanity-check with Dummy Agents
Use built-in agents to sanity check your MDP before training:
```bash
uv run play Mjlab-Your-Task-Id --agent zero # Sends zero actions
uv run play Mjlab-Your-Task-Id --agent random # Sends uniform random actions
```
When running motion-tracking tasks, add `--registry-name your-org/motions/motion-name` to the command.
## Documentation
Full documentation is available at **[mujocolab.github.io/mjlab](https://mujocolab.github.io/mjlab/)**.
## Development
```bash
make test # Run all tests
make test-fast # Skip slow tests
make format # Format and lint
make docs # Build docs locally
```
For development setup: `uvx pre-commit install`
## Citation
mjlab is used in published research and open-source robotics projects. See the [Research](https://mujocolab.github.io/mjlab/main/source/research.html) page for publications and projects, or share your own in [Show and Tell](https://github.com/mujocolab/mjlab/discussions/categories/show-and-tell).
If you use mjlab in your research, please consider citing:
```bibtex
@misc{zakka2026mjlablightweightframeworkgpuaccelerated,
title={mjlab: A Lightweight Framework for GPU-Accelerated Robot Learning},
author={Kevin Zakka and Qiayuan Liao and Brent Yi and Louis Le Lay and Koushil Sreenath and Pieter Abbeel},
year={2026},
eprint={2601.22074},
archivePrefix={arXiv},
primaryClass={cs.RO},
url={https://arxiv.org/abs/2601.22074},
}
```
## License
mjlab is licensed under the [Apache License, Version 2.0](LICENSE).
### Third-Party Code
Some portions of mjlab are forked from external projects:
- **`src/mjlab/utils/lab_api/`** — Utilities forked from [NVIDIA Isaac
Lab](https://github.com/isaac-sim/IsaacLab) (BSD-3-Clause license, see file
headers)
Forked components retain their original licenses. See file headers for details.
## Acknowledgments
mjlab wouldn't exist without the excellent work of the Isaac Lab team, whose API
design and abstractions mjlab builds upon.
Thanks to the MuJoCo Warp team — especially Erik Frey and Taylor Howell — for
answering our questions, giving helpful feedback, and implementing features
based on our requests countless times.