(filename: str, runs: list[tuple[PlotableTrajectory | None, PlotableTrajectory]])
| 62 | |
| 63 | |
| 64 | def plot_runs(filename: str, runs: list[tuple[PlotableTrajectory | None, PlotableTrajectory]]): |
| 65 | trajectories: list[PlotableTrajectory] = [] |
| 66 | for run in runs: |
| 67 | gt_traj, est_traj = run |
| 68 | |
| 69 | odom_name = est_traj.name.split("@")[0] |
| 70 | est_traj.plot_kwargs |= {"color": EXP2COLOR[odom_name]} |
| 71 | est_traj.plot_kwargs |= EXP2KWARGS[odom_name] |
| 72 | est_traj.name = odom_name |
| 73 | |
| 74 | trajectories.append(est_traj) |
| 75 | |
| 76 | for run in runs: |
| 77 | gt_traj, _ = runs[0] |
| 78 | if gt_traj is not None: break |
| 79 | else: |
| 80 | raise Exception("No Groundtruth Trajectory provided!") |
| 81 | |
| 82 | gt_traj.plot_kwargs |= {"color": "gray", "linewidth": 4, "linestyle": "--"} |
| 83 | gt_traj.name = "Ground Truth" |
| 84 | |
| 85 | aligned_trajectories = [] |
| 86 | for traj in trajectories: |
| 87 | gt_cropped = gt_traj.apply(lambda x: x.crop(to_idx=traj.data.length)) |
| 88 | traj_aligned = traj.apply(lambda x: x.align_scale(gt_cropped.data).align_origin(gt_cropped.data)) |
| 89 | aligned_trajectories.append(traj_aligned) |
| 90 | |
| 91 | PlotTrajectory(gt_traj, aligned_trajectories, Path(filename)) |
| 92 | |
| 93 | |
| 94 | def PlotTrajectory(gt_traj: PlotableTrajectory, trajs: list[PlotableTrajectory], file_name: Path): |
no test coverage detected