Skip to content

draft: refactor spawn - #516

Open
MahooX wants to merge 4 commits into
feature/newton-physics-backendfrom
xiemh
Open

draft: refactor spawn#516
MahooX wants to merge 4 commits into
feature/newton-physics-backendfrom
xiemh

Conversation

@MahooX

@MahooX MahooX commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the legacy scene-construction paths with DexSim Spawn.
  • Keep the existing EmbodiChain add_* APIs and stable object facades through a declaration → prepare → bind lifecycle.
  • Unify Default/PhysX and Newton preparation through sim.prepare(), including rigid, articulation, robot, soft-body, cloth, and rigid-object-group integration.
  • Preserve native DexSim handling for lights and CameraGroup-based sensors, and update simulation tutorials for the new lifecycle.
  • Keep singleton USD asset loading compatible through Spawn descriptors.

Validation

  • Rebuilt and installed the matching DexSim package.
  • Validated focused simulation tutorials and multi-environment flows on both Default/PhysX and Newton backends.
  • Ran targeted syntax, formatting, and integration checks.

Type of change

  • Enhancement

Dependency

Requires the matching DexSim Spawn implementation.

@MahooX
MahooX requested a review from yuecideng August 18, 2026 04:03
@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Greptile Summary

The PR refactors simulation assets around a declaration, Spawn commit, runtime preparation, and facade-binding lifecycle.

  • Introduces Spawn-backed rigid-body and articulation adapters.
  • Moves environment robot and sensor setup around a centralized prepare boundary.
  • Updates physics backends, spawn descriptors, tutorials, and lifecycle tests.

Confidence Score: 2/5

The PR does not appear safe to merge because Spawn attribute operations and articulation overrides remain broken, and failed facade binding cannot be retried.

Spawn rigid-body attribute methods still raise for supported facade operations, articulation finalization still omits configured non-mass physics attributes, and prepare() records a committed result before binding succeeds so a retry can skip the failed callbacks.

Files Needing Attention: embodichain/lab/sim/objects/backends/spawn.py, embodichain/lab/sim/objects/articulation.py, embodichain/lab/sim/sim_manager.py

Important Files Changed

Filename Overview
embodichain/lab/sim/sim_manager.py Centralizes declaration materialization and facade binding in SimulationManager.prepare().
embodichain/lab/sim/objects/backends/spawn.py Adds tensor-layout adapters for Spawn rigid-body and articulation batches.
embodichain/lab/sim/objects/articulation.py Adds declared and Spawn-bound articulation lifecycle support with post-bind configuration.
embodichain/lab/gym/envs/base_env.py Splits scene declaration from post-prepare robot and sensor configuration.
embodichain/lab/sim/spawn/scene.py Coordinates Spawn declarations, commits, and facade bind callbacks.

Reviews (6): Last reviewed commit: "prepare envs" | Re-trigger Greptile

Comment on lines +280 to +288
def fetch_friction(
self, data: torch.Tensor, body_ids: torch.Tensor | None = None
) -> None:
del data, body_ids
self._unsupported_property("friction")

def apply_friction(self, data: torch.Tensor, body_ids: torch.Tensor) -> None:
del data, body_ids
self._unsupported_property("friction")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Ready view exposes unsupported attributes

When a caller invokes set_friction or get_friction on a Spawn-bound rigid object, the ready body view dispatches to methods that unconditionally raise NotImplementedError, causing existing rigid-object attribute operations to fail. The finalized Newton attribute path also invokes the unsupported friction, restitution, and contact-offset setters.

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/objects/backends/spawn.py
Line: 280-288

Comment:
**Ready view exposes unsupported attributes**

When a caller invokes `set_friction` or `get_friction` on a Spawn-bound rigid object, the ready body view dispatches to methods that unconditionally raise `NotImplementedError`, causing existing rigid-object attribute operations to fail. The finalized Newton attribute path also invokes the unsupported friction, restitution, and contact-offset setters.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex Fix in Claude Code

Comment thread embodichain/lab/sim/objects/articulation.py Outdated
Comment thread embodichain/lab/sim/sim_manager.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant