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.65k stars 2.57k forks source link

Relocalization issue in Localization mode #377

Open UltiFix opened 3 years ago

UltiFix commented 3 years ago

Appears that in localization mode if you cover the camera for a few seconds then uncover it, it does not properly relocalize. After some digging it seems like the mState variable is never updated from RECENTLY_LOST to LOST when in localization mode.

I took code from elsewhere in the program and added a check to update mState (may have done it wrong), but if mState does go to LOST while in localization mode it causes other issues, hangs on waiting for a map reset.

A jank solution (maybe? not sure of side effects but seems to keep it from never relocalizing again) is the following...

In tracking.cc line 1894 make following change //if(mState==LOST) to if(mState==RECENTLY_LOST && !bOK && mCurrentFrame.mTimeStamp-mTimeStampLost>time_recently_lost_visual)

for V0.4: Beta version, 21 April 2021

TEFMA commented 3 years ago

Hi, @UltiFix

I tested the localization mode and met the issue similar with yours. For Euroc dataset, firstly, I ran the code in SLAM mode and saved the created map to disk. And then, I ran it in localization mode (only tracking) using the same Euroc dataset after loading the saved map. And found that in "ORB-SLAM3: Current Frame" window, there were green keypoints at the beginning, but blue keypoints later, and then the tracking failed.

Have you encountered such a issue?

UltiFix commented 3 years ago

It's been a little bit since I worked on thus, but if I recall correctly the issue was that when in localization mode if tracking was lost, it would stop trying to relocalize again. An example, let's say you cover the camera for a few seconds and it looses its position, then you uncover the camera and it will never relocalize.

I fixed (a jank fix but it seems to work) this in a copy of the repo I made, It should be publicly available.

On Fri, Oct 22, 2021, 4:02 AM TEFMA @.***> wrote:

Hi, @UltiFix https://github.com/UltiFix

I tested the localization mode and met the issue similar with yours. For Euroc dataset, firstly, I ran the code in SLAM mode and saved the created map to disk. And then, I ran it in localization mode (only tracking) using the same Euroc dataset after loading the saved map. And found that in "ORB-SLAM3: Current Frame" window, there were green keypoints at the beginning, but blue keypoints later, and then the tracking failed.

Have you encountered such a issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/UZ-SLAMLab/ORB_SLAM3/issues/377#issuecomment-949427311, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLC6H4J4JWSSJUXKBAPG4DUIESB7ANCNFSM5DHJ5IJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.