Skip to content

Commit

Permalink
Merge branch 'master' into emmanuelmess/feature/umeyama_on_time_window
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelMess authored Jan 6, 2025
2 parents b1aec93 + bafb629 commit 90e1a4b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion evo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

PACKAGE_BASE_PATH = Path(__file__).absolute().parent

__version__ = "v1.30.3"
__version__ = "v1.30.4"


class EvoException(Exception):
Expand Down
4 changes: 2 additions & 2 deletions evo/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def filter_pairs_by_index(poses: typing.Sequence[np.ndarray], delta: int,
:return: list of index tuples of the filtered pairs
"""
if all_pairs:
ids = np.arange(len(poses))
ids = np.arange(len(poses), dtype=int)
id_pairs = [(i, i + delta) for i in ids if i + delta < len(poses)]
else:
ids = np.arange(0, len(poses), delta)
ids = np.arange(0, len(poses), delta, dtype=int)
id_pairs = [(i, j) for i, j in zip(ids, ids[1:])]
return id_pairs

Expand Down
2 changes: 1 addition & 1 deletion evo/core/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def transform(self, t: np.ndarray, right_mul: bool = False,
self._poses_se3 = [np.dot(p, t) for p in self.poses_se3]
elif right_mul and propagate:
# Transform each pose and propagate resulting drift to the next.
ids = np.arange(0, self.num_poses, 1)
ids = np.arange(0, self.num_poses, 1, dtype=int)
rel_poses = [
lie.relative_se3(self.poses_se3[i], self.poses_se3[j]).dot(t)
for i, j in zip(ids, ids[1:])
Expand Down
8 changes: 4 additions & 4 deletions evo/main_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def run(args: argparse.Namespace) -> None:
# handle NaNs from concat() above
error_df.interpolate(method="index", limit_area="inside").plot(
ax=fig_raw.gca(), colormap=colormap, style=linestyles,
title=first_title, alpha=SETTINGS.plot_trajectory_alpha)
title=first_title, alpha=SETTINGS.plot_trajectory_alpha,
legend=SETTINGS.plot_show_legend)
plt.xlabel(index_label)
plt.ylabel(metric_label)
plt.legend(frameon=True)
plot_collection.add_figure("raw", fig_raw)

# statistics plot
Expand All @@ -200,9 +200,9 @@ def run(args: argparse.Namespace) -> None:
include = df.loc["stats"].index.isin(SETTINGS.plot_statistics)
if any(include):
df.loc["stats"][include].plot(kind="barh", ax=fig_stats.gca(),
colormap=colormap, stacked=False)
colormap=colormap, stacked=False,
legend=SETTINGS.plot_show_legend)
plt.xlabel(metric_label)
plt.legend(frameon=True)
plot_collection.add_figure("stats", fig_stats)

# grid of distribution plots
Expand Down
6 changes: 4 additions & 2 deletions evo/main_traj.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ def run(args):
style=SETTINGS.plot_reference_linestyle,
color=SETTINGS.plot_reference_color,
alpha=SETTINGS.plot_reference_alpha,
label=short_traj_name)
label=short_traj_name,
start_timestamp=start_time)
except trajectory.TrajectoryException as error:
logger.error(
f"Can't plot speeds of {short_traj_name}: {error}")
Expand Down Expand Up @@ -416,7 +417,8 @@ def run(args):
style=SETTINGS.plot_trajectory_linestyle,
color=color,
alpha=SETTINGS.plot_trajectory_alpha,
label=short_traj_name)
label=short_traj_name,
start_timestamp=start_time)
except trajectory.TrajectoryException as error:
logger.error(
f"Can't plot speeds of {short_traj_name}: {error}")
Expand Down
17 changes: 13 additions & 4 deletions evo/tools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ def traj_colormap(ax: Axes, traj: trajectory.PosePath3D, array: ListOrArray,
"{0:0.3f}".format(max_map)
])
if title:
ax.legend(frameon=True)
ax.set_title(title)
if SETTINGS.plot_show_legend:
ax.legend(frameon=True)
if plot_start_end_markers:
add_start_end_markers(ax, plot_mode, traj, start_color=colors[0],
end_color=colors[-1])
Expand Down Expand Up @@ -652,7 +653,8 @@ def traj_rpy(axarr: np.ndarray, traj: trajectory.PosePath3D, style: str = '-',


def speeds(ax: Axes, traj: trajectory.PoseTrajectory3D, style: str = '-',
color="black", label: str = "", alpha: float = 1.):
color="black", label: str = "", alpha: float = 1.,
start_timestamp: typing.Optional[float] = None):
"""
Plots the speed between poses of a trajectory.
Note that a speed value is shown at the timestamp of the newer pose.
Expand All @@ -662,10 +664,16 @@ def speeds(ax: Axes, traj: trajectory.PoseTrajectory3D, style: str = '-',
:param color: matplotlib color
:param label: label (for legend)
:param alpha: alpha value for transparency
:param start_timestamp: optional start time of the reference
(for x-axis alignment)
"""
if not isinstance(traj, trajectory.PoseTrajectory3D):
raise PlotException("speeds can only be plotted with trajectories")
ax.plot(traj.timestamps[1:], traj.speeds, style, color=color, alpha=alpha,
if start_timestamp:
timestamps = traj.timestamps - start_timestamp
else:
timestamps = traj.timestamps
ax.plot(timestamps[1:], traj.speeds, style, color=color, alpha=alpha,
label=label)
ax.set_xlabel("$t$ (s)")
ax.set_ylabel("$v$ (m/s)")
Expand Down Expand Up @@ -780,7 +788,8 @@ def error_array(ax: Axes, err_array: ListOrArray,
plt.ylabel(ylabel if ylabel else name)
plt.xlabel(xlabel)
plt.title(title)
plt.legend(frameon=True)
if SETTINGS.plot_show_legend:
plt.legend(frameon=True)


def ros_map(
Expand Down
2 changes: 1 addition & 1 deletion evo/tools/settings_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_default_plot_backend() -> str:
"Can also be set to 'none'.")
),
"plot_figsize": (
[6, 6],
[10, 10],
"The default size of one (sub)plot figure (width, height)."
),
"plot_fontfamily": (
Expand Down

0 comments on commit 90e1a4b

Please sign in to comment.