raulmur / ORB_SLAM2

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

How do I modify a multi-thread to a single thread? #393

Open hyunhoJeon opened 7 years ago

hyunhoJeon commented 7 years ago

I would like to work on single thread for debugging purposes.

Does anyone know how to do this?

xinyutan17 commented 7 years ago

If you notice in the constructor for System.cc, it creates separate threads that call the Run function in LocalMapping, LoopClosing, and Viewer. Each of those Run functions has a while(1) { ... } loop. One possible way to do this is every time you call System::TrackMonocular, System::TrackStereo, or System::TrackRGBD (which is originally done in the Tracking thread i.e. the main thread), you additionally call everything in the while(1) { ... } loops of the Run functions in LocalMapping, LoopClosing, and Viewer.

I would definitely not recommend doing this however because tracking would then be extremely slow especially if the system enters a loop closure. Hopefully you can think of another way to debug your issue.