o3d_utils¶
- real_robot.utils.lib3d.o3d_utils.convert_mesh_format(mesh_path: str | Path, export_suffix='.glb') str[source]¶
Convert mesh format to glb for open3d.io.read_triangle_model()
- real_robot.utils.lib3d.o3d_utils.load_geometry(path: str | ~pathlib.Path, *, logger=<Logger real_robot (NOTSET)>) TriangleMeshModel | PointCloud | None[source]¶
Load a geometry from file as an Open3D geometry
- Parameters:
path – path to a geometry file supported by open3d. https://www.open3d.org/docs/release/tutorial/geometry/file_io.html
- real_robot.utils.lib3d.o3d_utils.load_urdf_geometries(urdf_path: str | ~pathlib.Path, *, skip_links: list[str] | None = None, qpos: ~numpy.ndarray | None = None, base_pose: ~numpy.ndarray = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), return_pose: bool = False, merge: bool = False, logger=<Logger real_robot (NOTSET)>) tuple[URDF, dict[str, tuple[TriangleMeshModel, ndarray] | TriangleMeshModel] | TriangleMeshModel][source]¶
Load a robot geometries from a URDF file
- Parameters:
urdf_path – path to a URDF file.
skip_links – names of links to skip loading.
qpos – robot joint positions. If None, all joints are at zero positions.
base_pose – T_world_urdfbase pose, [4, 4] np.floating np.ndarray
return_pose – Whether to return the geometries pose in world frame instead of applying the pose transformation to the geometries.
merge – Whether to merge the geometries into a single rendering.TriangleMeshModel.
- real_robot.utils.lib3d.o3d_utils.merge_geometries(geometries: list[Geometry3D] | list[Geometry] | list[TriangleMeshModel]) Geometry3D | Geometry | TriangleMeshModel[source]¶
Merge a list of o3d geometries, must be of same type
- real_robot.utils.lib3d.o3d_utils.np2pcd(points: ndarray[tuple[_N, Literal[3]], dtype[floating]] | PointCloud, colors: ndarray[tuple[_N, Literal[3]], dtype[floating]] | None = None, normals: ndarray[tuple[_N, Literal[3]], dtype[floating]] | None = None) PointCloud[source]¶
Convert numpy array to open3d PointCloud.
- real_robot.utils.lib3d.o3d_utils.sample_pcd_from_mesh(mesh: TriangleMesh | TriangleMeshModel, number_of_points: int = 100, method: str = 'uniform', use_triangle_normal: bool = False, seed: int | None = None, **kwargs) PointCloud[source]¶
Sample points from an Open3D mesh
- Parameters:
mesh – an Open3D TriangleMesh or rendering.TriangleMeshModel.
number_of_points – number of points to sample.
method – “uniform” or “poisson_disk”. * uniform: sample uniformly (faster). * poisson_disk: sample such that each point has approximately the same distance to the neighbouring points (slower).
use_triangle_normal – If True, assigns the triangle normals instead of the interpolated vertex normals to the returned points. The triangle normals will be computed and added to the mesh if necessary.
seed – If not None, set Open3D’s random seed.
kwargs – additional kwargs for sample_points_poisson_disk(): init_factor=5, pcl=None.