opr.pipelines.localization package

Hierarchical localization pipelines.

opr.pipelines.localization.aruco

ArucoPlaceRecognitionPipeline pipeline.

class opr.pipelines.localization.aruco.ArucoLocalizationPipeline(place_recognition_pipeline: PlaceRecognitionPipeline, registration_pipeline: PointcloudRegistrationPipeline, aruco_metadata: Dict, camera_metadata: Dict, precomputed_reg_feats: bool = False, pointclouds_subdir: str | PathLike | None = None, fastest: bool = True, use_first_marker: bool = True)[source]

Bases: LocalizationPipeline

ArucoLocalizationPipeline pipeline.

aruco_part(input_data: Dict[str, Tensor]) ndarray[source]

Single aruco inference.

Parameters:

input_data (Dict[str, Tensor]) –

Input data. Dictionary with keys in the following format:

”image_{camera_name}” for images from cameras,

”mask_{camera_name}” for semantic segmentation masks,

”pointcloud_lidar_coords” for pointcloud coordinates from lidar,

”pointcloud_lidar_feats” for pointcloud features from lidar.

Returns:

predicted pose in the format [tx, ty, tz, qx, qy, qz, qw],

Return type:

np.ndarray

infer(input_data: Dict[str, Tensor]) Dict[str, ndarray][source]

Single sample inference.

Parameters:

input_data (Dict[str, Tensor]) –

Input data. Dictionary with keys in the following format:

”image_{camera_name}” for images from cameras,

”mask_{camera_name}” for semantic segmentation masks,

”pointcloud_lidar_coords” for pointcloud coordinates from lidar,

”pointcloud_lidar_feats” for pointcloud features from lidar.

Returns:

Inference results. Dict with dictionaries:

”pose_by_aruco”: “pose” for predicted pose in the format [tx, ty, tz, qx, qy, qz, qw],

”pose_by_place_recognition”: “pose” for predicted pose in the format [tx, ty, tz, qx, qy, qz, qw].

Return type:

Dict[str, Dict[str, np.ndarray]]

loc_part(input_data: Dict[str, Tensor]) ndarray[source]

Single localization inference.

Parameters:

input_data (Dict[str, Tensor]) –

Input data. Dictionary with keys in the following format:

”image_{camera_name}” for images from cameras,

”mask_{camera_name}” for semantic segmentation masks,

”pointcloud_lidar_coords” for pointcloud coordinates from lidar,

”pointcloud_lidar_feats” for pointcloud features from lidar.

Returns:

predicted pose in the format [tx, ty, tz, qx, qy, qz, qw],

Return type:

np.ndarray

opr.pipelines.localization.aruco.pose_to_matrix(pose)[source]

From the 6D poses in the [tx ty tz qx qy qz qw] format to 4x4 pose matrices.

opr.pipelines.localization.base

Hierarchical Localization Pipeline.

class opr.pipelines.localization.base.LocalizationPipeline(place_recognition_pipeline: PlaceRecognitionPipeline, registration_pipeline: PointcloudRegistrationPipeline | SequencePointcloudRegistrationPipeline, precomputed_reg_feats: bool = False, pointclouds_subdir: str | PathLike | None = None)[source]

Bases: object

Hierarchical Localization Pipeline.

The task of localiation is solved in two steps: 1. Find the best match for the query in the database (Place Recognition). 2. Refine the pose estimate using the query and the database match (Registration).

compute_reg_features(save_dir: str | PathLike, pointclouds_dir: str | PathLike) None[source]

Compute registration features for the database.

Parameters:
  • save_dir (str | PathLike) – Directory to save the features.

  • pointclouds_dir (str | PathLike) – Directory where pointclouds will be saved.

infer(input_data: Dict[str, Tensor] | list[Dict[str, Tensor]]) Dict[str, ndarray][source]

Single sample inference.

Parameters:

input_data (Dict[str, Tensor]) –

Input data. Dictionary with keys in the following format:

”image_{camera_name}” for images from cameras,

”mask_{camera_name}” for semantic segmentation masks,

”pointcloud_lidar_coords” for pointcloud coordinates from lidar,

”pointcloud_lidar_feats” for pointcloud features from lidar.

Returns:

Inference results. Dictionary with keys:

”db_match_pose” for database match pose in the format [tx, ty, tz, qx, qy, qz, qw],

”estimated_pose” for estimated pose in the format [tx, ty, tz, qx, qy, qz, qw].

Return type:

Dict[str, np.ndarray]

Raises:
  • ValueError – Provided input data is a list, but the pipeline is not for sequences.

  • ValueError – Provided input data is not a list, but the pipeline is for sequences.