UsdGeom.Mesh(mesh_prim).GetPointsAttr().Get() returns 0 length mesh in offline_pose_generation.py

I am observing the following error when running offline_pose_generation.py with a custom object.
This is based on: 6. Offline Pose Estimation Synthetic Data Generation — Omniverse Robotics documentation

Traceback (most recent call last):
File “./d3_offline_pose_generation.py”, line 664, in
test=args.test,
File “./d3_offline_pose_generation.py”, line 155, in init
self._setup_world()
File “./d3_offline_pose_generation.py”, line 366, in _setup_world
self.writer_helper.save_mesh_vertices(mesh_prim, coord_prim, prim_type, self._output_folder)
File “/data/omniverse/library/isaac_sim-2022.2.0/exts/omni.replicator.isaac/omni/replicator/isaac/scripts/writers/ycb_video_writer.py”, line 184, in save_mesh_vertices
points = get_mesh_vertices_relative_to(mesh_prim, coord_prim)
File “/data/omniverse/library/isaac_sim-2022.2.0/exts/omni.isaac.core/omni/isaac/core/utils/mesh.py”, line 36, in get_mesh_vertices_relative_to
vertices_tf_row_major = np.pad(vertices, ((0, 0), (0, 1)), constant_values=1.0)
File “<array_function internals>”, line 6, in pad
File “/data/omniverse/library/isaac_sim-2022.2.0/kit/extscore/omni.kit.pip_archive/pip_prebundle/numpy/lib/arraypad.py”, line 743, in pad
pad_width = _as_pairs(pad_width, array.ndim, as_index=True)
File “/data/omniverse/library/isaac_sim-2022.2.0/kit/extscore/omni.kit.pip_archive/pip_prebundle/numpy/lib/arraypad.py”, line 518, in _as_pairs
return np.broadcast_to(x, (ndim, 2)).tolist()
File “<array_function internals>”, line 6, in broadcast_to
File “/data/omniverse/library/isaac_sim-2022.2.0/kit/extscore/omni.kit.pip_archive/pip_prebundle/numpy/lib/stride_tricks.py”, line 411, in broadcast_to
return _broadcast_to(array, shape, subok=subok, readonly=True)
File “/data/omniverse/library/isaac_sim-2022.2.0/kit/extscore/omni.kit.pip_archive/pip_prebundle/numpy/lib/stride_tricks.py”, line 350, in _broadcast_to
op_flags=[‘readonly’], itershape=shape, order=‘C’)
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (2,2) and requested shape (0,2)
2023-02-01 22:38:02 [22,460ms] [Warning] [carb.audio.context] 1 contexts were leaked
/data/omniverse/library/isaac_sim-2022.2.0/python.sh: line 41: 15662 Segmentation fault (core dumped) $python_exe “$@” $args
There was an error running python

I found that this is because the following lines in mesh.py return a 0 length array:
vertices_vec3f = UsdGeom.Mesh(mesh_prim).GetPointsAttr().Get()
vertices = np.array(vertices_vec3f)

This only occurs when running offline_pose_generation.py with the ycb_video writer. If I switch to the DOPE writer, it does not occur. Similarly, if I comment out the call to “writer_helper.save_mesh_vertices()” in offline_pose_generation.py, the error does not occur, and images are generated.

Fixed this by moving the object mesh to be a direct child of the root prim, rather than the default where it’s nested through an additional Xform.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.