Skip to content

Add support for reading cloth particle positions under Fabric #3104

Add support for reading cloth particle positions under Fabric

Add support for reading cloth particle positions under Fabric #3104

GitHub Actions / Test Results succeeded Dec 21, 2024 in 0s

138 passed, 15 failed and 9 skipped

Tests failed

Report Passed Failed Skipped Time
12440976406-tests-test_controllers/test_controllers.xml 1✅ 930s
12440976406-tests-test_curobo/test_curobo.xml 1✅ 1157s
12440976406-tests-test_data_collection/test_data_collection.xml 1✅ 1866s
12440976406-tests-test_dump_load_states/test_dump_load_states.xml 4✅ 1910s
12440976406-tests-test_envs/test_envs.xml 5✅ 2109s
12440976406-tests-test_multiple_envs/test_multiple_envs.xml 8✅ 2⚪ 614s
12440976406-tests-test_object_removal/test_object_removal.xml 2✅ 1960s
12440976406-tests-test_object_states/test_object_states.xml 27✅ 6❌ 2293s
12440976406-tests-test_primitives/test_primitives.xml 6❌ 4⚪ 581s
12440976406-tests-test_robot_states_flatcache/test_robot_states_flatcache.xml 3✅ 1513s
12440976406-tests-test_robot_states_no_flatcache/test_robot_states_no_flatcache.xml 3✅ 616s
12440976406-tests-test_robot_teleoperation/test_robot_teleoperation.xml 1⚪ 27ms
12440976406-tests-test_scene_graph/test_scene_graph.xml 1✅ 607s
12440976406-tests-test_sensors/test_sensors.xml 2✅ 1952s
12440976406-tests-test_symbolic_primitives/test_symbolic_primitives.xml 18✅ 2⚪ 2104s
12440976406-tests-test_systems/test_systems.xml 1✅ 1788s
12440976406-tests-test_transform_utils/test_transform_utils.xml 34✅ 147s
12440976406-tests-test_transition_rules/test_transition_rules.xml 27✅ 3❌ 1676s

✅ 12440976406-tests-test_controllers/test_controllers.xml

1 tests were completed in 930s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1✅ 930s

✅ pytest

tests.test_controllers
  ✅ test_arm_control

✅ 12440976406-tests-test_curobo/test_curobo.xml

1 tests were completed in 1157s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1✅ 1157s

✅ pytest

tests.test_curobo
  ✅ test_curobo

✅ 12440976406-tests-test_data_collection/test_data_collection.xml

1 tests were completed in 1866s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1✅ 1866s

✅ pytest

tests.test_data_collection
  ✅ test_data_collect_and_playback

✅ 12440976406-tests-test_dump_load_states/test_dump_load_states.xml

4 tests were completed in 1910s with 4 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 4✅ 1910s

✅ pytest

tests.test_dump_load_states
  ✅ test_dump_load
  ✅ test_dump_load_serialized
  ✅ test_save_restore_partial
  ✅ test_save_restore_full

✅ 12440976406-tests-test_envs/test_envs.xml

5 tests were completed in 2109s with 5 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 5✅ 2109s

✅ pytest

tests.test_envs
  ✅ test_dummy_task
  ✅ test_point_reaching_task
  ✅ test_point_navigation_task
  ✅ test_behavior_task
  ✅ test_rs_int_full_load

✅ 12440976406-tests-test_multiple_envs/test_multiple_envs.xml

10 tests were completed in 614s with 8 passed, 0 failed and 2 skipped.

Test suite Passed Failed Skipped Time
pytest 8✅ 2⚪ 614s

✅ pytest

tests.test_multiple_envs
  ✅ test_multi_scene_dump_load_states
  ✅ test_multi_scene_get_local_position
  ✅ test_multi_scene_set_local_position
  ✅ test_multi_scene_scene_prim
  ✅ test_multi_scene_particle_source
  ✅ test_multi_scene_position_orientation_relative_to_scene
  ✅ test_tiago_getter
  ✅ test_tiago_setter
  ⚪ test_behavior_getter
  ⚪ test_behavior_setter

✅ 12440976406-tests-test_object_removal/test_object_removal.xml

2 tests were completed in 1960s with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 2✅ 1960s

✅ pytest

tests.test_object_removal
  ✅ test_removal_and_readdition
  ✅ test_readdition

❌ 12440976406-tests-test_object_states/test_object_states.xml

33 tests were completed in 2293s with 27 passed, 6 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 27✅ 6❌ 2293s

❌ pytest

tests.test_object_states
  ❌ test_on_top
	def wrapper():
  ❌ test_inside
	def wrapper():
  ❌ test_under
	def wrapper():
  ✅ test_touching
  ✅ test_contact_bodies
  ❌ test_next_to
	def wrapper():
  ✅ test_overlaid
  ✅ test_pose
  ✅ test_joint
  ✅ test_aabb
  ❌ test_adjacency
	def wrapper():
  ❌ test_temperature
	def wrapper():
  ✅ test_max_temperature
  ✅ test_heat_source_or_sink
  ✅ test_cooked
  ✅ test_burnt
  ✅ test_frozen
  ✅ test_heated
  ✅ test_on_fire
  ✅ test_toggled_on
  ✅ test_attached_to
  ✅ test_particle_source
  ✅ test_particle_sink
  ✅ test_particle_applier
  ✅ test_particle_remover
  ✅ test_saturated
  ✅ test_open
  ✅ test_folded_unfolded
  ✅ test_draped
  ✅ test_filled
  ✅ test_contains
  ✅ test_covered
  ✅ test_clear_sim

❌ 12440976406-tests-test_primitives/test_primitives.xml

10 tests were completed in 581s with 0 passed, 6 failed and 4 skipped.

Test suite Passed Failed Skipped Time
pytest 6❌ 4⚪ 581s

❌ pytest

tests.test_primitives.TestPrimitives
  ❌ test_navigate[Tiago]
	self = <test_primitives.TestPrimitives object at 0x7f2edd142230>
  ❌ test_navigate[Fetch]
	self = <test_primitives.TestPrimitives object at 0x7f2edd140910>
  ❌ test_grasp[Tiago]
	self = <test_primitives.TestPrimitives object at 0x7f2edd140190>
  ❌ test_grasp[Fetch]
	self = <test_primitives.TestPrimitives object at 0x7f2edd141000>
  ❌ test_place[Tiago]
	self = <test_primitives.TestPrimitives object at 0x7f2edd1414b0>
  ❌ test_place[Fetch]
	self = <test_primitives.TestPrimitives object at 0x7f2edd140790>
  ⚪ test_open_prismatic[Tiago]
  ⚪ test_open_prismatic[Fetch]
  ⚪ test_open_revolute[Tiago]
  ⚪ test_open_revolute[Fetch]

✅ 12440976406-tests-test_robot_states_flatcache/test_robot_states_flatcache.xml

3 tests were completed in 1513s with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 3✅ 1513s

✅ pytest

tests.test_robot_states_flatcache
  ✅ test_camera_pose_flatcache_on
  ✅ test_robot_load_drive
  ✅ test_grasping_mode

✅ 12440976406-tests-test_robot_states_no_flatcache/test_robot_states_no_flatcache.xml

3 tests were completed in 616s with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 3✅ 616s

✅ pytest

tests.test_robot_states_no_flatcache
  ✅ test_camera_pose_flatcache_off
  ✅ test_camera_semantic_segmentation
  ✅ test_object_in_FOV_of_robot

✅ 12440976406-tests-test_robot_teleoperation/test_robot_teleoperation.xml

1 tests were completed in 27ms with 0 passed, 0 failed and 1 skipped.

Test suite Passed Failed Skipped Time
pytest 1⚪ 27ms

✅ pytest

tests.test_robot_teleoperation
  ⚪ test_teleop

✅ 12440976406-tests-test_scene_graph/test_scene_graph.xml

1 tests were completed in 607s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1✅ 607s

✅ pytest

tests.test_scene_graph
  ✅ test_scene_graph

✅ 12440976406-tests-test_sensors/test_sensors.xml

2 tests were completed in 1952s with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 2✅ 1952s

✅ pytest

tests.test_sensors
  ✅ test_segmentation_modalities
  ✅ test_bbox_modalities

✅ 12440976406-tests-test_symbolic_primitives/test_symbolic_primitives.xml

20 tests were completed in 2104s with 18 passed, 0 failed and 2 skipped.

Test suite Passed Failed Skipped Time
pytest 18✅ 2⚪ 2104s

✅ pytest

tests.test_symbolic_primitives.TestSymbolicPrimitives
  ✅ test_in_hand_state[Fetch]
  ✅ test_open[Fetch]
  ✅ test_close[Fetch]
  ✅ test_place_inside[Fetch]
  ✅ test_place_ontop[Fetch]
  ✅ test_toggle_on[Fetch]
  ✅ test_soak_under[Fetch]
  ✅ test_wipe[Fetch]
  ⚪ test_cut[Fetch]
  ✅ test_persistent_sticky_grasping[Fetch]
  ✅ test_in_hand_state[Tiago]
  ✅ test_open[Tiago]
  ✅ test_close[Tiago]
  ✅ test_place_inside[Tiago]
  ✅ test_place_ontop[Tiago]
  ✅ test_toggle_on[Tiago]
  ✅ test_soak_under[Tiago]
  ✅ test_wipe[Tiago]
  ⚪ test_cut[Tiago]
  ✅ test_persistent_sticky_grasping[Tiago]

✅ 12440976406-tests-test_systems/test_systems.xml

1 tests were completed in 1788s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1✅ 1788s

✅ pytest

tests.test_systems
  ✅ test_system_clear

✅ 12440976406-tests-test_transform_utils/test_transform_utils.xml

34 tests were completed in 147s with 34 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 34✅ 147s

✅ pytest

tests.test_transform_utils.TestQuaternionOperations
  ✅ test_quat2mat_special_cases
  ✅ test_quat_multiply
  ✅ test_quat_conjugate
  ✅ test_quat_inverse
  ✅ test_quat_distance
tests.test_transform_utils.TestVectorOperations
  ✅ test_normalize
  ✅ test_dot_product
  ✅ test_l2_distance
tests.test_transform_utils.TestMatrixOperations
  ✅ test_rotation_matrix_properties
  ✅ test_rotation_matrix
  ✅ test_transformation_matrix
  ✅ test_transformation_matrix_no_point
  ✅ test_matrix_inverse
tests.test_transform_utils.TestCoordinateTransformations
  ✅ test_cartesian_to_polar
tests.test_transform_utils.TestPoseTransformations
  ✅ test_pose2mat_and_mat2pose
  ✅ test_pose_inv
tests.test_transform_utils.TestAxisAngleConversions
  ✅ test_axisangle2quat_and_quat2axisangle
  ✅ test_vecs2axisangle
  ✅ test_vecs2quat
tests.test_transform_utils.TestEulerAngleConversions
  ✅ test_euler2quat_and_quat2euler
  ✅ test_euler2mat_and_mat2euler
tests.test_transform_utils.TestQuaternionApplications
  ✅ test_quat_apply
  ✅ test_quat_slerp
tests.test_transform_utils.TestTransformPoints
  ✅ test_transform_points_2d
  ✅ test_transform_points_3d
tests.test_transform_utils.TestMiscellaneousFunctions
  ✅ test_convert_quat
  ✅ test_random_quaternion
  ✅ test_random_axis_angle
  ✅ test_align_vector_sets
  ✅ test_copysign
  ✅ test_anorm
  ✅ test_check_quat_right_angle
  ✅ test_z_angle_from_quat
  ✅ test_integer_spiral_coordinates

❌ 12440976406-tests-test_transition_rules/test_transition_rules.xml

30 tests were completed in 1676s with 27 passed, 3 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 27✅ 3❌ 1676s

❌ pytest

tests.test_transition_rules
  ✅ test_dryer_rule
  ✅ test_washer_rule
  ✅ test_slicing_rule
  ✅ test_dicing_rule_cooked
  ✅ test_dicing_rule_uncooked
  ✅ test_melting_rule
  ✅ test_cooking_physical_particle_rule_failure_recipe_systems
  ✅ test_cooking_physical_particle_rule_success
  ✅ test_mixing_rule_failure_recipe_systems
  ✅ test_mixing_rule_failure_nonrecipe_systems
  ✅ test_mixing_rule_success
  ✅ test_cooking_system_rule_failure_recipe_systems
  ✅ test_cooking_system_rule_failure_nonrecipe_systems
  ✅ test_cooking_system_rule_failure_nonrecipe_objects
  ✅ test_cooking_system_rule_success
  ✅ test_cooking_object_rule_failure_wrong_container
  ✅ test_cooking_object_rule_failure_recipe_objects
  ✅ test_cooking_object_rule_failure_unary_states
  ✅ test_cooking_object_rule_failure_binary_system_states
  ✅ test_cooking_object_rule_failure_binary_object_states
  ✅ test_cooking_object_rule_failure_wrong_heat_source
  ❌ test_cooking_object_rule_success
	def wrapper():
  ✅ test_single_toggleable_machine_rule_output_system_failure_wrong_container
  ✅ test_single_toggleable_machine_rule_output_system_failure_recipe_systems
  ✅ test_single_toggleable_machine_rule_output_system_failure_recipe_objects
  ✅ test_single_toggleable_machine_rule_output_system_failure_nonrecipe_systems
  ✅ test_single_toggleable_machine_rule_output_system_failure_nonrecipe_objects
  ✅ test_single_toggleable_machine_rule_output_system_success
  ❌ test_single_toggleable_machine_rule_output_object_failure_unary_states
	def wrapper():
  ❌ test_single_toggleable_machine_rule_output_object_success
	def wrapper():

Annotations

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_on_top

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:28: in test_on_top
    assert obj.states[OnTop].get_value(breakfast_table)
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/on_top.py:48: in _get_value
    adjacency = self.obj.states[VerticalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:169: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f142b5dffa0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_inside

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:56: in test_inside
    assert dishtowel.states[Inside].get_value(bottom_cabinet)
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/inside.py:63: in _get_value
    vertical_adjacency = self.obj.states[VerticalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:169: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f142b5dffa0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_under

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:86: in test_under
    assert obj.states[Under].get_value(breakfast_table)
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/under.py:42: in _get_value
    adjacency = self.obj.states[VerticalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:169: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f142b5dffa0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_next_to

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:164: in test_next_to
    assert obj.states[NextTo].get_value(bottom_cabinet)
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/next_to.py:44: in _get_value
    adjacency_this = self.obj.states[HorizontalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:209: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f142b5dffa0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_adjacency

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:289: in test_adjacency
    for coordinate in obj.states[HorizontalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:209: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f142b5dffa0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_object_states/test_object_states.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_object_states ► test_temperature

Failed test found in:
  12440976406-tests-test_object_states/test_object_states.xml
Error:
  def wrapper():
Raw output
def wrapper():
        assert_test_env()
        try:
>           func(env)

tests/utils.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_object_states.py:365: in test_temperature
    og.sim.step()
omnigibson/simulator.py:1108: in step
    self._non_physics_step()
omnigibson/simulator.py:981: in _non_physics_step
    obj.states[state_type].update()
omnigibson/object_states/update_state_mixin.py:15: in update
    return self._update()
omnigibson/object_states/heat_source_or_sink.py:251: in _update
    if not obj.states[Inside].get_value(self.obj):
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/inside.py:63: in _get_value
    vertical_adjacency = self.obj.states[VerticalAdjacency].get_value()
omnigibson/object_states/object_state_base.py:325: in get_value
    self.update_cache(get_value_args=key)
omnigibson/object_states/object_state_base.py:195: in update_cache
    val = self._get_value(*get_value_args)
omnigibson/object_states/adjacency.py:169: in _get_value
    bodies_by_axis = compute_adjacencies(
omnigibson/object_states/adjacency.py:91: in compute_adjacencies
    ray_starts = th.tile(obj.root_link.centroid_particle_position, (len(directions), 1))
omnigibson/prims/cloth_prim.py:372: in centroid_particle_position
    return self.compute_particle_positions(idxs=[self._centroid_idx])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.prims.cloth_prim.ClothPrim object at 0x7f14291533d0>
idxs = [tensor(1207)]

    def compute_particle_positions(self, idxs=None):
        """
        Compute individual particle positions for this cloth prim
    
        Args:
            idxs (n-array or None): If set, will only calculate the requested indexed particle state
    
        Returns:
            th.tensor: (N, 3) numpy array, where each of the N particles' positions are expressed in (x,y,z)
                cartesian coordinates relative to the world frame
        """
        world_pose_w_scale = PoseAPI.get_world_pose_with_scale(self.prim_path)
    
        if gm.ENABLE_FLATCACHE:
            # Get all the cloth prims in the Fabric stage
            stage = lazy.omni.isaac.core.utils.stage.get_current_stage(fabric=True)
            selection = stage.SelectPrims(
                require_attrs=[
                    (
                        lazy.usdrt.Sdf.ValueTypeNames.Point3fArray,
                        lazy.usdrt.UsdGeom.Tokens.points,
                        lazy.usdrt.Usd.Access.Read,
                    )
                ],
                require_prim_type="Mesh",
                require_applied_schemas=["PhysxParticleClothAPI"],
                device="cpu",
            )
    
            # Find the index of some particular prim
            paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["PhysxParticleClothAPI"])
            assert selection.GetCount() == len(paths), "Mismatch in number of cloth prims found!"
            this_prim_idx_in_selection = None
            for i, meshPath in enumerate(paths):
                if str(meshPath) == self.prim_path:
                    this_prim_idx_in_selection = i
                    break
            assert this_prim_idx_in_selection is not None, f"Could not find cloth prim at path {self.prim_path}!"
    
            # TODO: Reconsider this version that avoids warp altogether and directly goes from the Fabric array interface to numpy.
            # # Get the fabric array interface (hopefully still version 1) and convert it into a numpy array interface
            # fai = selection.__fabric_arrays_interface__
            # assert fai["version"] == 1, "Got unexpected fabric array interface version!"
            # assert fai["device"] == "cpu", "Got unexpected fabric array interface device!"
            # points_fai = fai["attribs"]["points"]
            # cumulative_len = 0
            # bucket_idx, idx_in_bucket = None, None
            # for list_idx, length in enumerate(points_fai["counts"]):
            #     if this_prim_idx_in_selection < cumulative_len + length:
            #         bucket_idx = list_idx
            #         idx_in_bucket = this_prim_idx_in_selection - cumulative_len
            #         break
            #     cumulative_len += length
            # else:
            #     # This line should never be reached due to the earlier bounds check
            #     raise RuntimeError("Unexpected error in index calculation")
            #
            # # Inside that bucket, what is the sum of all the previous array lengths
            # bucket_array_lengths_ptr = ctypes.cast(points_fai["array_lengths"][bucket_idx], ctypes.POINTER(ctypes.c_int64))  # Is this really int64?
            # bucket_array_lengths = np.ctypeslib.as_array(bucket_array_lengths_ptr, shape=(points_fai["counts"][bucket_idx],))
            # assert bucket_array_lengths[idx_in_bucket] == self._n_particles, "Got unexpected number of positions in this bucket!"
            # start_in_bucket = np.sum(bucket_array_lengths[:idx_in_bucket])
            # end_in_bucket = start_in_bucket + self._n_particles
            # bucket_start_ptr = ctypes.cast(points_fai["pointers"][bucket_idx], ctypes.POINTER(ctypes.c_float))
            # whole_bucket_array = np.ctypeslib.as_array(bucket_start_ptr, shape=(sum(bucket_array_lengths), 3))
            # points_array = whole_bucket_array[start_in_bucket:end_in_bucket]
            # p_local = th.as_tensor(points_array)
    
            # # Launch the kernel on the indexed selection
            # # TODO: Consider parallelizing on GPU
            wp = lazy.warp
            idxes = wp.array([this_prim_idx_in_selection], dtype=wp.int32, device="cpu")
            fabric_points = wp.fabricarray(selection.__fabric_arrays_interface__, "points")[idxes]
            copied_points = wp.zeros(self.n_particles, dtype=wp.vec3f, device="cpu")
            wp.launch(
                get_get_particle_positions_kernel(),
                dim=1,
                inputs=[fabric_points, copied_points, self._n_particles],
                device="cpu",
            )
            p_local = wp.to_torch(copied_points)
        else:
            p_local = vtarray_to_torch(self.get_attribute(attr="points"))
    
        # TODO: Consider passing the particle indices directly to the kernel
        p_local = p_local[idxs] if idxs is not None else p_local
>       p_local_homogeneous = th.cat((p_local, th.ones((p_local.shape[0], 1))), dim=1)
E       IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

omnigibson/prims/cloth_prim.py:281: IndexError

Check failure on line 0 in 12440976406-tests-test_primitives/test_primitives.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_primitives.TestPrimitives ► test_navigate[Tiago]

Failed test found in:
  12440976406-tests-test_primitives/test_primitives.xml
Error:
  self = <test_primitives.TestPrimitives object at 0x7f2edd142230>
Raw output
self = <test_primitives.TestPrimitives object at 0x7f2edd142230>
robot = 'Tiago'

    def test_navigate(self, robot):
        categories = ["floors", "ceilings", "walls"]
        env = setup_environment(categories, robot=robot)
    
        objects = []
        obj_1 = {
            "object": DatasetObject(name="cologne", category="bottle_of_cologne", model="lyipur"),
            "position": [-0.3, -0.8, 0.5],
            "orientation": [0, 0, 0, 1],
        }
        objects.append(obj_1)
    
        primitives = [StarterSemanticActionPrimitiveSet.NAVIGATE_TO]
        primitives_args = [(obj_1["object"],)]
    
>       primitive_tester(env, objects, primitives, primitives_args)

tests/test_primitives.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_primitives.py:82: in primitive_tester
    execute_controller(controller.apply_ref(primitive, *args, attempts=1), env)
tests/test_primitives.py:69: in execute_controller
    for action in ctrl_gen:
omnigibson/action_primitives/starter_semantic_action_primitives.py:518: in apply_ref
    yield from ctrl(*args)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1682: in _navigate_to_obj
    pose = self._sample_pose_near_object(obj, pose_on_obj=pose_on_obj, **kwargs)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1808: in _sample_pose_near_object
    with PlanningContext(self.env, self.robot, self.robot_copy, "simplified") as context:
omnigibson/action_primitives/starter_semantic_action_primitives.py:146: in __enter__
    self._assemble_robot_copy()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.action_primitives.starter_semantic_action_primitives.PlanningContext object at 0x7f2e9ad917e0>

    def _assemble_robot_copy(self):
        if m.TIAGO_TORSO_FIXED:
            fk_descriptor = "left_fixed"
        else:
            fk_descriptor = (
>               "combined" if "combined" in self.robot.robot_arm_descriptor_yamls else self.robot.default_arm
            )
E           AttributeError: 'Tiago' object has no attribute 'robot_arm_descriptor_yamls'

omnigibson/action_primitives/starter_semantic_action_primitives.py:160: AttributeError

Check failure on line 0 in 12440976406-tests-test_primitives/test_primitives.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_primitives.TestPrimitives ► test_navigate[Fetch]

Failed test found in:
  12440976406-tests-test_primitives/test_primitives.xml
Error:
  self = <test_primitives.TestPrimitives object at 0x7f2edd140910>
Raw output
self = <test_primitives.TestPrimitives object at 0x7f2edd140910>
robot = 'Fetch'

    def test_navigate(self, robot):
        categories = ["floors", "ceilings", "walls"]
        env = setup_environment(categories, robot=robot)
    
        objects = []
        obj_1 = {
            "object": DatasetObject(name="cologne", category="bottle_of_cologne", model="lyipur"),
            "position": [-0.3, -0.8, 0.5],
            "orientation": [0, 0, 0, 1],
        }
        objects.append(obj_1)
    
        primitives = [StarterSemanticActionPrimitiveSet.NAVIGATE_TO]
        primitives_args = [(obj_1["object"],)]
    
>       primitive_tester(env, objects, primitives, primitives_args)

tests/test_primitives.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_primitives.py:82: in primitive_tester
    execute_controller(controller.apply_ref(primitive, *args, attempts=1), env)
tests/test_primitives.py:69: in execute_controller
    for action in ctrl_gen:
omnigibson/action_primitives/starter_semantic_action_primitives.py:518: in apply_ref
    yield from ctrl(*args)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1682: in _navigate_to_obj
    pose = self._sample_pose_near_object(obj, pose_on_obj=pose_on_obj, **kwargs)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1808: in _sample_pose_near_object
    with PlanningContext(self.env, self.robot, self.robot_copy, "simplified") as context:
omnigibson/action_primitives/starter_semantic_action_primitives.py:146: in __enter__
    self._assemble_robot_copy()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.action_primitives.starter_semantic_action_primitives.PlanningContext object at 0x7f2e9e395ba0>

    def _assemble_robot_copy(self):
        if m.TIAGO_TORSO_FIXED:
            fk_descriptor = "left_fixed"
        else:
            fk_descriptor = (
>               "combined" if "combined" in self.robot.robot_arm_descriptor_yamls else self.robot.default_arm
            )
E           AttributeError: 'Fetch' object has no attribute 'robot_arm_descriptor_yamls'

omnigibson/action_primitives/starter_semantic_action_primitives.py:160: AttributeError

Check failure on line 0 in 12440976406-tests-test_primitives/test_primitives.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_primitives.TestPrimitives ► test_grasp[Tiago]

Failed test found in:
  12440976406-tests-test_primitives/test_primitives.xml
Error:
  self = <test_primitives.TestPrimitives object at 0x7f2edd140190>
Raw output
self = <test_primitives.TestPrimitives object at 0x7f2edd140190>
robot = 'Tiago'

    def test_grasp(self, robot):
        categories = ["floors", "ceilings", "walls", "coffee_table"]
        env = setup_environment(categories, robot=robot)
    
        objects = []
        obj_1 = {
            "object": DatasetObject(name="cologne", category="bottle_of_cologne", model="lyipur"),
            "position": [-0.3, -0.8, 0.5],
            "orientation": [0, 0, 0, 1],
        }
        objects.append(obj_1)
    
        primitives = [StarterSemanticActionPrimitiveSet.GRASP]
        primitives_args = [(obj_1["object"],)]
    
>       primitive_tester(env, objects, primitives, primitives_args)

tests/test_primitives.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_primitives.py:82: in primitive_tester
    execute_controller(controller.apply_ref(primitive, *args, attempts=1), env)
tests/test_primitives.py:69: in execute_controller
    for action in ctrl_gen:
omnigibson/action_primitives/starter_semantic_action_primitives.py:518: in apply_ref
    yield from ctrl(*args)
omnigibson/action_primitives/starter_semantic_action_primitives.py:743: in _grasp
    yield from self._navigate_if_needed(obj, pose_on_obj=grasp_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1663: in _navigate_if_needed
    if self._target_in_reach_of_robot(pose_on_obj):
omnigibson/action_primitives/starter_semantic_action_primitives.py:913: in _target_in_reach_of_robot
    return self._target_in_reach_of_robot_relative(relative_target_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:925: in _target_in_reach_of_robot_relative
    return self._ik_solver_cartesian_to_joint_space(relative_target_pose) is not None
omnigibson/action_primitives/starter_semantic_action_primitives.py:965: in _ik_solver_cartesian_to_joint_space
    robot_description_path=self._manipulation_descriptor_path,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.action_primitives.starter_semantic_action_primitives.StarterSemanticActionPrimitives object at 0x7f2f9031b130>

    @property
    def _manipulation_descriptor_path(self):
        """The appropriate manipulation descriptor for the current settings."""
        if isinstance(self.robot, Tiago) and m.TIAGO_TORSO_FIXED:
            assert self.arm == "left", "Fixed torso mode only supports left arm!"
            return self.robot.robot_arm_descriptor_yamls["left_fixed"]
    
        # Otherwise just return the default arm control idx
>       return self.robot.robot_arm_descriptor_yamls[self.arm]
E       AttributeError: 'Tiago' object has no attribute 'robot_arm_descriptor_yamls'

omnigibson/action_primitives/starter_semantic_action_primitives.py:950: AttributeError

Check failure on line 0 in 12440976406-tests-test_primitives/test_primitives.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_primitives.TestPrimitives ► test_grasp[Fetch]

Failed test found in:
  12440976406-tests-test_primitives/test_primitives.xml
Error:
  self = <test_primitives.TestPrimitives object at 0x7f2edd141000>
Raw output
self = <test_primitives.TestPrimitives object at 0x7f2edd141000>
robot = 'Fetch'

    def test_grasp(self, robot):
        categories = ["floors", "ceilings", "walls", "coffee_table"]
        env = setup_environment(categories, robot=robot)
    
        objects = []
        obj_1 = {
            "object": DatasetObject(name="cologne", category="bottle_of_cologne", model="lyipur"),
            "position": [-0.3, -0.8, 0.5],
            "orientation": [0, 0, 0, 1],
        }
        objects.append(obj_1)
    
        primitives = [StarterSemanticActionPrimitiveSet.GRASP]
        primitives_args = [(obj_1["object"],)]
    
>       primitive_tester(env, objects, primitives, primitives_args)

tests/test_primitives.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_primitives.py:82: in primitive_tester
    execute_controller(controller.apply_ref(primitive, *args, attempts=1), env)
tests/test_primitives.py:69: in execute_controller
    for action in ctrl_gen:
omnigibson/action_primitives/starter_semantic_action_primitives.py:518: in apply_ref
    yield from ctrl(*args)
omnigibson/action_primitives/starter_semantic_action_primitives.py:743: in _grasp
    yield from self._navigate_if_needed(obj, pose_on_obj=grasp_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1663: in _navigate_if_needed
    if self._target_in_reach_of_robot(pose_on_obj):
omnigibson/action_primitives/starter_semantic_action_primitives.py:913: in _target_in_reach_of_robot
    return self._target_in_reach_of_robot_relative(relative_target_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:925: in _target_in_reach_of_robot_relative
    return self._ik_solver_cartesian_to_joint_space(relative_target_pose) is not None
omnigibson/action_primitives/starter_semantic_action_primitives.py:965: in _ik_solver_cartesian_to_joint_space
    robot_description_path=self._manipulation_descriptor_path,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.action_primitives.starter_semantic_action_primitives.StarterSemanticActionPrimitives object at 0x7f2e973aa5f0>

    @property
    def _manipulation_descriptor_path(self):
        """The appropriate manipulation descriptor for the current settings."""
        if isinstance(self.robot, Tiago) and m.TIAGO_TORSO_FIXED:
            assert self.arm == "left", "Fixed torso mode only supports left arm!"
            return self.robot.robot_arm_descriptor_yamls["left_fixed"]
    
        # Otherwise just return the default arm control idx
>       return self.robot.robot_arm_descriptor_yamls[self.arm]
E       AttributeError: 'Fetch' object has no attribute 'robot_arm_descriptor_yamls'

omnigibson/action_primitives/starter_semantic_action_primitives.py:950: AttributeError

Check failure on line 0 in 12440976406-tests-test_primitives/test_primitives.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results

pytest ► tests.test_primitives.TestPrimitives ► test_place[Tiago]

Failed test found in:
  12440976406-tests-test_primitives/test_primitives.xml
Error:
  self = <test_primitives.TestPrimitives object at 0x7f2edd1414b0>
Raw output
self = <test_primitives.TestPrimitives object at 0x7f2edd1414b0>
robot = 'Tiago'

    def test_place(self, robot):
        categories = ["floors", "ceilings", "walls", "coffee_table"]
        env = setup_environment(categories, robot=robot)
    
        objects = []
        obj_1 = {
            "object": DatasetObject(name="table", category="breakfast_table", model="rjgmmy", scale=[0.3, 0.3, 0.3]),
            "position": [-0.7, 0.5, 0.2],
            "orientation": [0, 0, 0, 1],
        }
        obj_2 = {
            "object": DatasetObject(name="cologne", category="bottle_of_cologne", model="lyipur"),
            "position": [-0.3, -0.8, 0.5],
            "orientation": [0, 0, 0, 1],
        }
        objects.append(obj_1)
        objects.append(obj_2)
    
        primitives = [StarterSemanticActionPrimitiveSet.GRASP, StarterSemanticActionPrimitiveSet.PLACE_ON_TOP]
        primitives_args = [(obj_2["object"],), (obj_1["object"],)]
    
>       primitive_tester(env, objects, primitives, primitives_args)

tests/test_primitives.py:145: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_primitives.py:82: in primitive_tester
    execute_controller(controller.apply_ref(primitive, *args, attempts=1), env)
tests/test_primitives.py:69: in execute_controller
    for action in ctrl_gen:
omnigibson/action_primitives/starter_semantic_action_primitives.py:518: in apply_ref
    yield from ctrl(*args)
omnigibson/action_primitives/starter_semantic_action_primitives.py:743: in _grasp
    yield from self._navigate_if_needed(obj, pose_on_obj=grasp_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:1663: in _navigate_if_needed
    if self._target_in_reach_of_robot(pose_on_obj):
omnigibson/action_primitives/starter_semantic_action_primitives.py:913: in _target_in_reach_of_robot
    return self._target_in_reach_of_robot_relative(relative_target_pose)
omnigibson/action_primitives/starter_semantic_action_primitives.py:925: in _target_in_reach_of_robot_relative
    return self._ik_solver_cartesian_to_joint_space(relative_target_pose) is not None
omnigibson/action_primitives/starter_semantic_action_primitives.py:965: in _ik_solver_cartesian_to_joint_space
    robot_description_path=self._manipulation_descriptor_path,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <omnigibson.action_primitives.starter_semantic_action_primitives.StarterSemanticActionPrimitives object at 0x7f2e925dc910>

    @property
    def _manipulation_descriptor_path(self):
        """The appropriate manipulation descriptor for the current settings."""
        if isinstance(self.robot, Tiago) and m.TIAGO_TORSO_FIXED:
            assert self.arm == "left", "Fixed torso mode only supports left arm!"
            return self.robot.robot_arm_descriptor_yamls["left_fixed"]
    
        # Otherwise just return the default arm control idx
>       return self.robot.robot_arm_descriptor_yamls[self.arm]
E       AttributeError: 'Tiago' object has no attribute 'robot_arm_descriptor_yamls'

omnigibson/action_primitives/starter_semantic_action_primitives.py:950: AttributeError