[](https://opensource.org/licenses/Apache-2.0)

[](https://codecov.io/gh/newton-physics/newton)
[](https://github.com/newton-physics/newton/actions/workflows/push_aws_gpu.yml)
# Newton
Newton 是一个基于 [NVIDIA Warp](https://github.com/NVIDIA/warp) 构建的 GPU 加速物理模拟引擎,专为机器人学家和模拟研究人员设计。
Newton 扩展并泛化了 Warp 的([已弃用](https://github.com/NVIDIA/warp/discussions/735))`warp.sim` 模块,并集成了
[MuJoCo Warp](https://github.com/google-deepmind/mujoco_warp) 作为其主要后端。Newton 强调 GPU 计算、[OpenUSD](https://openusd.org/) 支持、可微性和用户定义的可扩展性,从而促进快速迭代和可扩展的机器人模拟。
Newton 是一个 [Linux Foundation](https://www.linuxfoundation.org/) 项目,由社区构建和维护。代码根据 [Apache-2.0](https://github.com/newton-physics/newton/blob/main/LICENSE.md) 授权。文档根据 [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) 授权。额外的第三方许可证文本可在 [`newton/licenses`](https://github.com/newton-physics/newton/tree/main/newton/licenses) 中找到。
Newton 由 [Disney Research](https://www.disneyresearch.com/)、[Google DeepMind](https://deepmind.google/) 和 [NVIDIA](https://www.nvidia.com/) 发起。
## 系统要求
- **Python** 3.10+
- **操作系统:** Linux (x86-64, aarch64), Windows (x86-64), 或 macOS (仅限 CPU)
- **GPU:** NVIDIA GPU (Maxwell 或更新版本),驱动版本 545 或更新 (CUDA 12)。无需安装本地 CUDA Toolkit。macOS 在 CPU 上运行。
有关详细的系统要求和经过测试的配置,请参阅 [安装指南](https://newton-physics.github.io/newton/latest/guide/installation.html)。
## 快速开始
```
pip install "newton[examples]"
python -m newton.examples basic_pendulum
```
要使用 [uv](https://docs.astral.sh/uv/) 从源代码安装,请参阅 [安装指南](https://newton-physics.github.io/newton/latest/guide/installation.html)。
## 示例
在运行以下示例之前,请安装包含示例额外组件的 Newton:
```
pip install "newton[examples]"
```
如果您是使用 uv 从源代码安装的,请在以下命令中将 `python` 替换为 `uv run`。
Basic Examples |
|
|
|
python -m newton.examples basic_pendulum
|
python -m newton.examples basic_urdf
|
python -m newton.examples basic_viewer
|
|
|
|
python -m newton.examples basic_shapes
|
python -m newton.examples basic_joints
|
python -m newton.examples basic_conveyor
|
|
|
|
python -m newton.examples basic_heightfield
|
python -m newton.examples recording
|
python -m newton.examples replay_viewer
|
|
|
|
python -m newton.examples basic_plotting
|
|
|
Robot Examples |
|
|
|
python -m newton.examples robot_cartpole
|
python -m newton.examples robot_g1
|
python -m newton.examples robot_h1
|
|
|
|
python -m newton.examples robot_anymal_d
|
python -m newton.examples robot_anymal_c_walk
|
|
|
|
python -m newton.examples robot_policy
|
python -m newton.examples robot_ur10
|
python -m newton.examples robot_panda_hydro
|
|
|
|
python -m newton.examples robot_allegro_hand
|
|
|
Cable Examples |
|
|
|
python -m newton.examples cable_twist
|
python -m newton.examples cable_y_junction
|
python -m newton.examples cable_bundle_hysteresis
|
|
|
|
python -m newton.examples cable_pile
|
|
|
Cloth Examples |
|
|
|
python -m newton.examples cloth_bending
|
python -m newton.examples cloth_hanging
|
python -m newton.examples cloth_style3d
|
|
|
|
python -m newton.examples cloth_h1
|
python -m newton.examples cloth_twist
|
python -m newton.examples cloth_franka
|
|
|
|
python -m newton.examples cloth_rollers
|
python -m newton.examples cloth_poker_cards
|
|
Inverse Kinematics Examples |
|
|
|
python -m newton.examples ik_franka
|
python -m newton.examples ik_h1
|
python -m newton.examples ik_custom
|
|
|
|
python -m newton.examples ik_cube_stacking
|
|
|
MPM Examples |
|
|
|
python -m newton.examples mpm_granular
|
python -m newton.examples mpm_anymal
|
python -m newton.examples mpm_twoway_coupling
|
|
|
|
python -m newton.examples mpm_grain_rendering
|
python -m newton.examples mpm_multi_material
|
|
Sensor Examples |
|
|
|
python -m newton.examples sensor_contact
|
python -m newton.examples sensor_tiled_camera
|
python -m newton.examples sensor_imu
|
Selection Examples |
|
|
|
python -m newton.examples selection_cartpole
|
python -m newton.examples selection_materials
|
python -m newton.examples selection_articulations
|
|
|
|
python -m newton.examples selection_multiple
|
|
|
DiffSim Examples |
|
|
|
python -m newton.examples diffsim_ball
|
python -m newton.examples diffsim_cloth
|
python -m newton.examples diffsim_drone
|
|
|
|
python -m newton.examples diffsim_spring_cage
|
python -m newton.examples diffsim_soft_body
|
python -m newton.examples diffsim_bear
|
Multi-Physics Examples |
|
|
|
python -m newton.examples softbody_gift
|
python -m newton.examples softbody_dropping_to_cloth
|
|
Contacts Examples |
|
|
|
python -m newton.examples nut_bolt_hydro
|
python -m newton.examples nut_bolt_sdf
|
python -m newton.examples brick_stacking
|
|
|
|
python -m newton.examples pyramid
|
|
|
Softbody Examples |
|
|
|
python -m newton.examples softbody_hanging
|
python -m newton.examples softbody_franka
|
|
### 示例选项
这些示例支持以下命令行参数:
| 参数 | 描述 | 默认值 |
| --------------- | --------------------------------------------------------------------------------------------------- | ---------------------------- |
| `--viewer` | 查看器类型:`gl` (OpenGL 窗口), `usd` (USD 文件输出), `rerun` (ReRun), 或 `null` (无查看器)。 | `gl` |
| `--device` | 要使用的计算设备,例如 `cpu`, `cuda:0` 等。 | `None` (默认 Warp 设备) |
| `--num-frames` | 要模拟的帧数(用于 USD 输出)。 | `100` |
| `--output-path` | USD 文件的输出路径(如果使用 `--viewer usd` 则为必需)。 | `None` |
某些示例可能会添加额外的参数(有关详细信息,请参阅其各自的源文件)。
### 示例用法
```
# 列出可用示例
python -m newton.examples
# 使用 USD viewer 运行并保存到 my_output.usd
python -m newton.examples basic_viewer --viewer usd --output-path my_output.usd
# 在选定设备上运行
python -m newton.examples basic_urdf --device cuda:0
# 组合选项
python -m newton.examples basic_viewer --viewer gl --num-frames 500 --device cpu
```
## 贡献与开发
请参阅 [贡献指南](https://github.com/newton-physics/newton-governance/blob/main/CONTRIBUTING.md) 和 [开发指南](https://newton-physics.github.io/newton/latest/guide/development.html) 以获取有关如何为 Newton 做贡献的说明。
## 支持与社区讨论
如有问题,请先查阅 [Newton 文档](https://newton-physics.github.io/newton/latest/guide/overview.html),然后再在 [主仓库发起讨论](https://github.com/newton-physics/newton/discussions)。
## 行为准则
参与此社区即表示您同意遵守 Linux Foundation [行为准则](https://lfprojects.org/policies/code-of-conduct/)。
## 项目治理、法律与成员
请参阅 [newton-governance 仓库](https://github.com/newton-physics/newton-governance) 以获取有关项目治理的更多信息。