diff --git a/.gitignore b/.gitignore index 68e22178..2cd398af 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ MUJOCO_LOG.TXT wasm/**/dist/ **/node_modules/ +.venv/ diff --git a/README.md b/README.md index 22a23e0e..56d7f46b 100644 --- a/README.md +++ b/README.md @@ -14,156 +14,112 @@

-**MuJoCo** stands for **Mu**lti-**Jo**int dynamics with **Co**ntact. It is a -general purpose physics engine that aims to facilitate research and development -in robotics, biomechanics, graphics and animation, machine learning, and other -areas which demand fast and accurate simulation of articulated structures -interacting with their environment. +**MuJoCo** 是 **Mu**lti-**Jo**int dynamics with **Co**ntact(带接触的多关节动力学)的缩写。它是一款通用物理引擎,旨在促进机器人学、生物力学、图形与动画、机器学习以及其他需要对与环境交互的多关节结构进行快速且精确仿真的领域的研究与开发。 -This repository is maintained by [Google DeepMind](https://www.deepmind.com/). +本项目由 [Google DeepMind](https://www.deepmind.com/) 维护。 -MuJoCo has a C API and is intended for researchers and developers. The runtime -simulation module is tuned to maximize performance and operates on low-level -data structures that are preallocated by the built-in XML compiler. The library -includes interactive visualization with a native GUI, rendered in OpenGL. MuJoCo -further exposes a large number of utility functions for computing -physics-related quantities. +MuJoCo 提供 C API,面向研究人员和开发者。其实时仿真模块经过专门调优以实现极致性能,并运行在由内置 XML 编译器预先分配的底层数据结构之上。该库包含使用 OpenGL 渲染的原生 GUI 交互式可视化工具。MuJoCo 还提供了大量用于计算物理相关物理量的实用函数。 -We also provide [Python bindings] and a plug-in for the [Unity] game engine. +我们还提供了 [Python 绑定][Python bindings] 以及用于 [Unity] 游戏引擎的插件。 -## Documentation +## 文档 -MuJoCo's documentation can be found at [mujoco.readthedocs.io]. Upcoming -features due for the next release can be found in the [changelog] in the -"latest" branch. +MuJoCo 的文档可在 [mujoco.readthedocs.io] 查阅。下一个版本即将推出的新特性可以在 “latest” 分支的[更新日志][changelog]中找到。 -## Getting Started +## 快速入门 -There are two easy ways to get started with MuJoCo: +快速上手 MuJoCo 有两种简便途径: -1. **Run `simulate` on your machine.** -[This video](https://www.youtube.com/watch?v=P83tKA1iz2Y) shows a screen capture -of `simulate`, MuJoCo's native interactive viewer. Follow the steps described in -the [Getting Started] section of the documentation to get `simulate` running on -your machine. +1. **在本地运行 `simulate`。** +[此视频](https://www.youtube.com/watch?v=P83tKA1iz2Y)展示了 MuJoCo 原生交互式查看器 `simulate` 的录屏。请按照文档中的[快速入门][Getting Started]部分描述的步骤在您的机器上运行 `simulate`。 -2. **Explore our online IPython notebooks.** -If you are a Python user, you might want to start with our tutorial notebooks -running on Google Colab: +2. **探索在线 IPython Notebook 教程。** +如果您是 Python 用户,建议从运行在 Google Colab 上的教程 Notebook 开始: - - The **introductory** tutorial teaches MuJoCo basics: + - **入门**教程讲解 MuJoCo 基础知识: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/python/tutorial.ipynb) - - The **Model Editing** tutorial shows how to create and edit models procedurally: + - **模型编辑**教程演示如何通过代码程序化创建和编辑模型: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/python/mjspec.ipynb) - - The **rollout** tutorial shows how to use the multithreaded `rollout` module: + - **rollout** 教程介绍如何使用多线程 `rollout` 模块: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/python/rollout.ipynb) - - The **LQR** tutorial synthesizes a linear-quadratic controller, balancing a - humanoid on one leg: + - **LQR** 教程演示如何合成线性二次型控制器(LQR),实现人形机器人单腿平衡: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/python/LQR.ipynb) - - The **least-squares** tutorial explains how to use the Python-based nonlinear - least-squares solver: + - **最小二乘法**教程解释如何使用基于 Python 的非线性最小二乘求解器: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/python/least_squares.ipynb) - - The **MJX** tutorial provides usage examples of - [MuJoCo XLA](https://mujoco.readthedocs.io/en/stable/mjx.html), a branch of MuJoCo written in JAX: + - **MJX** 教程提供了 [MuJoCo XLA](https://mujoco.readthedocs.io/en/stable/mjx.html) 的使用示例,它是用 JAX 编写的 MuJoCo 分支版本: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/mjx/tutorial.ipynb) - - The **differentiable physics** tutorial trains locomotion policies with - analytical gradients automatically derived from MuJoCo's physics step: + - **可微物理**教程展示如何利用从 MuJoCo 物理计算步中自动推导出的解析梯度来训练运动控制策略: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/mjx/training_apg.ipynb) -## Installation +## 安装 -### Prebuilt binaries +### 预编译二进制文件 -Versioned releases are available as precompiled binaries from the GitHub -[releases page], built for Linux (x86-64 and AArch64), Windows (x86-64 only), -and macOS (universal). This is the recommended way to use the software. +带有版本号的正式发行版预编译二进制文件可在 GitHub [发布页面][releases page] 获取,支持 Linux(x86-64 和 AArch64)、Windows(仅限 x86-64)和 macOS(通用架构)。这是使用本软件的推荐方式。 -### Building from source +### 从源码构建 -Users who wish to build MuJoCo from source should consult the [build from -source] section of the documentation. However, note that the commit at -the tip of the `main` branch may be unstable. +希望从源码构建 MuJoCo 的用户请参阅文档中的[从源码构建][build from source]部分。但请注意,`main` 分支最新的提交可能不够稳定。 ### Python (>= 3.10) -The native Python bindings, which come pre-packaged with a copy of MuJoCo, can -be installed from [PyPI] via: +原生 Python 绑定已预打包了 MuJoCo 副本,可以通过 [PyPI] 进行安装: ```bash pip install mujoco ``` -Note that Pre-built Linux wheels target `manylinux2014`, see -[here](https://github.com/pypa/manylinux) for compatible distributions. For more -information such as building the bindings from source, see the [Python bindings] -section of the documentation. +请注意,预构建的 Linux wheel 面向 `manylinux2014`,兼容的发行版参见[此处](https://github.com/pypa/manylinux)。有关从源码构建绑定等更多信息,请参阅文档中的 [Python 绑定][Python bindings]部分。 -## Versioning +## 版本规范 -We aim to release MuJoCo in the first week of each month. Our versioning -standards changed to modified Semantic Versioning in 3.5.0, -see [versioning](VERSIONING.md) for details. +我们力求在每月的首周发布新版本 MuJoCo。自 3.5.0 版本起,我们的版本命名规范变更为修订版语义化版本控制(modified Semantic Versioning),详情请参阅 [版本规范](VERSIONING.md)。 -## Contributing +## 参与贡献 -We welcome community engagement: questions, requests for help, bug reports and -feature requests. To read more about bug reports, feature requests and more -ambitious contributions, please see our [contributors guide](CONTRIBUTING.md) -and [style guide](STYLEGUIDE.md). +我们非常欢迎社区参与:包括提问、寻求帮助、错误报告以及功能建议。欲了解更多有关提交 Bug 报告、功能需求以及更深入贡献的指引,请参阅我们的[贡献指南](CONTRIBUTING.md)和[代码风格指南](STYLEGUIDE.md)。 -## Asking Questions +## 提问与交流 -Questions and requests for help are welcome as a GitHub -["Asking for Help" Discussion](https://github.com/google-deepmind/mujoco/discussions/categories/asking-for-help) -and should focus on a specific problem or question. +欢迎在 GitHub 的 [“Asking for Help” 讨论区](https://github.com/google-deepmind/mujoco/discussions/categories/asking-for-help) 提出问题或寻求帮助,请尽量聚焦于具体的问题或疑问。 -## Bug reports and feature requests +## 错误报告与功能需求 -GitHub [Issues](https://github.com/google-deepmind/mujoco/issues) are reserved -for bug reports, feature requests and other development-related subjects. +GitHub [Issues](https://github.com/google-deepmind/mujoco/issues) 仅用于提交 Bug 报告、功能需求以及其他与开发相关的主题。 -## Related software -MuJoCo is the backbone for numerous environment packages. Below we list several -bindings and converters. +## 相关软件生态 -### Bindings +MuJoCo 是许多仿真环境软件包的核心支撑。下面列出了一些语言绑定与格式转换器。 -These packages give users of various languages access to MuJoCo functionality: +### 语言绑定 -#### First-party bindings: +这些软件包为不同编程语言的用户提供了访问 MuJoCo 功能的接口: -- [Python bindings](https://mujoco.readthedocs.io/en/stable/python.html) - - [dm_control](https://github.com/google-deepmind/dm_control), Google - DeepMind's related environment stack, includes - [PyMJCF](https://github.com/google-deepmind/dm_control/blob/main/dm_control/mjcf/README.md), - a module for procedural manipulation of MuJoCo models. -- [JavaScript bindings and WebAssembly support](/wasm/README.md) (inspired [stillonearth](https://github.com/stillonearth) and [zalo](https://github.com/zalo)'s community projects; [mjswan](https://github.com/ttktjmt/mjswan) extends these with real-time policy control, interactive force -application, and more). -- [C# bindings and Unity plug-in](https://mujoco.readthedocs.io/en/stable/unity.html) +#### 第一方绑定: -#### Third-party bindings: +- [Python 绑定](https://mujoco.readthedocs.io/en/stable/python.html) + - [dm_control](https://github.com/google-deepmind/dm_control),Google DeepMind 的相关环境技术栈,包含了用于程序化操作 MuJoCo 模型的模块 [PyMJCF](https://github.com/google-deepmind/dm_control/blob/main/dm_control/mjcf/README.md)。 +- [JavaScript 绑定与 WebAssembly 支持](/wasm/README.md)(灵感源于 [stillonearth](https://github.com/stillonearth) 和 [zalo](https://github.com/zalo) 的社区项目;[mjswan](https://github.com/ttktjmt/mjswan) 扩展了其实时策略控制、交互式施力等功能)。 +- [C# 绑定与 Unity 插件](https://mujoco.readthedocs.io/en/stable/unity.html) -- **MATLAB Simulink**: [Simulink Blockset for MuJoCo Simulator](https://github.com/mathworks-robotics/mujoco-simulink-blockset) - by [Manoj Velmurugan](https://github.com/vmanoj1996). +#### 第三方绑定: + +- **MATLAB Simulink**: [Simulink Blockset for MuJoCo Simulator](https://github.com/mathworks-robotics/mujoco-simulink-blockset)(由 [Manoj Velmurugan](https://github.com/vmanoj1996) 开发)。 - **Swift**: [swift-mujoco](https://github.com/liuliu/swift-mujoco) - **Java**: [mujoco-java](https://github.com/CommonWealthRobotics/mujoco-java) - **Julia**: [MuJoCo.jl](https://github.com/JamieMair/MuJoCo.jl) - **Rust**: [MuJoCo-rs](https://github.com/davidhozic/mujoco-rs) -### Converters +### 格式转换工具 -- **OpenSim**: [MyoConverter](https://github.com/MyoHub/myoconverter) converts - OpenSim models to MJCF. -- **SDFormat**: [gz-mujoco](https://github.com/gazebosim/gz-mujoco/) is a - two-way SDFormat <-> MJCF conversion tool. -- **OBJ**: [obj2mjcf](https://github.com/kevinzakka/obj2mjcf) - a script for converting composite OBJ files into a loadable MJCF model. -- **onshape**: [Onshape to Robot](https://github.com/rhoban/onshape-to-robot) - Converts [onshape](https://www.onshape.com/en/) CAD assemblies to MJCF. +- **OpenSim**: [MyoConverter](https://github.com/MyoHub/myoconverter) 将 OpenSim 模型转换为 MJCF。 +- **SDFormat**: [gz-mujoco](https://github.com/gazebosim/gz-mujoco/) 是 SDFormat 与 MJCF 之间的双向转换工具。 +- **OBJ**: [obj2mjcf](https://github.com/kevinzakka/obj2mjcf) 用于将组合 OBJ 文件转换为可加载的 MJCF 模型的脚本。 +- **onshape**: [Onshape to Robot](https://github.com/rhoban/onshape-to-robot) 将 [onshape](https://www.onshape.com/en/) CAD 装配体转换为 MJCF。 -## Citation +## 引用 -If you use MuJoCo for published research, please cite: +如果您在公开发表的学术研究中使用了 MuJoCo,请按如下格式引用: ``` @inproceedings{todorov2012mujoco, @@ -177,22 +133,17 @@ If you use MuJoCo for published research, please cite: } ``` -## License and Disclaimer +## 开源许可证与免责声明 Copyright 2021 DeepMind Technologies Limited. -Box collision code ([`engine_collision_box.c`](https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_box.c)) -is Copyright 2016 Svetoslav Kolev. +盒体碰撞检测代码([`engine_collision_box.c`](https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_box.c))版权所有 © 2016 Svetoslav Kolev。 -ReStructuredText documents, images, and videos in the `doc` directory are made -available under the terms of the Creative Commons Attribution 4.0 (CC BY 4.0) -license. You may obtain a copy of the License at -https://creativecommons.org/licenses/by/4.0/legalcode. +`doc` 目录下的 ReStructuredText 文档、图像和视频均依据知识共享署名 4.0 国际许可协议(Creative Commons Attribution 4.0, CC BY 4.0)提供。您可在 https://creativecommons.org/licenses/by/4.0/legalcode 获取该许可证副本。 -Source code is licensed under the Apache License, Version 2.0. You may obtain a -copy of the License at https://www.apache.org/licenses/LICENSE-2.0. +源代码基于 Apache 许可证 2.0 版(Apache License, Version 2.0)授权。您可在 https://www.apache.org/licenses/LICENSE-2.0 获取许可证副本。 -This is not an officially supported Google product. +本项目不是 Google 官方支持的产品。 [build from source]: https://mujoco.readthedocs.io/en/latest/programming#building-from-source [Getting Started]: https://mujoco.readthedocs.io/en/latest/programming#getting-started diff --git a/mjx/README.md b/mjx/README.md index f4796a5f..bb653700 100644 --- a/mjx/README.md +++ b/mjx/README.md @@ -7,48 +7,33 @@ [pypi-badge]: https://badge.fury.io/py/mujoco-mjx.svg [pypi]: https://pypi.org/project/mujoco-mjx/ -This package is a re-implementation of the -[MuJoCo physics engine](https://github.com/google-deepmind/mujoco) in -[JAX](https://github.com/jax-ml/jax). This library is developed and maintained -by Google DeepMind, and is kept up-to-date with the latest developments in -MuJoCo itself. +本软件包是基于 [JAX](https://github.com/jax-ml/jax) 对 [MuJoCo 物理引擎](https://github.com/google-deepmind/mujoco) 的重新实现。该库由 Google DeepMind 开发和维护,并与 MuJoCo 本身的最新进展保持同步。 -The `mujoco-mjx` package is API-compatible with MuJoCo, but is missing some -features found in MuJoCo. See our -[documentation](https://mujoco.readthedocs.io/en/stable/mjx.html) for more -details concerning feature parity. +`mujoco-mjx` 软件包在 API 上与 MuJoCo 兼容,但缺少 MuJoCo 中的某些功能。有关功能特性的对齐情况,请参阅我们的[官方文档](https://mujoco.readthedocs.io/en/stable/mjx.html)。 -## Installation +## 安装 -The recommended way to install this package is via [PyPI](https://pypi.org/project/mujoco-mjx/): +推荐通过 [PyPI](https://pypi.org/project/mujoco-mjx/) 安装本软件包: ```sh pip install mujoco-mjx ``` -## Usage +## 使用说明 -Once installed, the package can be imported via `from mujoco import mjx`. Please -consult our [documentation](https://mujoco.readthedocs.io/en/stable/mjx.html) -for further detail on the package's API. +安装完成后,可以通过 `from mujoco import mjx` 导入该包。有关该包 API 的更多详细信息,请参阅我们的[官方文档](https://mujoco.readthedocs.io/en/stable/mjx.html)。 -We recommend going through the tutorial notebook which introduces the MJX API -and trains a reinforcement learning policy in a few minutes: [![Open In -Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/mjx/tutorial.ipynb) +我们建议查阅教程 Notebook,它介绍了 MJX API 并在数分钟内训练一个强化学习策略: +[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco/blob/main/mjx/tutorial.ipynb) -## Versioning +## 版本规范 -The `major.minor.micro` portion of the version number matches the version of -MuJoCo that this library provides. Optionally, if we release updates to MJX that -target the same version of MuJoCo, a `.postN` suffix is added, for example -`3.0.1.post2` represents the second update to MJX for MuJoCo 3.0.1. +版本号的 `major.minor.micro` 部分与该库所基于的 MuJoCo 版本保持一致。可选地,如果我们发布了针对同一 MuJoCo 版本的 MJX 自身更新,则会添加 `.postN` 后缀,例如 `3.0.1.post2` 表示针对 MuJoCo 3.0.1 的 MJX 第二次更新。 -## License and Disclaimer +## 开源许可证与免责声明 Copyright 2023 DeepMind Technologies Limited -MuJoCo and its libraries are licensed under the Apache License, -Version 2.0. You may obtain a copy of the License at -https://www.apache.org/licenses/LICENSE-2.0. +MuJoCo 及其相关库基于 Apache 许可证 2.0 版(Apache License, Version 2.0)授权。您可在 https://www.apache.org/licenses/LICENSE-2.0 获取许可证副本。 -This is not an officially supported Google product. +本项目不是 Google 官方支持的产品。 diff --git a/mjx/mujoco/mjx/codegen/README.md b/mjx/mujoco/mjx/codegen/README.md index 3161b534..b5bb5414 100644 --- a/mjx/mujoco/mjx/codegen/README.md +++ b/mjx/mujoco/mjx/codegen/README.md @@ -1,11 +1,10 @@ -# MJX Warp Codegen +# MJX Warp 代码生成(Codegen) -Generates the MJX-Warp shim layer in `mujoco/mjx/warp/` by reading the vendored -`mujoco_warp` source in `mujoco/mjx/third_party/mujoco_warp/`. +通过读取 `mujoco/mjx/third_party/mujoco_warp/` 中内嵌的 `mujoco_warp` 源码,在 `mujoco/mjx/warp/` 下生成 MJX-Warp 垫片适配层(shim layer)。 -## Setup +## 环境配置 -From the root `mjx/` directory, once you install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), install the latest MuJoCo and local MJX: +在根目录 `mjx/` 下,安装 [`uv`](https://docs.astral.sh/uv/getting-started/installation/) 之后,安装最新的 MuJoCo 和本地 MJX: ```bash uv venv .venv --default-index https://pypi.org/simple @@ -14,9 +13,9 @@ uv pip install --upgrade --force-reinstall mujoco --default-index https://pypi.o uv pip install -e ".[warp,dev]" --default-index https://pypi.org/simple ``` -## Run codegen +## 运行代码生成 -From the root `mjx/` directory: +在根目录 `mjx/` 下执行: ```bash bash mujoco/mjx/codegen/update_for_mujoco_warp.sh diff --git a/mjx/mujoco/mjx/test_data/barkour_v0/README.md b/mjx/mujoco/mjx/test_data/barkour_v0/README.md index 4f5d970d..fb10ccf9 100644 --- a/mjx/mujoco/mjx/test_data/barkour_v0/README.md +++ b/mjx/mujoco/mjx/test_data/barkour_v0/README.md @@ -1,19 +1,19 @@ # Google Barkour v0 -## MJCF Instructions +## MJCF 说明 -The MuJoCo config in `assets/barkour_v0_mjx.xml` was copied from https://github.com/deepmind/mujoco_menagerie/google_barkour_v0. The following edits were made to the MJCF specifically for brax: +`assets/barkour_v0_mjx.xml` 中的 MuJoCo 配置复制自 https://github.com/deepmind/mujoco_menagerie/google_barkour_v0 。为了适配 Brax,对该 MJCF 进行了以下专门修改: -* `meshdir` was changed from `assets` to `.`. -* `frictionloss` was removed. `damping` was changed to 0.5239. -* A custom `init_qpos` was added. -* A sphere geom `lowerLegFoot` was added to all feet. All other contacts were turned off. -* The compiler option was changed to `