Matching¶
matching ¶
match_non_overlapping_timestamps ¶
match_non_overlapping_timestamps(
trajectory: Trajectory,
other: Trajectory,
max_distance: float = 0.0,
) -> float
Roughly matches two trajectories temporally.
Parameters:
-
trajectory(Trajectory) –Trajectory to match.
-
other(Trajectory) –Other trajectory to match against.
-
max_distance(float, default:0.0) –Maximum distance for spatial matching. Defaults to 0.0.
Returns:
-
float(float) –Mean time offset.
Source code in trajectopy\processing\matching.py
match_timestamps ¶
match_timestamps(
trajectory: Trajectory,
timestamps: ndarray,
inplace: bool = True,
) -> Trajectory
Truncates trajectory to only those poses where the timestamps exactly match "timestamps".
Parameters:
-
trajectory(Trajectory) –Input trajectory.
-
timestamps(ndarray) –Input timestamps.
-
inplace(bool, default:True) –Perform matching in-place. Defaults to True.
Returns:
-
Trajectory(Trajectory) –Trajectory with matched timestamps.
Source code in trajectopy\processing\matching.py
match_trajectories ¶
match_trajectories(
trajectory: Trajectory,
other: Trajectory,
matching_settings: MatchingSettings = MatchingSettings(),
inplace: bool = True,
) -> Tuple[Trajectory, Trajectory]
Matches two trajectories using the specified method.
Supported methods:
- INTERPOLATION: Interpolates the test trajectory onto the reference trajectory using its timestamps. The interpolation is linear for both positions and rotations (SLERP).
- NEAREST_TEMPORAL: Finds the nearest temporal match without interpolation by finding the nearest timestamp in the target trajectory for each timestamp in the source trajectory.
- NEAREST_SPATIAL: Finds the nearest spatial match without interpolation by finding the nearest pose in the target trajectory for each pose in the source trajectory using Euclidean distance.
- NEAREST_SPATIAL_INTERPOLATED: Finds the nearest k spatial matches and spatially interpolates using a 3d line. Both trajectories will have the length of the test trajectory. This method does not support rotation matching.
Parameters:
-
trajectory(Trajectory) –Trajectory to match.
-
other(Trajectory) –Other trajectory to match against.
-
matching_settings(MatchingSettings, default:MatchingSettings()) –Matching settings. Defaults to MatchingSettings().
-
inplace(bool, default:True) –Whether to modify the input trajectories. Defaults to True.
Returns:
-
Tuple[Trajectory, Trajectory]–Tuple[Trajectory, Trajectory]: Matched trajectories.