You can use evo for 2D and 3D visualization of SLAM trajectories, especially if you’re handling data in formats commonly used in robotics and SLAM, such as TUM, KITTI, or Euroc. Evo is a popular Python tool for the evaluation and comparison of SLAM systems that provides several utilities for visualizing and analyzing the performance of trajectories.
What is Evo?
Evo (short for “evaluation”) is specifically designed for the purpose of SLAM analysis and is well-suited for handling, comparing, and visualizing trajectory data. It supports different metrics like Absolute Trajectory Error (ATE) and Relative Pose Error (RPE), among others.
How to Use Evo for 2D Trajectory Visualization
Here’s a basic guide on how to use evo for visualizing 2D trajectories:
Step 1: Install Evo
If you haven’t installed evo yet, you can install it using pip:
pip install evo --upgrade --no-binary evo
Step 2: Prepare Your Trajectory Data
Make sure your trajectory data is in a format supported by evo, such as TUM, KITTI, or a simple CSV format. Here is an example of the TUM format, which is a simple space-separated text file with timestamps and x, y, z, qx, qy, qz, qw (position and quaternion orientation):
timestamp x y z qx qy qz qw
1.0 1.0 2.0 0.0 0.0 0.0 0.0 1.0
2.0 1.1 2.1 0.0 0.0 0.0 0.0 1.0
...
Step 3: Run Evo for Visualization
You can run evo directly from the command line to visualize the trajectory. For a simple 2D plot, you might not care about the z-axis or the orientation, focusing only on the x and y positions.
Here’s how you might visualize a trajectory file named trajectory.tum
:
evo_traj tum trajectory.tum --plot --plot_mode=xz
Use the --plot_mode
flag to specify which axes to plot (e.g., xy
, xz
, xyz
etc.). For strictly 2D, xy
is typically what you want.
Step 4: Compare and Analyze
If you have multiple trajectories to compare, evo can handle this easily. Just pass multiple files to evo_traj
:
evo_traj tum trajectory1.tum trajectory2.tum --plot --plot_mode=xy --ref=trajectory1.tum
This command will plot both trajectories in the same plot for easy comparison.
Step 5: Save Plots
You can save the plots generated by evo using the --save_plot
flag to specify a file path where the plot should be saved:
evo_traj tum trajectory.tum --plot --plot_mode=xy --save_plot plot.png
Conclusion
Evo is particularly useful when you need to evaluate the accuracy and performance of SLAM algorithms, offering not only visualization but also statistical analysis tools. Its ability to handle different formats and compare multiple trajectories makes it a versatile tool for researchers and engineers working in robotics and SLAM.