-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Stop the Newton cloner from approximating mesh colliders #6892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ff8324e
a9b22fd
ae5fa47
1b240d9
67638a5
1413c0d
41f86a8
44e7f30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Added | ||
| ^^^^^ | ||
|
|
||
| * Added :attr:`~isaaclab.sim.schemas.CollisionBaseCfg.mesh_collision_property` so a | ||
| spawner config can author the collision approximation of a file-spawned USD asset, | ||
| which otherwise exposes no approximation knob. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Changed | ||
| ^^^^^^^ | ||
|
|
||
| * **Breaking:** Removed ``NewtonCfg.simplify_meshes``. Newton replication no longer | ||
| approximates mesh colliders, so a USD-authored collision approximation survives | ||
| cloning. Author the approximation on the asset instead, via | ||
| :attr:`~isaaclab.sim.schemas.CollisionBaseCfg.mesh_collision_property` on the | ||
| spawner config. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,7 +74,6 @@ def _build_newton_builder_from_mapping( | |
| positions: torch.Tensor | None = None, | ||
| quaternions: torch.Tensor | None = None, | ||
| up_axis: str = "Z", | ||
| simplify_meshes: bool = True, | ||
| load_visual_shapes: bool = True, | ||
| ) -> tuple[ModelBuilder, object, dict, list, dict[str, ModelBuilder]]: | ||
| """Build a Newton model builder from clone mapping inputs. | ||
|
|
@@ -125,7 +124,6 @@ def _build_newton_builder_from_mapping( | |
| lambda: manager_cls.create_builder(up_axis=up_axis), | ||
| schema_resolvers, | ||
| ignore_paths=deformable_ignore_paths or None, | ||
| simplify_meshes=simplify_meshes, | ||
| load_visual_shapes=load_visual_shapes, | ||
| ) | ||
|
|
||
|
|
@@ -169,7 +167,6 @@ def __init__( | |
| *, | ||
| device: str = "cpu", | ||
| up_axis: str = "Z", | ||
| simplify_meshes: bool | None = None, | ||
| load_visual_shapes: bool | None = None, | ||
| commit_to_manager: bool = True, | ||
| ): | ||
|
|
@@ -179,8 +176,6 @@ def __init__( | |
| stage: USD stage containing source assets. | ||
| device: Device used by the finalized Newton model builder. | ||
| up_axis: Up axis for the Newton model builder. | ||
| simplify_meshes: Whether to run convex-hull mesh approximation. If | ||
| ``None``, read from the active :class:`NewtonCfg`. | ||
| load_visual_shapes: Whether to import visual-only geometry. If ``None``, | ||
| read from the active :class:`NewtonCfg`, which itself defaults to | ||
| importing them only when a renderer or visualizer is active. | ||
|
|
@@ -190,16 +185,11 @@ def __init__( | |
| self.stage = stage | ||
| self.device = device | ||
| self.up_axis = up_axis | ||
| if simplify_meshes is None or load_visual_shapes is None: | ||
| if load_visual_shapes is None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning · Api — Public simplify_meshes removed without deprecation
|
||
| from isaaclab_newton.physics import NewtonCfg | ||
|
|
||
| cfg = PhysicsManager._cfg | ||
| is_newton_cfg = isinstance(cfg, NewtonCfg) | ||
| if simplify_meshes is None: | ||
| simplify_meshes = cfg.simplify_meshes if is_newton_cfg else True | ||
| if load_visual_shapes is None: | ||
| load_visual_shapes = cfg.load_visual_shapes if is_newton_cfg else None | ||
| self.simplify_meshes = simplify_meshes | ||
| load_visual_shapes = cfg.load_visual_shapes if isinstance(cfg, NewtonCfg) else None | ||
| self.load_visual_shapes = _renderer_wants_visual_shapes() if load_visual_shapes is None else load_visual_shapes | ||
| self.commit_to_manager = commit_to_manager | ||
| self._queue: list[_MappingBatch] = [] | ||
|
|
@@ -285,7 +275,6 @@ def replicate(self) -> tuple[ModelBuilder, object, dict]: | |
| positions=positions, | ||
| quaternions=quaternions, | ||
| up_axis=self.up_axis, | ||
| simplify_meshes=self.simplify_meshes, | ||
| load_visual_shapes=self.load_visual_shapes, | ||
| ) | ||
| fabric_body_bindings = rename_builder_labels(builder, sources, destinations, env_ids, mapping) | ||
|
|
@@ -315,7 +304,6 @@ def newton_physics_replicate( | |
| quaternions: torch.Tensor | None = None, | ||
| device: str = "cpu", | ||
| up_axis: str = "Z", | ||
| simplify_meshes: bool = True, | ||
| ): | ||
| """Replicate prims into a Newton ``ModelBuilder`` using a per-source mapping. | ||
|
|
||
|
|
@@ -329,14 +317,11 @@ def newton_physics_replicate( | |
| quaternions: Optional per-environment orientations in xyzw order. | ||
| device: Device used by the finalized Newton model builder. | ||
| up_axis: Up axis for the Newton model builder. | ||
| simplify_meshes: Whether to run convex-hull mesh approximation. | ||
|
|
||
| Returns: | ||
| Tuple of the populated Newton model builder and stage metadata. | ||
| """ | ||
| ctx = NewtonReplicateContext( | ||
| stage, device=device, up_axis=up_axis, simplify_meshes=simplify_meshes, commit_to_manager=True | ||
| ) | ||
| ctx = NewtonReplicateContext(stage, device=device, up_axis=up_axis, commit_to_manager=True) | ||
| ctx.queue_mapping(sources, destinations, env_ids, mapping, positions=positions, quaternions=quaternions) | ||
| builder, stage_info, _site_index_map = ctx.replicate() | ||
| return builder, stage_info | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a replication mapping uses per-world alternatives whose authored approximations produce different shape sequences, these builders now flow unchanged into the combined model, violating SolverMuJoCo's homogeneous-world requirement and causing solver initialization or simulation failure.