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.45k stars 2.53k forks source link

segmentation fault: examples: rgbd_tum? #452

Open jcyhcs opened 2 years ago

jcyhcs commented 2 years ago

hi,professor: i test examples/rgbd: command line: ./rgbd_tum ../../Vocabulary/ORBvoc.txt TUM1.yaml rgbd_dataset_freiburg1_xyz associations/fr1_xyz.txt then run, everything seems ok, snapshot: image but, when the program ending, it print some error: First KF:0; Map init KF:0 New Map created with 837 points Starting the Viewer Shutdown

median tracking time: 0.0636379 mean tracking time: 0.064307

Saving camera trajectory to CameraTrajectory.txt ...

Saving keyframe trajectory to KeyFrameTrajectory.txt ... Segmentation fault (core dumped)

some weird , is there any bug? oh,please help

cuixuyang615 commented 2 years ago

I have also met the same problem, may I ask have you solved it?

sandstorm666 commented 2 years ago

I encounter this problem,have anyone solved?

sandstorm666 commented 2 years ago

I solved by uncommented some code. LocalMapper is not finished.

sandstorm666 commented 2 years ago
if(mpViewer)
{
    mpViewer->RequestFinish();
    while(!mpViewer->isFinished())
        usleep(5000);
}

//Wait until all thread have effectively stopped
while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || mpLoopCloser->isRunningGBA())
{
    if(!mpLocalMapper->isFinished())
        cout << "mpLocalMapper is not finished" << endl;
    if(!mpLoopCloser->isFinished())
        cout << "mpLoopCloser is not finished" << endl;
    if(mpLoopCloser->isRunningGBA()){
        cout << "mpLoopCloser is running GBA" << endl;
        cout << "break anyway..." << endl;
        break;
    }
    usleep(5000);
}

these code is needed in System::Shutdown().

nickxiang0306 commented 2 years ago
if(mpViewer)
{
    mpViewer->RequestFinish();
    while(!mpViewer->isFinished())
        usleep(5000);
}

//Wait until all thread have effectively stopped
while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || mpLoopCloser->isRunningGBA())
{
    if(!mpLocalMapper->isFinished())
        cout << "mpLocalMapper is not finished" << endl;
    if(!mpLoopCloser->isFinished())
        cout << "mpLoopCloser is not finished" << endl;
    if(mpLoopCloser->isRunningGBA()){
        cout << "mpLoopCloser is running GBA" << endl;
        cout << "break anyway..." << endl;
        break;
    }
    usleep(5000);
}

these code is needed in System::Shutdown(). Hello @sandstorm666 , I appreciate your answer, and it helps me to fix the segfault bug.

JonathanLehner commented 1 year ago

does not seem to work. I uncommented it but there is still a segmentation fault

SJTUlibochen commented 1 year ago

does not seem to work. I uncommented it but there is still a segmentation fault

maybe u need to rebuild it

IndShiv commented 1 year ago

Hi I am facing the same issue. I have tried uncommenting the above section of the code and rebuilding but I still end up with a Segmentation Fault. Any other suggestions?

yutongwangBIT commented 1 year ago

Well I found that at the end of System::Shutdown() there is if(mpViewer) pangolin::BindToContext("ORB-SLAM2: Map Viewer"); I have solved the segmentation fault by changing ORB-SLAM2 to ORB-SLAM3. Hope this could help.

StanleyOf427 commented 6 months ago

Well I found that at the end of System::Shutdown() there is if(mpViewer) pangolin::BindToContext("ORB-SLAM2: Map Viewer"); I have solved the segmentation fault by changing ORB-SLAM2 to ORB-SLAM3. Hope this could help.

That‘s worked, after uncommenting the above section of the code, and modifing " if(mpViewer) pangolin::BindToContext("ORB-SLAM2: Map Viewer"); " to " if(mpViewer) pangolin::BindToContext("ORB-SLAM3: Map Viewer"); " , you can get the result: "There are 1 maps in the atlas Map 0 has 256 KFs End of saving trajectory to f_dataset-MH01_mono.txt ... Saving keyframe trajectory to kf_dataset-MH01_mono.txt ... (base) guo@M6700:~/ORBSLAM/tmp/ORB_SLAM3-master/Examples$" afer rebuilding it.

Yangyang221 commented 5 months ago

I did so and still got the same error. 2024-04-19 16-03-54 的屏幕截图

StanleyOf427 commented 5 months ago

I did so and still got the same error. 2024-04-19 16-03-54 的屏幕截图

Would you like to provide more information about your environment? What's your Ubuntu , compiler and pangolin version ?

Yangyang221 commented 5 months ago

hi, My environment as follows: pangolin 0.6,ubuntu20.04

StanleyOf427 commented 3 months ago

maybe you should update pangolin to v0.8, which works well in the same OS.

Lhyshining commented 1 month ago

Well I found that at the end of System::Shutdown() there is if(mpViewer) pangolin::BindToContext("ORB-SLAM2: Map Viewer"); I have solved the segmentation fault by changing ORB-SLAM2 to ORB-SLAM3. Hope this could help.

That‘s worked, after uncommenting the above section of the code, and modifing " if(mpViewer) pangolin::BindToContext("ORB-SLAM2: Map Viewer"); " to " if(mpViewer) pangolin::BindToContext("ORB-SLAM3: Map Viewer"); " , you can get the result: "There are 1 maps in the atlas Map 0 has 256 KFs End of saving trajectory to f_dataset-MH01_mono.txt ... Saving keyframe trajectory to kf_dataset-MH01_mono.txt ... (base) guo@M6700:~/ORBSLAM/tmp/ORB_SLAM3-master/Examples$" afer rebuilding it.

Thank you, my pangolin version is 0.6, and i also run tum rgbd dataset. It works for me!