raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.4k stars 4.69k forks source link

Segmentation Fault because of Global Bundle Adjustment #634

Open ashok-y opened 6 years ago

ashok-y commented 6 years ago

I am running a modified version of ORBSLAM2 where I can save the map features to a file and can reload the map. I'm running into an issue where if I reload the map features and there's a Loop Closure in the dataset, Global Bundle Adjustments occurs and at that point I'm receiving a Segmentation Fault in the g2o library. gdb Trace Log:

#0  0x00007ffff1ee055b in g2o::HyperGraph::addEdge(g2o::HyperGraph::Edge*) ()
   from /ORB_SLAM2/Thirdparty/g2o/lib/libg2o.so

#1  0x00007ffff1eec9ba in g2o::OptimizableGraph::addEdge(g2o::HyperGraph::Edge*) ()
   from /ORB_SLAM2/Thirdparty/g2o/lib/libg2o.so

#2  0x00007ffff7a67450 in ORB_SLAM2::Optimizer::BundleAdjustment (
    vpKFs=std::vector of length 1553, capacity 1553 = {...}, 
    vpMP=std::vector of length 175862, capacity 175862 = {...}, 
    nIterations=nIterations@entry=10, pbStopFlag=pbStopFlag@entry=0x73f2e4a, 
    nLoopKF=nLoopKF@entry=1553, bRobust=bRobust@entry=false)
    at /ORB_SLAM2/src/Optimizer.cc:172

#3  0x00007ffff7a67d47 in ORB_SLAM2::Optimizer::GlobalBundleAdjustemnt (
    pMap=0x15a62160, nIterations=nIterations@entry=10, 
    pbStopFlag=pbStopFlag@entry=0x73f2e4a, nLoopKF=nLoopKF@entry=1553, 
    bRobust=bRobust@entry=false)
    at /ORB_SLAM2/src/Optimizer.cc:45

#4  0x00007ffff7a013b2 in ORB_SLAM2::LoopClosing::RunGlobalBundleAdjustment (
    this=0x73f2c40, nLoopKF=1553)
    at ORB_SLAM2/src/LoopClosing.cc:680

#5  0x00007ffff2ffb8f0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

#6  0x00007ffff27466ba in start_thread (arg=0x7fff55318700)

Any input is appreciated. Thanks in advance.

mcallistertyler commented 5 years ago

Did you manage to fix this? I am having the same issue.

hnsywangxin commented 4 years ago

@mcallistertyler95 @ashok-y @raulmur I have the same issue,expect your help,thank you ! More info: I used release mode to build, it is no error, but when I use debug ,the error was caused

bhaveshachhada commented 4 years ago

I am also having segmentation issue while using modified ORBSLAM2 code for map save-load functionality, but program exists just after getting enough keypoints for initialization. ThankYou. @raulmur @mcallistertyler95 @ashok-y