Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
8d20b8d
Docs: rewrite install guide and make lerobot a required dependency (#…
yuecideng Apr 12, 2026
d2a8dad
Update cobotmagic arm asset. (#228)
matafela Apr 13, 2026
987d04f
Fix opw solver (#229)
matafela Apr 15, 2026
80368bd
Fix crashing when no grasp pose found. (#232)
matafela Apr 15, 2026
59021a4
add rl benchmark (#231)
matafela Apr 15, 2026
d860435
Enhance workspace analyzer computational efficiency (#230)
yuecideng Apr 15, 2026
d52ea77
Update CobotMagic default safe margin (#235)
matafela Apr 16, 2026
d5bf930
Fix demo action shape normalization and control-part mapping (#237)
yuecideng Apr 16, 2026
3bb2592
Refine URDF assembly component prefixes and name casing policy (#236)
chase6305 Apr 19, 2026
50843a5
Refactor: benchmark (#233)
matafela Apr 20, 2026
e0e16ae
Update pytorch kinematic solver benchmark param (#240)
matafela Apr 20, 2026
0497711
fix plan_trajectory (#242)
yhnsu Apr 22, 2026
ccce98a
docs: add NVIDIA driver guide and mesh loading tutorial (#245)
XuanchaoPENG Apr 23, 2026
386dc66
Add multi-version documentation build support (#234)
yuecideng Apr 24, 2026
9fb2204
Fix README docs link (#246)
yuecideng Apr 24, 2026
06258f1
docs: add AI coding agent skills and cross-reference throughout docum…
yuecideng Apr 28, 2026
72e9731
fix: correct the link of website (#249)
yangchen73 Apr 29, 2026
c824c86
docs: upgrade README badges and add auto-sync to introduction.rst (#250)
yuecideng Apr 29, 2026
8e92c08
upgrade pytorch kinematics (#244)
matafela Apr 30, 2026
72b5bb9
chore: upgrade black to 26.3.1 and fix code style (#251)
yuecideng Apr 30, 2026
fc54598
Improve API reference detail and coverage (#252)
yuecideng May 1, 2026
168f11c
feat: Add atomic action abstraction layer for embodied AI motion gene…
yuecideng May 1, 2026
c5e6f00
Fix pytorch solver qpos mapping (#253)
matafela May 7, 2026
23a1208
docs: Remove AI coding agent skills references (#254)
yuecideng May 7, 2026
076fc65
docs: add data generation tutorial for synthesized data pipeline (#238)
yvvonie May 8, 2026
f81b8a6
Update skills structure and roadmap docs (#257)
yuecideng May 8, 2026
9e34ec1
Adapt dexsim v0.4.0 (#226)
yuecideng May 9, 2026
72ffe43
docs: add uv installation support and update dependencies (#258)
yuecideng May 9, 2026
c6ce00f
Fix PyPI release workflow (#259)
yuecideng May 9, 2026
e11eb4e
docs: improve navigation, cross-references, and guides (#262)
yuecideng May 12, 2026
a251699
Fix multiversion docs overwrite on main branch push (#263)
yuecideng May 12, 2026
6e5f745
docs: add academic publications page (#265)
yuecideng May 12, 2026
c322584
Fix multiversion docs overwrite on main push (#266)
yuecideng May 12, 2026
5cdd9c2
ci: fix docs deployment to use GitHub Actions Pages source
yuecideng May 12, 2026
2a8b56c
ci: fix multiversion docs deployment (#267)
yuecideng May 12, 2026
5bc76ce
fix opw tcp (#261)
matafela May 13, 2026
c3f5b4d
Annotate full mesh (#260)
matafela May 19, 2026
83ef059
Adapt DexSim v0.4.1 (#272)
yuecideng May 19, 2026
498dce9
Add emissive light mode to randomize_indirect_lighting (#274)
yuecideng May 20, 2026
d46bedb
fix atomic action (#273)
XuanchaoPENG May 21, 2026
7823731
Add Newton physics backend support
yuecideng May 21, 2026
77963fa
sim-ready pipeline (#271)
XuanchaoPENG May 21, 2026
178c730
wip
yuecideng May 22, 2026
1773778
Fix multi-version GitHub Pages docs deployment (#277)
yuecideng May 22, 2026
010d3cd
update design docs
yuecideng May 23, 2026
2314a05
update cfg
yuecideng May 24, 2026
6878a9b
Merge remote-tracking branch 'origin/main' into feature/newton-physic…
yuecideng May 24, 2026
6c1e26e
wip
yuecideng May 25, 2026
65a8475
wip
yuecideng May 25, 2026
1d8d416
wip
yuecideng May 25, 2026
85a8ee4
wip
yuecideng May 25, 2026
1250aa0
style
yuecideng May 25, 2026
fef305e
standardize lerobot key (#280)
yhnsu May 26, 2026
41edaa4
wip
yuecideng May 26, 2026
bc1a8b3
Fix rigid object init ordering and reset after GPU physics setup (#283)
yuecideng May 26, 2026
a811b1d
Merge remote-tracking branch 'origin/main' into feature/newton-physic…
yuecideng May 26, 2026
87eedfe
wip
yuecideng May 26, 2026
389cfa9
Add YAML support for gym and RL training configs (#284)
yuecideng May 26, 2026
c5192b3
wip
yuecideng May 26, 2026
590211c
Add per-link articulation physics configuration (#278)
yuecideng May 26, 2026
aafc199
wip
yuecideng May 26, 2026
23feec1
wip
yuecideng May 26, 2026
1747cc4
wip
yuecideng May 28, 2026
3e4d4ee
Fix base solver fk (#285)
matafela May 28, 2026
cf5184e
wip
yuecideng May 28, 2026
7f09bb2
wip
yuecideng May 29, 2026
f87d885
wip
yuecideng May 29, 2026
0486c39
feat(newton): enable runtime mutation of physical properties via Newt…
yuecideng May 30, 2026
b3236fc
feat(sim): optimize Newton backend + expand rigid-object test coverage
yuecideng May 31, 2026
8c224a9
wip
yuecideng Jun 1, 2026
826d047
wip
yuecideng Jun 2, 2026
98c12d5
feat: add agent context routing system for EmbodiChain (#288)
yuecideng Jun 3, 2026
dd0f021
wip
yuecideng Jun 3, 2026
d93e61a
Add neural network IK solver (#286)
yangchen73 Jun 3, 2026
4b6852d
wip
yuecideng Jun 3, 2026
6034f7b
wip
yuecideng Jun 3, 2026
70dfc53
Add joint armature support for articulations (#290)
yuecideng Jun 4, 2026
1b86641
Align window controls with DexSim defaults (#291)
yuecideng Jun 4, 2026
9fcc807
Merge branch 'main' into feature/newton-physics-backend
yuecideng Jun 4, 2026
044877e
Improve installation guide and deduplicate gensim install docs (#293)
yuecideng Jun 4, 2026
1819048
Fix recording for PourWater (#292)
yangchen73 Jun 5, 2026
cb3240b
Auto-select default renderer based on GPU (#294)
yuecideng Jun 9, 2026
52e8a22
Merge remote-tracking branch 'origin/main' into feature/newton-physic…
yuecideng Jun 10, 2026
74bf17a
wip
yuecideng Jun 11, 2026
d5007f0
Merge remote-tracking branch 'origin/main' into feature/newton-physic…
yuecideng Jun 15, 2026
b338f4d
init articulation
yuecideng Jun 15, 2026
f8227f6
Merge remote-tracking branch 'origin/main' into feature/newton-physic…
yuecideng Jun 16, 2026
ceec28f
wip
yuecideng Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 288 additions & 0 deletions design/newton-backend-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
# EmbodiChain Newton Backend Integration Design

This document records the current EmbodiChain integration state for the DexSim
Newton physics backend and the remaining work needed to complete it.

Use these EmbodiChain backend names consistently:

- `default`: the existing DexSim default physics backend.
- `newton`: the DexSim Newton physics backend.

Avoid exposing lower-level DexSim implementation names in EmbodiChain-facing
configuration, docs, and conditionals.

## Current State

### Configuration

Backend selection is currently inferred from `SimulationManagerCfg.physics_cfg`:

- `DefaultPhysicsCfg` selects the `default` backend.
- `NewtonPhysicsCfg` selects the `newton` backend.
- `physics_cfg_for_backend("default" | "newton")` returns the matching config.
- `physics_backend_from_cfg(...)` maps a config instance to its backend name.

`DefaultPhysicsCfg` owns default-backend PhysX settings and GPU-memory settings.
`NewtonPhysicsCfg` owns Newton settings: `physics_dt`, `device`, `num_substeps`,
`requires_grad`, `use_cuda_graph`, `debug_mode`, `solver_type`, `broad_phase`,
and `visualizer_enabled`.

`NewtonPhysicsCfg.to_dexsim_cfg(...)` creates a DexSim `NewtonCfg`, uses
`physics_dt` for `NewtonCfg.dt`, disables CUDA graph when gradient mode is
enabled, and requires `solver_type="semi_implicit"` for gradient mode.

### SimulationManager

`SimulationManager` now tracks the active backend with:

- `physics_backend`
- `is_default_backend`
- `is_newton_backend`
- `newton_manager`

For the `default` backend, manager initialization keeps the existing DexSim
behavior:

- apply `DefaultPhysicsCfg.to_dexsim_args()`
- apply default-backend GPU-memory config
- enable default GPU simulation only when the selected device is CUDA

For the `newton` backend, manager initialization:

- imports DexSim Newton lazily during world-config conversion
- sets `world_config.newton_cfg`
- obtains the per-world Newton manager through `get_newton_manager(self._world)`
- avoids default-backend GPU flags and default GPU memory APIs

Newton finalization is separate from default-backend GPU initialization:

- `finalize_newton_physics()` prepares or rebuilds the Newton model until the
manager reaches `READY`.
- `update(...)` finalizes Newton before stepping.
- `init_gpu_physics()` delegates to `finalize_newton_physics()` when Newton is
active.
- `set_manual_update(False)` is ignored for Newton because the backend does not
support switching to automatic update.

Scene mutation invalidates Newton finalization with `_invalidate_newton_physics()`.
After finalization, `_reset_newton_entities_after_finalize()` reapplies rigid
object reset state. Rigid object groups are not yet supported on Newton.

### Object Backend Adapters

Rigid-body data access is routed through:

```text
embodichain/lab/sim/objects/backends/
base.py
default.py
newton.py
```

`RigidBodyViewBase` defines the backend-neutral rigid-body API. The default
adapter handles existing CPU/default-GPU paths. The Newton adapter uses DexSim
Newton batch APIs for body data and collision filters.

EmbodiChain public rigid-body tensor convention is:

```text
(x, y, z, qx, qy, qz, qw)
```

Current Newton rigid-object support includes:

- dynamic and kinematic single `RigidObject` creation
- static single `RigidObject` creation
- local pose get/set
- body state get
- linear/angular velocity get/set
- linear/angular acceleration get
- force and torque at center of mass
- clear dynamics
- reset
- center-of-mass local pose get/set for dynamic rigid objects
- mass get/set
- friction get/set
- inertia diagonal get/set
- collision filter set for dynamic, kinematic, static, and pre-finalize bodies
- visual material, visibility, geometry, scale, and user-id APIs through the
existing MeshObject paths

Static Newton bodies do not have `RigidBodyData`; static collision-filter writes
therefore use DexSim's per-entity metadata hook when a Newton body ID is not
available yet.

### Currently Unsupported Newton APIs

`SimulationManager` explicitly rejects these asset types on Newton:

- `add_soft_object(...)`
- `add_cloth_object(...)`
- `add_rigid_object_group(...)`
- `add_articulation(...)`
- `add_robot(...)`

`RigidObject` still does not support these runtime updates on Newton:

- `set_attrs(...)`
- `set_body_type(...)`
- `set_damping(...)`

`RigidObject.add_force_torque(pos=...)` ignores `pos` and applies force/torque at
the center of mass.

Newton kinematic pose locking is not complete. The rigid-object test suite keeps
a Newton-specific allowance for kinematic bodies changing after stepping.

Newton SDF rigid mesh support is not validated in EmbodiChain. The SDF rigid
object test is skipped for Newton.

### Verified Tests

The current rigid-object test file passes after the latest Newton integration
fixes:

```bash
pytest -q tests/sim/objects/test_rigid_object.py
```

Observed result:

```text
62 passed, 1 skipped, 41 warnings
```

## Improvements To Make

### API Clarity

- Add explicit capability checks for backend-specific support instead of relying
on scattered `is_newton_scene(...)` checks.
- Make unsupported Newton APIs fail consistently with either `NotImplementedError`
or a documented warning/no-op policy.
- Separate `is_use_gpu_physics` into clearer concepts:
- selected tensor/device location
- default-backend GPU API availability
- Newton GPU execution

### Newton Lifecycle

- Keep `finalize_newton_physics()` as the single Newton preparation API.
- Do not add a separate non-stepping synchronization method until DexSim exposes
a real Newton synchronization API.
- Track dirty scene/model state more explicitly so mutations after finalization
can choose between live batch updates and model rebuilds.
- Avoid global Newton teardown while another world may still use monkey-patched
DexSim classes.

### RigidObject

- Implement Newton `set_attrs(...)` by decomposing supported fields into batch
property updates and rejecting unsupported fields explicitly.
- Implement Newton damping get/set through DexSim Newton if a runtime API exists;
otherwise keep it metadata-only before finalization and document that runtime
damping changes require rebuild.
- Implement `set_body_type(...)` for Newton or keep a hard unsupported error if
DexSim cannot safely switch dynamic/kinematic/static bodies at runtime.
- Implement force-at-position when DexSim Newton exposes the needed API.
- Validate SDF rigid mesh creation and collision behavior on Newton.
- Fix or document kinematic pose-lock semantics.

### Object Groups, Articulations, Robots, Soft, Cloth

- Add Newton rigid-object-group support after single-object support is stable.
- Keep articulations and robots fail-fast until DexSim Newton articulation APIs
are ready and tested.
- Keep soft and cloth fail-fast until there is an explicit Newton design and
test coverage for those object types.

### Gym Env Integration

Use backend-specific initialization in env setup:

```python
if self.sim.is_default_backend and self.sim.is_use_gpu_physics:
self.sim.init_gpu_physics()
elif self.sim.is_newton_backend:
self.sim.finalize_newton_physics()
```

For stepping, keep the existing high-level flow:

```python
self._preprocess_action(action)
self._step_action(action)
self.sim.update(self.sim_cfg.physics_dt, self.cfg.sim_steps_per_control)
```

For reset, call object/manager reset methods and finalize Newton before reading
observations when the backend is Newton. Do not rely on a separate sync API.

## Completion Plan

1. Stabilize the single-rigid-object Newton API and keep
`tests/sim/objects/test_rigid_object.py` green.
2. Add backend capability declarations and use them in public object APIs.
3. Finish Newton `RigidObject` parity for attributes, damping, body type,
force-at-position, SDF meshes, and kinematic pose semantics.
4. Add tests for Newton lifecycle rebuild after scene mutation and runtime
property mutation after finalization.
5. Implement and test Newton `RigidObjectGroup`.
6. Update gym env initialization/reset paths to use `finalize_newton_physics()`
directly.
7. Add rigid-only Newton gym smoke tests.
8. Add gradient rollout wrapper and a minimal differentiable Newton smoke test.
9. Add articulation and robot support only after DexSim Newton exposes stable
articulation APIs.
10. Add soft/cloth support only after a dedicated Newton object design and tests.

## Tests To Maintain

Configuration:

- `SimulationManagerCfg(physics_cfg=DefaultPhysicsCfg())` preserves current
default-backend behavior.
- `SimulationManagerCfg(physics_cfg=NewtonPhysicsCfg())` creates a Newton world.
- `physics_cfg_for_backend(...)` and `physics_backend_from_cfg(...)` return the
expected backend mapping.

Simulation:

- Newton world can be created, finalized, stepped, destroyed, and recreated.
- Default-backend GPU initialization does not run for Newton.
- Newton finalization does not call default-backend GPU fetch/apply APIs.
- Destroying a Newton simulation does not break subsequent default-backend
simulation creation.

Rigid object:

- Dynamic rigid bodies fall under Newton.
- Static and kinematic rigid bodies can be created under Newton.
- Pose, velocity, acceleration, force/torque, reset, COM pose, mass, friction,
inertia, collision filters, and geometry APIs behave consistently with the
documented support matrix.
- Unsupported APIs produce the documented warning or exception.

Gym:

- Rigid-only Newton env initializes, steps, resets, and reads observations.
- Robot/articulation env under Newton raises the expected unsupported error.

Gradient:

- `requires_grad=True` plus `solver_type="semi_implicit"` can create a gradient
rollout.
- A simple loss can backpropagate through a rollout without CPU/NumPy observation
paths.

## Known Risks

- DexSim Newton monkey-patches global classes. Global teardown can affect other
worlds if used at the wrong time.
- Public body/articulation ID mapping APIs may still need DexSim improvements.
- Newton gravity and contact configuration may not yet match every default-backend
setting.
- Some object constructors still contain default-backend assumptions such as
warmup updates; keep Newton guarded from those paths.
- Runtime shape/property mutations may require model rebuilds rather than live
updates.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
.. autosummary::

ArticulationCfg
DefaultPhysicsCfg
GPUMemoryCfg
JointDrivePropertiesCfg
LightCfg
NewtonPhysicsCfg
ObjectBaseCfg
PhysicsCfg
RigidBodyAttributesCfg
Expand Down
2 changes: 1 addition & 1 deletion docs/source/features/interaction/preview_asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ asset.set_root_pose(pos=[0, 0, 1.0], rot=[0, 0, 0])
| `--body_type` | Body type for rigid objects: `dynamic`, `kinematic`, `static` | `kinematic` |
| `--use_usd_properties` | Use physical properties from the USD file instead of defaults | `False` |
| `--fix_base` | Fix the base of articulations | `True` |
| `--sim_device` | Simulation device | `cpu` |
| `--device` | Simulation device | `cpu` |
| `--headless` | Run without rendering window | `False` |
| `--renderer` | Renderer backend: `hybrid`, `fast-rt` or `rt` | `hybrid` |
| `--preview` | Enter interactive embed mode after loading | `False` |
Expand Down
4 changes: 2 additions & 2 deletions docs/source/features/workspace_analyzer/workspace_analyzer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from embodichain.lab.sim.utility.workspace_analyzer import (
)

# Setup simulation
sim = SimulationManager(SimulationManagerCfg(headless=False, sim_device="cpu"))
sim = SimulationManager(SimulationManagerCfg(headless=False, device="cpu"))

# Add robot
robot = sim.add_robot(DexforceW1Cfg.from_dict({
Expand Down Expand Up @@ -167,7 +167,7 @@ from embodichain.lab.sim.utility.workspace_analyzer import (
from embodichain.lab.sim.utility.workspace_analyzer.configs import VisualizationConfig

# Setup simulation
sim = SimulationManager(SimulationManagerCfg(headless=False, sim_device="cpu"))
sim = SimulationManager(SimulationManagerCfg(headless=False, device="cpu"))

# Add robot
robot = sim.add_robot(DexforceW1Cfg.from_dict({
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/sim/planners/motion_generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sim_cfg = SimulationManagerCfg(
width=1920,
height=1080,
physics_dt=1.0 / 100.0,
sim_device="cpu",
device="cpu",
)

sim = SimulationManager(sim_cfg)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/sim/sim_articulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ from embodichain.lab.sim.objects import Articulation, ArticulationCfg

# 1. Initialize Simulation
device = "cuda" if torch.cuda.is_available() else "cpu"
sim_cfg = SimulationManagerCfg(sim_device=device)
sim_cfg = SimulationManagerCfg(device=device)
sim = SimulationManager(sim_config=sim_cfg)

# 2. Configure Articulation
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/sim/sim_cloth.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create_2d_grid_mesh(width: float, height: float, nx: int = 1, ny: int = 1):

# 1. Initialize Simulation
device = "cuda" if torch.cuda.is_available() else "cpu"
sim_cfg = SimulationManagerCfg(sim_device=device)
sim_cfg = SimulationManagerCfg(device=device)
sim = SimulationManager(sim_config=sim_cfg)

cloth_verts, cloth_faces = create_2d_grid_mesh(width=0.3, height=0.3, nx=12, ny=12)
Expand Down
Loading
Loading