Skip to content

Commit f8824ee

Browse files
committed
address comments
Signed-off-by: zhx06 <zihaox@nvidia.com>
1 parent 59d8822 commit f8824ee

8 files changed

Lines changed: 27 additions & 57 deletions

File tree

isaaclab_arena/assets/dummy_object.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
from __future__ import annotations
66

77
import torch
8-
from typing import TYPE_CHECKING
8+
import trimesh
99

1010
from isaaclab_arena.relations.relations import IsAnchor, Relation, RelationBase, UnaryRelation
1111
from isaaclab_arena.utils.bounding_box import AxisAlignedBoundingBox, quaternion_to_90_deg_z_quarters
1212
from isaaclab_arena.utils.pose import Pose
1313

14-
if TYPE_CHECKING:
15-
import trimesh
16-
1714

1815
class DummyObject:
1916
"""Dummy object for testing purposes without Isaac Sim dependencies."""

isaaclab_arena/cli/isaaclab_arena_cli.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,12 @@ def add_isaaclab_arena_cli_args(parser: argparse.ArgumentParser) -> None:
7676
" layout."
7777
),
7878
)
79-
arena_group.add_argument(
80-
"--random_yaw_init",
81-
action="store_true",
82-
default=False,
83-
help=(
84-
"Randomly rotate objects (except anchors) around the Z-axis for scene variety. "
85-
"Collisions use a larger enclosing box; the solver won't optimize this rotation. "
86-
"Only affects objects positioned by the placement solver; manually-placed objects are unaffected."
87-
),
88-
)
8979
arena_group.add_argument(
9080
"--list-variations",
9181
action="store_true",
9282
default=False,
9383
help="Print Hydra-configurable variations for the selected environment and exit.",
9484
)
95-
arena_group.add_argument(
96-
"--collision_mode",
97-
type=str,
98-
choices=["bbox", "mesh"],
99-
default="bbox",
100-
help="Collision detection mode: 'bbox' (AABB, default) or 'mesh' (sphere-to-SDF, requires Warp).",
101-
)
10285

10386

10487
def add_env_graph_spec_cli_args(parser: argparse.ArgumentParser) -> None:

isaaclab_arena/environments/arena_env_builder.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
)
3737
from isaaclab_arena.recording.common_terms import CoreEpisodeRecorderTermCfg, VariationEpisodeRecorderTermCfg
3838
from isaaclab_arena.recording.episode_recorder_manager import EpisodeRecorderTermCfg
39-
from isaaclab_arena.relations.collision_mode import CollisionMode
4039
from isaaclab_arena.relations.object_placer_params import ObjectPlacerParams
4140
from isaaclab_arena.relations.placement_events import PLACEMENT_RESET_EVENT_NAME
42-
from isaaclab_arena.relations.relation_solver_params import RelationSolverParams
4341
from isaaclab_arena.tasks.no_task import NoTask
4442
from isaaclab_arena.utils.configclass import combine_configclass_instances, make_configclass
4543
from isaaclab_arena.utils.isaaclab_utils.simulation_app import reapply_viewer_cfg
@@ -86,20 +84,9 @@ def _solve_relations(self) -> None:
8684
"""
8785
objects_with_relations = self.arena_env.scene.get_objects_with_relations()
8886

89-
# Prefer env-level placer_params; fall back to CLI-constructed defaults.
9087
placer_params = self.arena_env.placer_params
9188
if placer_params is None:
92-
collision_mode_str = getattr(self.args, "collision_mode", "bbox")
93-
mode = CollisionMode.MESH if collision_mode_str == "mesh" else CollisionMode.BBOX
94-
placer_params = ObjectPlacerParams(
95-
placement_seed=self.args.placement_seed,
96-
random_yaw_init=self.args.random_yaw_init,
97-
solver_params=RelationSolverParams(
98-
collision_mode=mode,
99-
save_position_history=False,
100-
verbose=False,
101-
),
102-
)
89+
placer_params = ObjectPlacerParams(placement_seed=self.args.placement_seed)
10390
if self.args.resolve_on_reset is not None:
10491
placer_params.resolve_on_reset = self.args.resolve_on_reset
10592
self._placement_event_cfg = solve_and_apply_relation_placement(

isaaclab_arena/environments/isaaclab_arena_environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def __init__(
5252
``"my_module:RLPolicyCfg"``.
5353
episode_recorder_terms: Additional per-episode recorder terms to record alongside the
5454
built-in ones, keyed by name.
55-
placer_params: Object placement configuration. When set, used as-is
56-
(CLI flags are ignored). When None, params are built from CLI flags.
55+
placer_params: Object placement configuration. When None, default
56+
ObjectPlacerParams are used.
5757
"""
5858
self.name = name
5959
self.scene = scene

isaaclab_arena/relations/mesh_pair_cache.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99

1010
import torch
1111
from dataclasses import dataclass
12-
from typing import TYPE_CHECKING
1312

14-
if TYPE_CHECKING:
15-
import warp as wp
13+
import warp as wp
1614

17-
from isaaclab_arena.assets.object_base import ObjectBase
15+
from isaaclab_arena.assets.object_base import ObjectBase
1816

1917

2018
@dataclass(slots=True)
2119
class MeshPairCache:
22-
"""Precomputed per-pair collision data for the vectorized multi-mesh kernel."""
20+
"""Precomputed per-pair collision data for the vectorized multi-mesh kernel.
21+
22+
Dimensions: P = num_pairs (ordered subject/obstacle pairs), B = batch_size (num envs),
23+
S = total_spheres (sum of sphere counts across all P pairs; each subject object is decomposed
24+
into multiple covering spheres via greedy_sphere_decomposition).
25+
"""
2326

2427
all_centers_local: torch.Tensor
2528
"""(S, 3) sphere centers in each subject's local frame, concatenated across pairs."""
@@ -28,34 +31,34 @@ class MeshPairCache:
2831
"""(S,) sphere radii, concatenated across pairs."""
2932

3033
pair_subject_objs: list[ObjectBase]
31-
"""Per-pair subject (sphere source) object reference."""
34+
"""(P,) subject (sphere source) object reference per pair."""
3235

3336
pair_obstacle_objs: list[ObjectBase]
34-
"""Per-pair obstacle (mesh target) object reference."""
37+
"""(P,) obstacle (mesh target) object reference per pair."""
3538

3639
pair_is_anchor: list[bool]
37-
"""Per-pair flag: True if the obstacle is a static anchor."""
40+
"""(P,) True if the obstacle is a static anchor."""
3841

3942
pair_anchor_pos: list[torch.Tensor | None]
40-
"""Per-pair world position for anchor obstacles (None for non-anchor obstacles)."""
43+
"""(P,) world position for anchor obstacles (None for non-anchors)."""
4144

4245
pair_anchor_yaw: list[float]
43-
"""Per-pair anchor yaw in radians (0.0 for non-anchor obstacles)."""
46+
"""(P,) anchor yaw in radians (0.0 for non-anchors)."""
4447

4548
pair_subject_bbox_min: torch.Tensor
46-
"""(P, B, 3) subject bbox min corners for broadphase."""
49+
"""(P, B, 3) subject bbox min corners for overlap filtering."""
4750

4851
pair_subject_bbox_max: torch.Tensor
49-
"""(P, B, 3) subject bbox max corners for broadphase."""
52+
"""(P, B, 3) subject bbox max corners for overlap filtering."""
5053

5154
pair_obstacle_bbox_min: torch.Tensor
52-
"""(P, B, 3) obstacle bbox min corners for broadphase."""
55+
"""(P, B, 3) obstacle bbox min corners for overlap filtering."""
5356

5457
pair_obstacle_bbox_max: torch.Tensor
55-
"""(P, B, 3) obstacle bbox max corners for broadphase."""
58+
"""(P, B, 3) obstacle bbox max corners for overlap filtering."""
5659

5760
pair_max_radius: torch.Tensor
58-
"""(P,) max sphere radius per pair (broadphase margin)."""
61+
"""(P,) max sphere radius per pair (overlap filter margin)."""
5962

6063
sphere_pair_id: torch.Tensor
6164
"""(S,) maps each sphere to its pair index for segment reduction."""
@@ -67,7 +70,7 @@ class MeshPairCache:
6770
"""(P,) number of spheres per pair (for mean reduction)."""
6871

6972
mesh_id_array: wp.array
70-
"""Warp uint64 array of mesh IDs for the multi-mesh kernel."""
73+
"""(num_unique_meshes,) Warp uint64 array of mesh IDs for the multi-mesh kernel."""
7174

7275
num_pairs: int
7376
"""Total number of active object pairs."""

isaaclab_arena/relations/object_placer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
@dataclass
3939
class PlacementCandidate:
40-
"""A scored solver result used for ranking inside ObjectPlacer."""
40+
"""A candidate object layout with its solver loss and validation outcome."""
4141

4242
loss: float
4343
"""Loss value returned by the solver."""
@@ -226,7 +226,7 @@ def _place_ranked(
226226
self._generate_initial_orientations(objects, anchor_objects_set, generator)
227227
)
228228

229-
# Bake each candidate's total yaw into a conservative enclosing bbox (AABB broadphase).
229+
# Bake each candidate's total yaw into a conservative enclosing bbox for overlap checks.
230230
candidate_bboxes = self._rotate_candidate_bboxes(objects, candidate_bboxes, orientations_per_candidate)
231231

232232
all_positions = self._solver.solve(

isaaclab_arena/relations/relation_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class NoOverlapPair:
4747

4848

4949
class MeshPairEntry(NamedTuple):
50-
"""One directed sphere-to-mesh pair collected during cache construction."""
50+
"""One directed sphere-to-mesh collision pair (subject spheres vs obstacle mesh)."""
5151

5252
subject: ObjectBase
5353
obstacle: ObjectBase

isaaclab_arena/relations/warp_mesh_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def greedy_sphere_decomposition(
110110

111111

112112
class WarpMeshAndSphereCache:
113-
"""Cache for Warp BVH meshes and sphere decompositions used in mesh-based collision queries."""
113+
"""Cache for Warp BVH meshes and sphere decompositions."""
114114

115115
def __init__(
116116
self,

0 commit comments

Comments
 (0)