/*--------------------------------------------------------------- CHMTSLAM_3D_viewer Optional 3D real-time viewer within HMT-SLAM ---------------------------------------------------------------*/ void CHMTSLAM::thread_3D_viewer() { CHMTSLAM* obj = this; CTicTac tictac; try { // Start thread: // ------------------------- obj->logFmt( mrpt::system::LVL_DEBUG, "[thread_3D_viewer] Thread started (ID=0x%08lX)\n", std::this_thread::get_id()); // -------------------------------------------- // The main loop // Executes until termination is signaled // -------------------------------------------- while (!obj->m_terminateThreads) { std::this_thread::sleep_for(100ms); }; // end while execute thread // Finish thread: // ------------------------- MRPT_TODO("Fix thread times") // try { mrpt::system::getCurrentThreadTimes( timCreat,timExit,timCPU); // } catch(...) {}; // obj->logFmt(mrpt::system::LVL_DEBUG,"[thread_3D_viewer] Thread // finished. CPU time used:%.06f secs \n",timCPU); obj->m_terminationFlag_3D_viewer = true; } catch (const std::exception& e) { obj->m_terminationFlag_3D_viewer = true; // Release semaphores: obj->logFmt(mrpt::system::LVL_ERROR, "%s", e.what()); // DEBUG: Terminate application: obj->m_terminateThreads = true; } catch (...) { obj->m_terminationFlag_3D_viewer = true; obj->logFmt( mrpt::system::LVL_ERROR, "\n---------------------- EXCEPTION CAUGHT! ---------------------\n" " In CHierarchicalMappingFramework::thread_3D_viewer. Unexpected " "runtime error!!\n"); // DEBUG: Terminate application: obj->m_terminateThreads = true; } }
/*--------------------------------------------------------------- CHMTSLAM_TBI Topological Bayesian Inference (TBI) process within HMT-SLAM ---------------------------------------------------------------*/ void CHMTSLAM::thread_TBI() { CHMTSLAM *obj = this; CTicTac tictac; // Seems that must be called in each thread?? if (obj->m_options.random_seed) randomGenerator.randomize( obj->m_options.random_seed ); else randomGenerator.randomize(); try { // Start thread: // ------------------------- obj->logFmt(mrpt::utils::LVL_DEBUG, "[thread_TBI] Thread started (ID=0x%08lX)\n", mrpt::system::getCurrentThreadId() ); // -------------------------------------------- // The main loop // Executes until termination is signaled // -------------------------------------------- while ( !obj->m_terminateThreads ) { mrpt::system::sleep(100); }; // end while execute thread // Finish thread: // ------------------------- time_t timCreat,timExit; double timCPU=0; try { mrpt::system::getCurrentThreadTimes( timCreat,timExit,timCPU); } catch(...) {}; obj->logFmt(mrpt::utils::LVL_DEBUG, "[thread_TBI] Thread finished. CPU time used:%.06f secs \n",timCPU); obj->m_terminationFlag_TBI = true; } catch(std::exception &e) { obj->m_terminationFlag_TBI = true; // Release semaphores: obj->logFmt(mrpt::utils::LVL_ERROR, "%s", e.what() ); // DEBUG: Terminate application: obj->m_terminateThreads = true; } catch(...) { obj->m_terminationFlag_TBI = true; obj->logFmt(mrpt::utils::LVL_ERROR, "\n---------------------- EXCEPTION CAUGHT! ---------------------\n" " In CHierarchicalMappingFramework::thread_TBI. Unexpected runtime error!!\n"); // Release semaphores: // DEBUG: Terminate application: obj->m_terminateThreads = true; } }