Merge branch 'replace-usd-aabb' of https://github.com/StanfordVL/iGibson3 into replace-usd-aabb

This commit is contained in:
Chengshu Li 2024-02-22 17:39:05 -08:00
commit 55abc3fe3d
5 changed files with 8 additions and 19 deletions

View File

@ -413,11 +413,7 @@ class ParticleModifier(IntrinsicObjectState, LinkBasedStateMixin, UpdateStateMix
def check_overlap():
nonlocal valid_hit
valid_hit = False
try:
aabb = self.link.visual_aabb
except NotImplementedError:
# If the link doesn't have an AABB, we can't check for overlaps
return False
aabb = self.link.visual_aabb
og.sim.psqi.overlap_box(
halfExtent=(aabb[1] - aabb[0]) / 2.0 + m.PARTICLE_MODIFIER_ADJACENCY_AREA_MARGIN,
pos=(aabb[1] + aabb[0]) / 2.0,

View File

@ -1250,11 +1250,6 @@ class EntityPrim(XFormPrim):
points_transformed = points_rotated + position
points_world.append(points_transformed)
if not points_world:
# TODO: Decide if this is the right thing to do
position = self.get_position()
return position, position
all_points = np.concatenate(points_world, axis=0)
aabb_lo = np.min(all_points, axis=0)
aabb_hi = np.max(all_points, axis=0)

View File

@ -608,7 +608,7 @@ class RigidPrim(XFormPrim):
def _compute_points_on_convex_hull(self, visual):
"""
Returns:
np.ndarray: points on the convex hull of all points from child geom prims
np.ndarray or None: points on the convex hull of all points from child geom prims
"""
meshes = self._visual_meshes if visual else self._collision_meshes
points = []
@ -628,7 +628,8 @@ class RigidPrim(XFormPrim):
return points[hull.vertices, :]
except scipy.spatial.qhull.QhullError:
# Handle the case where a convex hull cannot be formed (e.g., collinear points)
return None
# return all the points in this case
return points
@cached_property
def visual_boundary_points(self):
@ -650,9 +651,6 @@ class RigidPrim(XFormPrim):
def aabb(self):
position, orientation = self.get_position_orientation()
hull_points = self.collision_boundary_points
if hull_points is None:
# TODO: Decide if this is the right thing to do
return position, position
scale = self.scale
points_scaled = hull_points * scale

View File

@ -385,10 +385,7 @@ def generate_points_in_volume_checker_function(obj, volume_link, use_visual_mesh
mesh.visible = True
# Determine equally-spaced sampling distance to achieve this minimum particle count
try:
aabb_volume = np.product(volume_link.visual_aabb_extent)
except NotImplementedError:
return 0
aabb_volume = np.product(volume_link.visual_aabb_extent)
sampling_distance = np.cbrt(aabb_volume / min_n_particles)
low, high = volume_link.visual_aabb
n_particles_per_axis = ((high - low) / sampling_distance).astype(int) + 1

View File

@ -713,6 +713,7 @@ def test_cooking_system_rule_failure_nonrecipe_objects():
rosemary.remove_all_particles()
og.sim.step()
@pytest.mark.skip(reason="will fix in PR #582.")
@og_test
def test_cooking_system_rule_success():
assert len(REGISTERED_RULES) > 0, "No rules registered!"
@ -902,6 +903,7 @@ def test_cooking_object_rule_failure_unary_states():
# Clean up
sesame_seed.remove_all_particles()
@pytest.mark.skip(reason="will fix in PR #582.")
@og_test
def test_cooking_object_rule_failure_binary_system_states():
assert len(REGISTERED_RULES) > 0, "No rules registered!"
@ -1390,6 +1392,7 @@ def test_single_toggleable_machine_rule_output_system_success():
og.sim.import_object(obj)
og.sim.step()
@pytest.mark.skip(reason="will fix in PR #582.")
@og_test
def test_single_toggleable_machine_rule_output_object_failure_unary_states():
assert len(REGISTERED_RULES) > 0, "No rules registered!"