兼容py38

This commit is contained in:
liangyuxuan
2025-11-27 17:12:20 +08:00
parent 664652d144
commit 123be317e2
2 changed files with 5 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ from ament_index_python.packages import get_package_share_directory
share_dir = get_package_share_directory('vision_detect')
config_dir = os.path.join(share_dir, 'configs/launch_configs/bottle_detect_service_ica.json')
config_dir = os.path.join(share_dir, 'configs/launch_configs/bottle_detect_service_icp.json')
with open(config_dir, "r") as f:
configs = json.load(f)

View File

@@ -1,5 +1,6 @@
import numpy as np
import open3d as o3d
from typing import Union
def _draw_pointcloud(pcd, T):
@@ -79,10 +80,10 @@ def _execute_global_registration(source_down, target_down, source_fpfh, target_f
def object_icp(
target: o3d.geometry.PointCloud,
source: o3d.geometry.PointCloud | str,
source: Union[o3d.geometry.PointCloud, str],
ransac_voxel_size: float = 0.005,
icp_voxel_radius: list[float] | tuple[float] | None = (0.004, 0.002, 0.001),
icp_max_iter: list[int] | tuple[int] | None = (50, 30, 14),
icp_voxel_radius: Union[list[float], tuple[float], None] = (0.004, 0.002, 0.001),
icp_max_iter: Union[list[int], tuple[int], None] = (50, 30, 14),
):
if isinstance(source, str):
source = o3d.io.read_point_cloud(source)