nablaengine 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. nablaengine/__init__.py +4 -0
  2. nablaengine/_fixtures/README.md +19 -0
  3. nablaengine/_fixtures/data/mf_s0.npz +0 -0
  4. nablaengine/_fixtures/mjlab/LICENSE +27 -0
  5. nablaengine/_fixtures/mjlab/README.md +113 -0
  6. nablaengine/_fixtures/mjlab/g1_meta.json +32 -0
  7. nablaengine/_fixtures/mjlab/g1_train.mjb +0 -0
  8. nablaengine/_optional.py +30 -0
  9. nablaengine/_paths.py +38 -0
  10. nablaengine/actuators/__init__.py +169 -0
  11. nablaengine/actuators/bam.py +306 -0
  12. nablaengine/actuators/bam_params/LICENSE +202 -0
  13. nablaengine/actuators/bam_params/xl330/m6.json +19 -0
  14. nablaengine/boxbox.py +259 -0
  15. nablaengine/ccd.py +1122 -0
  16. nablaengine/checks.py +376 -0
  17. nablaengine/cuda.py +483 -0
  18. nablaengine/dist_query.py +628 -0
  19. nablaengine/dual.py +223 -0
  20. nablaengine/dyn_query.py +685 -0
  21. nablaengine/engines.py +114 -0
  22. nablaengine/envs/__init__.py +24 -0
  23. nablaengine/envs/brax.py +165 -0
  24. nablaengine/envs/convert.py +771 -0
  25. nablaengine/envs/dmc.py +523 -0
  26. nablaengine/envs/env.py +233 -0
  27. nablaengine/envs/kin.py +371 -0
  28. nablaengine/envs/ops.py +134 -0
  29. nablaengine/envs/rewards.py +57 -0
  30. nablaengine/fixtures.py +243 -0
  31. nablaengine/forest_engine/__init__.py +0 -0
  32. nablaengine/forest_engine/adjoint.py +1726 -0
  33. nablaengine/forest_engine/adjoint_contact.py +493 -0
  34. nablaengine/forest_engine/bam_hooks.py +248 -0
  35. nablaengine/forest_engine/body_params.py +1007 -0
  36. nablaengine/forest_engine/capacity_diag.py +116 -0
  37. nablaengine/forest_engine/ccd_coop.py +250 -0
  38. nablaengine/forest_engine/chol_blk.py +80 -0
  39. nablaengine/forest_engine/contact_forces.py +142 -0
  40. nablaengine/forest_engine/contact_vjp.py +462 -0
  41. nablaengine/forest_engine/convex.py +1331 -0
  42. nablaengine/forest_engine/cylinder.py +73 -0
  43. nablaengine/forest_engine/dist_device.py +923 -0
  44. nablaengine/forest_engine/dyn_device.py +696 -0
  45. nablaengine/forest_engine/ellipsoid.py +179 -0
  46. nablaengine/forest_engine/elliptic.py +272 -0
  47. nablaengine/forest_engine/equality.py +842 -0
  48. nablaengine/forest_engine/floss.py +148 -0
  49. nablaengine/forest_engine/foot_offset.py +368 -0
  50. nablaengine/forest_engine/free_gyro.py +288 -0
  51. nablaengine/forest_engine/host.py +530 -0
  52. nablaengine/forest_engine/kdof64.py +127 -0
  53. nablaengine/forest_engine/kinematics.py +320 -0
  54. nablaengine/forest_engine/margin.py +167 -0
  55. nablaengine/forest_engine/margin_convex.py +326 -0
  56. nablaengine/forest_engine/midphase.py +439 -0
  57. nablaengine/forest_engine/model_hooks.py +913 -0
  58. nablaengine/forest_engine/motor_hooks.py +50 -0
  59. nablaengine/forest_engine/muscle.py +485 -0
  60. nablaengine/forest_engine/nb128.py +118 -0
  61. nablaengine/forest_engine/nb64.py +163 -0
  62. nablaengine/forest_engine/noslip.py +1124 -0
  63. nablaengine/forest_engine/nv128.py +1944 -0
  64. nablaengine/forest_engine/object_size.py +283 -0
  65. nablaengine/forest_engine/replay_guard.py +40 -0
  66. nablaengine/forest_engine/root_spread.py +126 -0
  67. nablaengine/forest_engine/solref.py +74 -0
  68. nablaengine/forest_engine/source.py +1464 -0
  69. nablaengine/forest_engine/sparse_pattern.py +527 -0
  70. nablaengine/forest_engine/spatial.py +1045 -0
  71. nablaengine/forest_engine/step.py +3083 -0
  72. nablaengine/forest_engine/surrogate.py +498 -0
  73. nablaengine/forest_engine/tape.py +199 -0
  74. nablaengine/forest_engine/tendon.py +845 -0
  75. nablaengine/forest_engine/terrain.py +1059 -0
  76. nablaengine/forest_engine/world_forces.py +166 -0
  77. nablaengine/forest_engine/world_params.py +230 -0
  78. nablaengine/g1_engine/__init__.py +0 -0
  79. nablaengine/g1_engine/adjoint.py +1661 -0
  80. nablaengine/g1_engine/adjoint_contact.py +577 -0
  81. nablaengine/g1_engine/bam_hooks.py +596 -0
  82. nablaengine/g1_engine/condim4.py +245 -0
  83. nablaengine/g1_engine/contact_forces.py +500 -0
  84. nablaengine/g1_engine/cylccd.py +1158 -0
  85. nablaengine/g1_engine/cylinder.py +216 -0
  86. nablaengine/g1_engine/elliptic.py +565 -0
  87. nablaengine/g1_engine/exact_replay.py +61 -0
  88. nablaengine/g1_engine/host.py +358 -0
  89. nablaengine/g1_engine/kinematics.py +320 -0
  90. nablaengine/g1_engine/mesh.py +305 -0
  91. nablaengine/g1_engine/mesh_tables.py +79 -0
  92. nablaengine/g1_engine/model_hooks.py +919 -0
  93. nablaengine/g1_engine/motor_hooks.py +70 -0
  94. nablaengine/g1_engine/replay_guard.py +55 -0
  95. nablaengine/g1_engine/source.py +1107 -0
  96. nablaengine/g1_engine/sphbox.py +93 -0
  97. nablaengine/g1_engine/step.py +3716 -0
  98. nablaengine/g1_engine/tape.py +173 -0
  99. nablaengine/g1_engine/world_params.py +447 -0
  100. nablaengine/identity.py +401 -0
  101. nablaengine/jax_ffi.py +2536 -0
  102. nablaengine/model/__init__.py +1 -0
  103. nablaengine/model/capability.py +694 -0
  104. nablaengine/model/fields.py +317 -0
  105. nablaengine/model/gravcomp.py +64 -0
  106. nablaengine/model/invweight.py +145 -0
  107. nablaengine/motor.py +143 -0
  108. nablaengine/object_geometry.py +609 -0
  109. nablaengine/params.py +258 -0
  110. nablaengine/provenance.py +196 -0
  111. nablaengine/reference/__init__.py +0 -0
  112. nablaengine/reference/adjoint_groups.py +226 -0
  113. nablaengine/reference/jax64.py +690 -0
  114. nablaengine/reference/warp_physics.py +262 -0
  115. nablaengine/sensors/__init__.py +4 -0
  116. nablaengine/sensors/cameras.py +285 -0
  117. nablaengine/sensors/data/LIVOX_MID360_LICENSE +21 -0
  118. nablaengine/sensors/data/livox_mid360.npz +0 -0
  119. nablaengine/sensors/g1.py +521 -0
  120. nablaengine/sensors/jax_rays.py +364 -0
  121. nablaengine/sensors/optix_rays.py +725 -0
  122. nablaengine/sensors/raycore.py +630 -0
  123. nablaengine/sensors/raygrad.py +374 -0
  124. nablaengine/sensors/raygrad_cuda.py +191 -0
  125. nablaengine/sensors/robot_mesh.py +273 -0
  126. nablaengine/sensors/torch_rays.py +275 -0
  127. nablaengine/terrain.py +424 -0
  128. nablaengine/torch_ffi.py +1328 -0
  129. nablaengine/workdir.py +37 -0
  130. nablaengine-1.0.2.dist-info/METADATA +236 -0
  131. nablaengine-1.0.2.dist-info/RECORD +136 -0
  132. nablaengine-1.0.2.dist-info/WHEEL +5 -0
  133. nablaengine-1.0.2.dist-info/licenses/LICENSE +202 -0
  134. nablaengine-1.0.2.dist-info/licenses/NOTICE +23 -0
  135. nablaengine-1.0.2.dist-info/licenses/THIRD_PARTY_NOTICES.md +176 -0
  136. nablaengine-1.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,176 @@
1
+ # Third-party notices
2
+
3
+ NablaEngine is licensed under the Apache License 2.0 (`LICENSE`). This file lists the third-party material that the
4
+ repository contains or is derived from, with its source, its licence and the changes made. Section 5 lists the
5
+ third-party software that the checks compare with but that the repository does not include.
6
+
7
+ | Material | Licence | Copyright | Used in |
8
+ |---|---|---|---|
9
+ | MuJoCo Warp | Apache-2.0 | 2025 The Newton Developers | `src/nablaengine/g1_engine/step.py` (translated code); `src/nablaengine/g1_engine/adjoint_contact.py`, `src/nablaengine/reference/jax64.py` (built on those translations); conventions in `src/nablaengine/g1_engine/adjoint.py` and `benchmarks/bench/adapters/mjw_pr.py`; the collision code ported in `src/nablaengine/ccd.py` and `src/nablaengine/g1_engine/cylinder.py`, `cylccd.py`, `mesh.py`, `sphbox.py`, `elliptic.py` (each file header states the source and the changes) |
10
+ | MuJoCo | Apache-2.0 | 2021 DeepMind Technologies Limited | through the MuJoCo Warp primitives in `step.py`; the model semantics the engine implements |
11
+ | MuJoCo MJX | Apache-2.0 | 2023 DeepMind Technologies Limited | `src/nablaengine/g1_engine/kinematics.py` (reproduced semantics, no code) |
12
+ | MuJoCo Menagerie, Unitree G1 | BSD-3-Clause | 2016-2023 HangZhou YuShu TECHNOLOGY CO.,LTD. ("Unitree Robotics") | `fixtures/mjlab/g1_train.mjb` |
13
+ | mjlab | Apache-2.0 | 2025, The mjlab Developers | `fixtures/mjlab/g1_train.mjb` (parameter values) |
14
+ | BAM (Better Actuator Models, <https://github.com/Rhoban/bam>) | Apache-2.0 | Marc Duclusaud, Grégoire Passault (Rhoban) | `src/nablaengine/actuators/bam_params/xl330/m6.json` (copied unchanged from `bam/params/xl330/m6.json` of Rhoban/bam@ea216102c0624f313d0ca6c0ec8f384008ff56c6), licence text in `src/nablaengine/actuators/bam_params/LICENSE`; `src/nablaengine/actuators/bam.py`, `src/nablaengine/g1_engine/bam_hooks.py`, `src/nablaengine/forest_engine/bam_hooks.py` (the M6 model reimplemented, no code copied) |
15
+ | Livox MID-360 scan pattern (Livox-SDK livox_laser_simulation) | MIT | 2021 livox | `src/nablaengine/sensors/data/livox_mid360.npz` (`scan_mode/mid360.csv`: its 800000 firing directions, converted to npz), licence in `src/nablaengine/sensors/data/LIVOX_MID360_LICENSE` |
16
+ | Pollen Robotics Microduck (microduck_rl), MJCF | Apache-2.0 | 2026 Pollen Robotics | `fixtures/robots/microduck/` (the robot's model, derived), `scripts/robots/microduck/fit_results.json` (the feet's sphere fit). Its 3D model files are CC BY-NC-SA 4.0 and are not included |
17
+
18
+ ## 1. MuJoCo Warp
19
+
20
+ - Source: <https://github.com/google-deepmind/mujoco_warp>.
21
+ - Licence: Apache License 2.0, the same text as `LICENSE`.
22
+ - Copyright 2025 The Newton Developers. The project's `AUTHORS` file lists Google LLC and NVIDIA Corporation.
23
+ - Version used: the head of the adjoint pull request google-deepmind/mujoco_warp#1535 ("hybrid analytic
24
+ differentiability"), etaoxing/mujoco_warp@357a75d60a56d67d476942a1b6e54b3045ee8e87 (MuJoCo Warp 3.12 with an
25
+ analytic adjoint).
26
+
27
+ Files:
28
+
29
+ - `src/nablaengine/g1_engine/step.py`, CUDA source `STEP_DEVICE`. It contains CUDA C++ translations of these
30
+ functions:
31
+ - from `mujoco_warp/_src/collision_primitive_core.py`: `plane_sphere`, `plane_capsule`, `plane_box`,
32
+ `sphere_sphere`, `sphere_capsule`, `capsule_capsule`, `sphere_box`, `capsule_box` (with `capsule_box_witness`)
33
+ and `box_box` (with `_compute_rotmore`);
34
+ - from `mujoco_warp/_src/math.py`: `orthogonals` and `make_frame`, and the quaternion-to-matrix convention of the
35
+ box primitives.
36
+
37
+ Changes made:
38
+ - rewritten as CUDA C++ device functions for one warp per simulated world, with the contact pairs spread over the
39
+ lanes of the warp;
40
+ - float32 arithmetic with explicit roundings, so that the analytic adjoint can replay the contacts bit for bit;
41
+ - zero contact margin only, and pairs whose bounding spheres do not overlap are skipped;
42
+ - intermediate values are recorded on the forward tape for the adjoint.
43
+
44
+ The box primitives are compiled only for models with box geoms; the G1 model in `fixtures/mjlab` has none. The
45
+ file header states the source, the copyright, the licence and the changes.
46
+ - `src/nablaengine/g1_engine/adjoint_contact.py`: new code, the vector-Jacobian products of the translated
47
+ primitives of the G1 model (plane-sphere, plane-capsule, sphere-sphere, sphere-capsule, capsule-capsule) and of
48
+ `make_frame`. So that its results can be compared with the pull request's adjoint, it follows that adjoint's
49
+ conventions (`collision_adjoint.py`, `adjoint_util.py`, `constraint_adjoint.py`): the signs of the residual terms
50
+ and the names of the cotangents. The file header states this.
51
+ - `src/nablaengine/reference/jax64.py`: float64 JAX ports of the five primitives above and of `make_frame`, written
52
+ after the translations in `step.py`, so they derive from the same MuJoCo Warp functions. They are the reference of
53
+ the unit checks of the adjoint.
54
+ - `src/nablaengine/g1_engine/adjoint.py`: an independent implementation of the step's adjoint; no code is copied.
55
+ So that the two can be compared, it uses the conventions of the pull request's adjoint: the quaternion-integration
56
+ VJP (`_adj_quat_integrate`), `actuator_lam`, `_dof_to_qpos` and `_contact_any_active`.
57
+ - `benchmarks/bench/adapters/mjw_pr.py`: the backward of this benchmark adapter follows the adjoint-graph pattern of
58
+ the pull request's `contrib/diffsim/_rollout.py` (`Rollout._backward_step` and `_capture`; Copyright 2026 The Newton
59
+ Developers, Apache License 2.0), applied to one control step.
60
+
61
+ ## 2. MuJoCo
62
+
63
+ - Source: <https://github.com/google-deepmind/mujoco>.
64
+ - Licence: Apache License 2.0.
65
+ - Copyright 2021 DeepMind Technologies Limited.
66
+
67
+ Parts of the MuJoCo Warp collision primitives of section 1 follow MuJoCo's C implementation, and the translations in
68
+ `step.py` carry those parts over. The rest of the engine is its own code. It implements MuJoCo's documented model
69
+ semantics:
70
+
71
+ - in `src/nablaengine/g1_engine/source.py`: the composite-rigid-body mass matrix and the recursive Newton-Euler
72
+ algorithm;
73
+ - in `src/nablaengine/g1_engine/step.py`: the constraint impedance from `solref` / `solimp`, pyramidal friction
74
+ cones, the primal Newton solver and the `implicitfast` integrator.
75
+
76
+ No other MuJoCo source code is included. The package and the checks use the MuJoCo Python bindings (`mujoco` 3.17.0)
77
+ at run time.
78
+
79
+ ## 3. MuJoCo MJX
80
+
81
+ - Source: `mujoco-mjx` 3.17.0, `mujoco/mjx/_src/smooth.py` (<https://github.com/google-deepmind/mujoco>).
82
+ - Licence: Apache License 2.0.
83
+ - Copyright 2023 DeepMind Technologies Limited.
84
+
85
+ `src/nablaengine/g1_engine/kinematics.py` is an independent CUDA implementation that reproduces the outputs of
86
+ `mjx.kinematics`, `com_pos` and `com_vel`. Its docstring cites MJX source line numbers and quotes one statement; no
87
+ MJX code is included. `scripts/kinematics_check.py` compares with MJX at run time.
88
+
89
+ ## 4. The G1 model: MuJoCo Menagerie (Unitree G1) and mjlab
90
+
91
+ `fixtures/mjlab/g1_train.mjb` is a compiled MuJoCo model in the binary format of MuJoCo 3.17.0. It is derived from two
92
+ sources; `fixtures/mjlab/README.md` lists every change.
93
+
94
+ - **MuJoCo Menagerie**, `unitree_g1/scene_mjx.xml` (which includes `unitree_g1/g1_mjx.xml`) at commit
95
+ f3b6013629c7b94f8ee93fd977b161fa8350f9bc:
96
+ <https://github.com/google-deepmind/mujoco_menagerie/tree/f3b6013629c7b94f8ee93fd977b161fa8350f9bc/unitree_g1>.
97
+ - Copyright (c) 2016-2023 HangZhou YuShu TECHNOLOGY CO.,LTD. ("Unitree Robotics").
98
+ - BSD 3-Clause License. `fixtures/mjlab/LICENSE` is a verbatim copy of Menagerie's `unitree_g1/LICENSE`; its text
99
+ is reproduced below.
100
+ - Changes made: the foot collision geoms and the contact pairs replaced, contact, joint and actuator parameters
101
+ changed, the timestep set to 5 ms, the meshes and textures removed.
102
+ - **mjlab**, <https://github.com/mujocolab/mjlab>.
103
+ - Apache License 2.0. Copyright 2025, The mjlab Developers.
104
+ - The model takes over values of mjlab's G1 configuration (`mjlab.asset_zoo.robots.unitree_g1`): the sole
105
+ capsules, the contact set, the contact and joint parameters, the PD gains and the setpoint range. No mjlab code
106
+ is included.
107
+
108
+ Unitree Robotics, Google DeepMind and the mjlab developers do not endorse this project.
109
+
110
+ The licence of the Unitree G1 description (`unitree_g1/LICENSE` of MuJoCo Menagerie):
111
+
112
+ ```
113
+ Copyright (c) 2016-2023 HangZhou YuShu TECHNOLOGY CO.,LTD. ("Unitree Robotics")
114
+ All rights reserved.
115
+
116
+ Redistribution and use in source and binary forms, with or without
117
+ modification, are permitted provided that the following conditions are met:
118
+
119
+ * Redistributions of source code must retain the above copyright notice, this
120
+ list of conditions and the following disclaimer.
121
+
122
+ * Redistributions in binary form must reproduce the above copyright notice,
123
+ this list of conditions and the following disclaimer in the documentation
124
+ and/or other materials provided with the distribution.
125
+
126
+ * Neither the name of the copyright holder nor the names of its
127
+ contributors may be used to endorse or promote products derived from
128
+ this software without specific prior written permission.
129
+
130
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
131
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
132
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
133
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
134
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
135
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
136
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
137
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
138
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
139
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
140
+ ```
141
+
142
+ ## 5. Used for comparison, not included
143
+
144
+ - **MuJoCo Warp 3.17.0** (PyPI `mujoco-warp`, Apache-2.0): the released reference for the forward step.
145
+ - **The adjoint pull request google-deepmind/mujoco_warp#1535**, the reference for the gradients, in two trees:
146
+ - etaoxing/mujoco_warp@357a75d60a56d67d476942a1b6e54b3045ee8e87, the head of the pull request, unmodified;
147
+ - etaoxing/mujoco_warp@4af093f02a3f48f0009ca7c916674b928136f310, the same tree with etaoxing/mujoco_warp#1: two
148
+ public fixes of the pull request's adjoint by Ruslan Rakhimov (commits c8c8890d0cf431c6e2b92f035cfb235d924e73c8 and
149
+ 4af093f02a3f48f0009ca7c916674b928136f310).
150
+
151
+ Both trees are fetched from GitHub at these commits; this repository includes none of their code.
152
+ - **NVIDIA Warp 1.18.0** (`warp-lang`, Apache-2.0): the runtime of MuJoCo Warp.
153
+ - **MuJoCo 3.17.0** (the C engine, through its Python bindings, in float64): the finite-difference reference.
154
+ - **jaxlib's XLA FFI headers** (Apache-2.0): the FFI library is compiled against the headers that the installed jaxlib
155
+ provides (`jax.ffi.include_dir()`). No header is copied into this repository.
156
+
157
+ ## 6. Cited algorithms
158
+
159
+ - `src/nablaengine/fixtures.py`: the closest distance between two segments, reimplemented in numpy after C. Ericson,
160
+ *Real-Time Collision Detection* (2005), section 5.1.9.
161
+
162
+ ## 7. Microduck (`fixtures/robots/microduck/`, `scripts/robots/microduck/`)
163
+
164
+ - **Pollen Robotics, microduck_rl**, <https://github.com/pollen-robotics/microduck_rl>, commit bae39f5
165
+ (`src/mjlab_microduck/robot/microduck/`).
166
+ - The MJCF robot descriptions and configurations: Apache License 2.0, Copyright 2026 Pollen Robotics
167
+ (`fixtures/robots/microduck/LICENSE` is a verbatim copy of the repository's `LICENSE`). The 3D model files
168
+ (`assets/*.stl`): CC BY-NC-SA 4.0 (the repository's `LICENSE-MODELS.md`). **No mesh file is included here.**
169
+ - `fixtures/robots/microduck/` holds an engine model derived from the walk model's MJCF: the Velocity task's
170
+ simulation options, explicit floor-foot contact pairs, the visual geoms and the collision geoms without a contact
171
+ pair dropped, the sole meshes replaced by four spheres per foot. It references no mesh.
172
+ - `scripts/robots/microduck/fit_results.json`: the centres and radii of those spheres (and of 6- and 8-sphere fits),
173
+ fitted to the sole meshes' convex hulls by `fit_feet.py`; no mesh data.
174
+
175
+ Pollen Robotics does not endorse this project.
176
+
@@ -0,0 +1 @@
1
+ nablaengine