MichaelGrupp / evo

Python package for the evaluation of odometry and SLAM
https://michaelgrupp.github.io/evo/
GNU General Public License v3.0
3.33k stars 745 forks source link

--save_as_tum generates a .tum file with numbers all containing scientific notations. How to suppress scientific notations? Why modification to file_interface.py does nothing? #589

Closed Mechazo11 closed 10 months ago

Mechazo11 commented 10 months ago

Description: Hello. I am trying to convert the ground-truth data from the sequence MH04 in EuRoC MAV to a TUM compatible .txt file for comparison to a modified ORB SLAM 3's estimated keyframe positions. But the output of the modified .tum file does not match the output format used by ORB SLAM3. As a result, when I try to align the two trajectories to compute metrics using evo, I am getting an error stating that the two trajectories cannot be synchronized. I suspect the format of the timesteps in the two files are different enough to be causing a numerical issue.

Initially I had a lot of trouble installing evo directly from the source file but figured how to do so by following https://github.com/MichaelGrupp/evo/issues/527. I wanted a version where I can play around with your code and modify something if required.

When I use evo_traj euroc MH04_GT.csv --save_as_tum the generated .tum file contains all numbers in scientific notation.

After some searching I believe the line np.savetxt(file_path, mat, delimiter=" ") under the def write_tum_trajectory_file(file_path, traj: PoseTrajectory3D, confirm_overwrite: bool = False) -> None function in the file_interface.py file is responsible for creating the TUM formatted text file from the EuRoC csv. Please correct me if I was wrong in this step.

I started by change the above line to np.savetxt(file_path, mat, delimiter=" ", fmt = '%10.5f') but the change did nothing.

As a sanity check I even modified the if isinstance(file_path, str): logger.info("Trajectory SAVED to: " + file_path) line in the write_tum_trajectory_file function where the word saved was changed to SAVED. Still nothing happens when I use evo_traj euroc ... --save_as_tum command.

How do I suppress the scientific notification to match the output format as used by ORB SLAM 3? Why the above changes were not reflected?

All pertinent files are attached to replicate the issue. All the files were placed inside the base folder.

Thank you for your time With best, @Mechazo11

Command:

sudo python3 -m pip install --editable . --upgrade --no-binary evo [Initial installation]
export PATH="$HOME/.local/bin:$PATH" [Without it I get the error no module named 'evo' ]
evo_traj euroc MH04_GT.csv --save_as_tum
evo_ape tum MH04_GT.txt MH04_test.txt

Console output: [ERROR] found no matching timestamps between MH04_GT.txt and MH04_test.txt with max. time diff 0.01 (s) and time offset 0.0 (s)

Additional files: MH04_GT.csv MH04_GT.txt MH04_test.txt

Please give

also the following information:

{ "console_logging_format": "%(message)s", "euler_angle_sequence": "sxyz", "global_logfile_enabled": false, "plot_axis_marker_scale": 0.0, "plot_backend": "Qt5Agg", "plot_figsize": [ 6, 6 ], "plot_fontfamily": "sans-serif", "plot_fontscale": 1.0, "plot_invert_xaxis": false, "plot_invert_yaxis": false, "plot_linewidth": 1.5, "plot_mode_default": "xyz", "plot_multi_cmap": "none", "plot_pose_correspondences": false, "plot_pose_correspondences_linestyle": "dotted", "plot_reference_alpha": 0.5, "plot_reference_axis_marker_scale": 0.0, "plot_reference_color": "black", "plot_reference_linestyle": "--", "plot_seaborn_palette": "deep6", "plot_seaborn_style": "darkgrid", "plot_show_axis": true, "plot_show_legend": true, "plot_split": false, "plot_start_end_markers": false, "plot_statistics": [ "rmse", "median", "mean", "std", "min", "max" ], "plot_texsystem": "pdflatex", "plot_trajectory_alpha": 0.75, "plot_trajectory_cmap": "jet", "plot_trajectory_length_unit": "m", "plot_trajectory_linestyle": "-", "plot_usetex": false, "plot_xyz_realistic": true, "pygments_style": "monokai", "ros_map_alpha_value": 1.0, "ros_map_cmap": "Greys_r", "ros_map_enable_masking": true, "ros_map_unknown_cell_value": 205, "ros_map_viewport": "keep_unchanged", "save_traj_in_zip": false, "table_export_data": "stats", "table_export_format": "csv", "table_export_transpose": true, "tf_cache_lookup_frequency": 10, "tf_cache_max_time": 10000.0 }

Mechazo11 commented 10 months ago

Apparently the issue was the estimated trajectory in TUM mode requires the timesteps to be in seconds. Following the fix suggested here https://github.com/MichaelGrupp/evo/issues/12, I got the synchronization issue fixed. I am still wondering why any changes made to the core files doesn't do anything.