WIP in the processing of removing BoundingBoxAPI
This commit is contained in:
parent
fc93946960
commit
4d876cac0a
|
@ -193,7 +193,10 @@ class HeatSourceOrSink(AbsoluteObjectState, LinkBasedStateMixin):
|
|||
aabb_lower, aabb_upper = obj.states[AABB].get_value()
|
||||
obj_pos = (aabb_lower + aabb_upper) / 2.0
|
||||
# Position is either the AABB center of the default link or the metalink position itself
|
||||
heat_source_pos = self.link.aabb_center if self.link == self._default_link else self.link.get_position()
|
||||
try:
|
||||
heat_source_pos = self.link.aabb_center if self.link == self._default_link else self.link.get_position()
|
||||
except NotImplementedError:
|
||||
heat_source_pos = self.link.get_position()
|
||||
if T.l2_distance(heat_source_pos, obj_pos) > self.distance_threshold:
|
||||
return False
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import numpy as np
|
||||
import omnigibson as og
|
||||
from omnigibson.object_states.aabb import AABB
|
||||
from omnigibson.object_states.adjacency import HorizontalAdjacency, VerticalAdjacency, flatten_planes
|
||||
from omnigibson.object_states.kinematics_mixin import KinematicsMixin
|
||||
from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState
|
||||
from omnigibson.utils.object_state_utils import sample_kinematics
|
||||
from omnigibson.utils.usd_utils import BoundingBoxAPI
|
||||
from omnigibson.utils.object_state_utils import m as os_m
|
||||
|
||||
|
||||
|
@ -34,9 +34,9 @@ class Inside(RelativeObjectState, KinematicsMixin, BooleanStateMixin):
|
|||
# Since we usually check for a small set of outer objects, this is cheap
|
||||
aabb_lower, aabb_upper = self.obj.states[AABB].get_value()
|
||||
inner_object_pos = (aabb_lower + aabb_upper) / 2.0
|
||||
outer_object_aabb = other.states[AABB].get_value()
|
||||
|
||||
if not BoundingBoxAPI.aabb_contains_point(inner_object_pos, outer_object_aabb):
|
||||
outer_object_aabb_lo, outer_object_aabb_hi = other.states[AABB].get_value()
|
||||
|
||||
if not (np.less_equal(outer_object_aabb_lo, inner_object_pos).all() and np.less_equal(inner_object_pos, outer_object_aabb_hi).all()):
|
||||
return False
|
||||
|
||||
# Our definition of inside: an object A is inside an object B if there
|
||||
|
|
|
@ -399,7 +399,11 @@ class ParticleModifier(IntrinsicObjectState, LinkBasedStateMixin, UpdateStateMix
|
|||
def check_overlap():
|
||||
nonlocal valid_hit
|
||||
valid_hit = False
|
||||
aabb = self.link.aabb
|
||||
try:
|
||||
aabb = self.link.aabb
|
||||
except NotImplementedError:
|
||||
# If the link doesn't have an AABB, we can't check for overlaps
|
||||
return False
|
||||
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,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from collections.abc import Iterable
|
||||
import numpy as np
|
||||
import omnigibson as og
|
||||
from omnigibson.macros import gm
|
||||
import omnigibson.lazy as lazy
|
||||
from omnigibson.prims.prim_base import BasePrim
|
||||
from omnigibson.prims.material_prim import MaterialPrim
|
||||
|
@ -349,7 +350,7 @@ class XFormPrim(BasePrim):
|
|||
- 3-array: (x,y,z) lower corner of the bounding box
|
||||
- 3-array: (x,y,z) upper corner of the bounding box
|
||||
"""
|
||||
return BoundingBoxAPI.compute_aabb(self)
|
||||
raise NotImplementedError("An XformPrim on its own does not have a bounding box")
|
||||
|
||||
@property
|
||||
def aabb_extent(self):
|
||||
|
|
|
@ -385,7 +385,10 @@ 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
|
||||
aabb_volume = np.product(volume_link.aabb_extent)
|
||||
try:
|
||||
aabb_volume = np.product(volume_link.aabb_extent)
|
||||
except NotImplementedError:
|
||||
return 0
|
||||
sampling_distance = np.cbrt(aabb_volume / min_n_particles)
|
||||
low, high = volume_link.aabb
|
||||
n_particles_per_axis = ((high - low) / sampling_distance).astype(int) + 1
|
||||
|
|
|
@ -6,7 +6,6 @@ import omnigibson as og
|
|||
from omnigibson.macros import gm
|
||||
from omnigibson.utils import python_utils
|
||||
import omnigibson.utils.transform_utils as T
|
||||
from omnigibson.utils.usd_utils import BoundingBoxAPI
|
||||
import omnigibson.lazy as lazy
|
||||
from omnigibson.utils.ui_utils import create_module_logger
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from omnigibson.systems import get_system, is_physical_particle_system, is_visua
|
|||
from omnigibson.utils.constants import PrimType
|
||||
from omnigibson.utils.physx_utils import apply_force_at_pos, apply_torque
|
||||
import omnigibson.utils.transform_utils as T
|
||||
from omnigibson.utils.usd_utils import BoundingBoxAPI
|
||||
import omnigibson as og
|
||||
|
||||
from utils import og_test, get_random_pose, place_objA_on_objB_bbox, place_obj_on_floor_plane
|
||||
|
|
|
@ -4,7 +4,6 @@ from omnigibson.systems import get_system, is_physical_particle_system, is_visua
|
|||
from omnigibson.utils.constants import PrimType
|
||||
from omnigibson.utils.physx_utils import apply_force_at_pos, apply_torque
|
||||
import omnigibson.utils.transform_utils as T
|
||||
from omnigibson.utils.usd_utils import BoundingBoxAPI
|
||||
from omnigibson.objects import DatasetObject
|
||||
from omnigibson.transition_rules import REGISTERED_RULES
|
||||
import omnigibson as og
|
||||
|
|
Loading…
Reference in New Issue