ORB_SLAM2
ORB_SLAM2 copied to clipboard
Interpreting the KeyFrameTrajectory.txt file
Hi everyone
I used a drone dataset from NPU Drone-Map Dataset and it has GPS trajectory of the flight. After using ORB-SLAM2 on this dataset, I would like to plot the GPS data together with the KeyFrameTrajectory.txt data to see if they correspond.
My challenge now is that I dont know how to interpret data from this KeyFrameTrajectory.txt file. I'm not that sure myself that what I wanna do is doable.
I need like (x,y,z) co-odinates from this file.
Can someone please help me on this.
below is a sample of what is in my KeyFrameTrajectory.txt file.....and I don't know what is what. Thank you.
1305031102.170000 0.0365327 -1.4422618 -0.0842586 -0.0011281 0.0000323 0.0284874 0.9995935 1305031102.170000 0.0345594 -1.5336652 -0.0918721 0.0012357 0.0007751 0.0287673 0.9995851 1305031102.170000 0.0341972 -1.5458909 -0.0928111 0.0015669 0.0010044 0.0287377 0.9995853 1305031102.170000 0.0304142 -1.6184912 -0.0992637 0.0033218 0.0024995 0.0287309 0.9995785 1305031102.170000 0.0253411 -1.6931344 -0.1061403 0.0038579 0.0046472 0.0283241 0.9995806 1305031102.170000 0.0245110 -1.7027667 -0.1081518 0.0052676 0.0050030 0.0282190 0.9995754
Did you get any solution for this? I am also stuck at this point
This is the trajectory (timestamps + 3D poses) that was estimated by the SLAM algorithm. More specifically, it has only the poses of the keyframes. It's saved in the file format that was introduced by the TUM RGB-D dataset ("TUM format", see https://vision.in.tum.de/data/datasets/rgbd-dataset/file_formats).
Every row has 8 entries containing timestamp (in seconds), position and orientation (as quaternion):
timestamp x y z q_x q_y q_z q_w
So to achieve what you want to do, you could for example load the file as a table (similar to a .csv file) and then the columns 2 to 4 are your x, y, z values (or 1 to 3 if you count from 0).
Maybe also useful for you: I made a Python package for SLAM trajectories (see here), it has executables that can parse files in the TUM format - e.g. you could inspect and plot your file with the command:
evo_traj tum KeyframeTrajectory.txt --plot
@MichaelGrupp Thank you very much!
@akashshar @Gasethata I also tried to combine GPS data with KeyFrameTrajectory.txt data,Have you solved this problem?
@NeXT1995
I plotted each of them separately...which of-cause can be combined in a single plane. I used matlab for the plotting.
For KeyFrameTrajectory data (x,y,z) co-ordinates are the first three columns in the file (excluding the names of the image in the first column).
Below is an example of the GPS [left] data and the KeyFrameTrajectory [right]....from NPU Dataset

And for GPS data, I again used matlab to extract only the (x,y,z) co-ordinates in each line, then store those in a file to use to plot.
Hi, i am doing the same by running orbslam on my jetson tx2. The script is awesome. But the thing is it works only with the stored file. Is it not possible to have some sort of socket programming so that x,y,z can be plot realtime on my desktop through socket? Is it possible?
Thanks for you sharing, when I input "evo_traj tum KeyframeTrajectory.txt --plot" in the command line in Ubuntu16.04, unexpected error occurred as blow:
name: KeyFrameTrajectory18112903
infos: 86 poses, 1.429m path length, 217.468s duration
Unhandled error in evo.main_traj
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/init.py", line 36, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zz/.local/lib/python3.5/site-packages/evo/entry_points.py", line 89, in launch
main_module.run(args)
File "/home/zz/.local/lib/python3.5/site-packages/evo/main_traj.py", line 339, in run
from evo.tools.plot import PlotMode
File "/home/zz/.local/lib/python3.5/site-packages/evo/tools/plot.py", line 35, in
evo module evo.main_traj crashed - no logfile written (disabled) //////////////////////////////////////////////////////////////////////////////////////// I spent a lot of time solving the problem,but now I can't solve it by myself. I wish you answer,if you know. thanks a lot in advance!!
ImportError: No module named '_tkinter', please install the python3-tk package
It's already saying what you need to do. Try something like this: https://askubuntu.com/a/950707
Hi, i am doing the same by running orbslam on my jetson tx2. The script is awesome. But the thing is it works only with the stored file. Is it not possible to have some sort of socket programming so that x,y,z can be plot realtime on my desktop through socket? Is it possible?
I'd use ROS and RViz or something like rqt_plot for real-time visualization.
Can we bypass SLAM to produce trajectory file with timestamp and other 7 parameters if we have GPS information, Altitude of Quadcopter and also roll pitch & yaw??
Hello Michael whenever I am trying to plot the trajectories I am facing following error which is leaving me in perplexed situation. Please help accordingly. Thanks in Advance. Kuntal name: s2-KeyFrameTrajectory infos: 296 poses, 6.849m path length, 147.197s duration [ERROR] Unhandled error in evo.main_traj Traceback (most recent call last): File "/home/kuntal/.local/lib/python3.5/site-packages/evo/entry_points.py", line 92, in launch main_module.run(args) File "/home/kuntal/.local/lib/python3.5/site-packages/evo/main_traj.py", line 464, in run plot_collection.show() File "/home/kuntal/.local/lib/python3.5/site-packages/evo/tools/plot.py", line 194, in show self.tabbed_tk_window() File "/home/kuntal/.local/lib/python3.5/site-packages/evo/tools/plot.py", line 151, in tabbed_tk_window from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk ImportError: cannot import name 'NavigationToolbar2Tk'
[ERROR] evo module evo.main_traj crashed - no logfile written (disabled)
You need to update matplotlib to a newer version
Good day. How can I check the distance in meters from the keyframe to the real one?
Thanks
Can we bypass SLAM to produce trajectory file with timestamp and other 7 parameters if we have GPS information, Altitude of Quadcopter and also roll pitch & yaw??
were you able to do this?
您好,你的邮件,杨沂林已经收到,我会尽快查收的,谢谢!
Hi @All
Can i use KeyframeTrajectory.txt data to add coordinates of previous keyframes to next image such as image below
Thanks
您好,你的邮件,杨沂林已经收到,我会尽快查收的,谢谢!