UZ-SLAMLab / ORB_SLAM3

ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and Multi-Map SLAM
GNU General Public License v3.0
6.59k stars 2.56k forks source link

Help understanding trajectory output #658

Open esteimle opened 2 years ago

esteimle commented 2 years ago

Hi, I was trying to use ORBSLAM3 to track my height as I move around. I have an intel real-sense D435i and I've tried stereo, stereo-inertial, and RGB-D. I modified the examples to output either Euroc or TUM trajectory data after I shut-down. I'm not sure I understand how to convert this trajectory to real-world coordinates in meters. I tried plotting the TUM data x,y,z data (columns 1,2,3 in the output). If I plot x and z with each other it looks like the shape I just walked, and plotting y "could" be the height, actually it looks upside down to me (maybe it is).

I was hoping someone who understands could explain to me how I go from the trajectory output to the real-coordinates. Having the origin be wherever the camera starts is fine, and having to measure that height to start is no problem. But I wasn't sure if I was supposed to be trying to rotate the output, or figure out where gravity was etc.

Thanks for any help!

TakShimoda commented 1 year ago

Explained in a paper like here, in section 3A, there are ambiguities in sensing modalities. For a stereo setup, there are ambiguities related to rigid-body rotation, so the output trajectory is different from ground-truth by an SE(3) transformation. For an IMU, 3D translation and yaw-only rotation (around gravity) gives ambiguity. Therefore, a visual-inertial system has 4 unobservable degrees of freedom (3D translation and yaw-only rotation, which is taken care of if your system rotates in the pitch/roll angles enough). To align with the ground-truth, use a tool like evo to plot and align trajectories with a command such as evo_traj tum <output file in TUM format> --ref <ground truth in TUM> -p --plot_mode=xyz -vaswhere the "as" flags in the command tells it to both scale and align the estimate trajectory with ground-truth.

I don't know how to do it without ground-truth, but if an accelerometer is at rest, it will only measure gravity so I guess you can try using that to see how it's oriented.