-
Notifications
You must be signed in to change notification settings - Fork 68
Mesh-based Non-collision Constraints #771
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
Open
zhx06
wants to merge
3
commits into
main
Choose a base branch
from
zxiao/feature/mesh_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Copyright (c) 2025-2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from enum import Enum | ||
|
|
||
|
|
||
| class CollisionMode(Enum): | ||
| """Selects which collision detection method the solver uses for no-overlap constraints.""" | ||
|
|
||
| BBOX = "bbox" | ||
| """Axis-aligned bounding box overlap volume (fast, conservative).""" | ||
|
|
||
| MESH = "mesh" | ||
| """Sphere-to-SDF queries against actual mesh geometry (accurate, slower).""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Copyright (c) 2025-2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Typed container for precomputed mesh-collision pair data.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import torch | ||
| from dataclasses import dataclass | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: | ||
| import warp as wp | ||
|
|
||
| from isaaclab_arena.assets.object_base import ObjectBase | ||
|
|
||
|
|
||
| @dataclass(slots=True) | ||
| class MeshPairCache: | ||
| """Precomputed per-pair collision data for the vectorized multi-mesh kernel.""" | ||
|
|
||
| all_centers_local: torch.Tensor | ||
| """(S, 3) sphere centers in each subject's local frame, concatenated across pairs.""" | ||
|
|
||
| all_radii: torch.Tensor | ||
| """(S,) sphere radii, concatenated across pairs.""" | ||
|
|
||
| pair_subject_objs: list[ObjectBase] | ||
| """Per-pair subject (sphere source) object reference.""" | ||
|
|
||
| pair_obstacle_objs: list[ObjectBase] | ||
| """Per-pair obstacle (mesh target) object reference.""" | ||
|
|
||
| pair_is_anchor: list[bool] | ||
| """Per-pair flag: True if the obstacle is a static anchor.""" | ||
|
|
||
| pair_anchor_pos: list[torch.Tensor | None] | ||
| """Per-pair world position for anchor obstacles (None for non-anchor obstacles).""" | ||
|
|
||
| pair_anchor_yaw: list[float] | ||
| """Per-pair anchor yaw in radians (0.0 for non-anchor obstacles).""" | ||
|
|
||
| pair_subject_bbox_min: torch.Tensor | ||
| """(P, B, 3) subject bbox min corners for broadphase.""" | ||
|
|
||
| pair_subject_bbox_max: torch.Tensor | ||
| """(P, B, 3) subject bbox max corners for broadphase.""" | ||
|
|
||
| pair_obstacle_bbox_min: torch.Tensor | ||
| """(P, B, 3) obstacle bbox min corners for broadphase.""" | ||
|
|
||
| pair_obstacle_bbox_max: torch.Tensor | ||
| """(P, B, 3) obstacle bbox max corners for broadphase.""" | ||
|
|
||
| pair_max_radius: torch.Tensor | ||
| """(P,) max sphere radius per pair (broadphase margin).""" | ||
|
|
||
| sphere_pair_id: torch.Tensor | ||
| """(S,) maps each sphere to its pair index for segment reduction.""" | ||
|
|
||
| sphere_mesh_idx: torch.Tensor | ||
| """(S,) per-sphere index into mesh_id_array.""" | ||
|
|
||
| pair_sphere_count: torch.Tensor | ||
| """(P,) number of spheres per pair (for mean reduction).""" | ||
|
|
||
| mesh_id_array: wp.array | ||
| """Warp uint64 array of mesh IDs for the multi-mesh kernel.""" | ||
|
|
||
| num_pairs: int | ||
| """Total number of active object pairs.""" | ||
|
|
||
| total_spheres: int | ||
| """Total number of sphere queries across all pairs.""" | ||
|
|
||
| def __post_init__(self) -> None: | ||
| assert len(self.pair_subject_objs) == self.num_pairs, "pair_subject_objs length mismatch" | ||
| assert len(self.pair_obstacle_objs) == self.num_pairs, "pair_obstacle_objs length mismatch" | ||
| assert len(self.pair_is_anchor) == self.num_pairs, "pair_is_anchor length mismatch" | ||
| assert self.all_centers_local.shape[0] == self.total_spheres, "all_centers_local size mismatch" | ||
| assert self.all_radii.shape[0] == self.total_spheres, "all_radii size mismatch" | ||
| assert self.sphere_pair_id.shape[0] == self.total_spheres, "sphere_pair_id size mismatch" | ||
| assert self.sphere_mesh_idx.shape[0] == self.total_spheres, "sphere_mesh_idx size mismatch" | ||
| assert int(self.pair_sphere_count.sum().item()) == self.total_spheres, "pair_sphere_count sum mismatch" | ||
| for i, (is_anchor, pos) in enumerate(zip(self.pair_is_anchor, self.pair_anchor_pos)): | ||
| assert not is_anchor or pos is not None, f"pair {i}: is_anchor=True but anchor_pos is None" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.