MRPT
2.0.3
CHMTSLAM_3D_viewer.cpp
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| https://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6
| See: https://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See: https://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
10
#include "
hmtslam-precomp.h
"
// Precomp header
11
12
#include <
mrpt/io/CFileStream.h
>
13
#include <
mrpt/random.h
>
14
#include <
mrpt/system/CTicTac.h
>
15
#include <
mrpt/system/os.h
>
16
17
#include <thread>
18
19
using namespace
mrpt::slam
;
20
using namespace
mrpt::hmtslam
;
21
using namespace
mrpt::system
;
22
using namespace
std::literals;
23
24
/*---------------------------------------------------------------
25
26
CHMTSLAM_3D_viewer
27
28
Optional 3D real-time viewer within HMT-SLAM
29
30
---------------------------------------------------------------*/
31
void
CHMTSLAM::thread_3D_viewer()
32
{
33
CHMTSLAM
* obj =
this
;
34
CTicTac
tictac;
35
36
try
37
{
38
// Start thread:
39
// -------------------------
40
obj->
logFmt
(
41
mrpt::system::LVL_DEBUG
,
42
"[thread_3D_viewer] Thread started (ID=0x%08lX)\n"
,
43
std::this_thread::get_id());
44
45
// --------------------------------------------
46
// The main loop
47
// Executes until termination is signaled
48
// --------------------------------------------
49
while
(!obj->
m_terminateThreads
)
50
{
51
std::this_thread::sleep_for(100ms);
52
};
// end while execute thread
53
54
// Finish thread:
55
// -------------------------
56
obj->
m_terminationFlag_3D_viewer
=
true
;
57
}
58
catch
(
const
std::exception& e)
59
{
60
obj->
m_terminationFlag_3D_viewer
=
true
;
61
62
// Release semaphores:
63
64
obj->
logFmt
(
mrpt::system::LVL_ERROR
,
"%s"
, e.what());
65
66
// DEBUG: Terminate application:
67
obj->
m_terminateThreads
=
true
;
68
}
69
catch
(...)
70
{
71
obj->
m_terminationFlag_3D_viewer
=
true
;
72
73
obj->
logFmt
(
74
mrpt::system::LVL_ERROR
,
75
"\n---------------------- EXCEPTION CAUGHT! ---------------------\n"
76
" In CHierarchicalMappingFramework::thread_3D_viewer. Unexpected "
77
"runtime error!!\n"
);
78
79
// DEBUG: Terminate application:
80
obj->
m_terminateThreads
=
true
;
81
}
82
}
os.h
mrpt::hmtslam::CHMTSLAM::m_terminationFlag_3D_viewer
std::atomic_bool m_terminationFlag_3D_viewer
Definition:
CHMTSLAM.h:342
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition:
system/CTicTac.h:17
mrpt::hmtslam::CHMTSLAM
An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
Definition:
CHMTSLAM.h:67
hmtslam-precomp.h
random.h
mrpt::hmtslam
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
Definition:
CHierarchicalMapMHPartition.h:27
mrpt::system::COutputLogger::logFmt
void logFmt(const VerbosityLevel level, const char *fmt,...) const MRPT_printf_format_check(3
Alternative logging method, which mimics the printf behavior.
Definition:
COutputLogger.cpp:91
mrpt::system::LVL_DEBUG
@ LVL_DEBUG
Definition:
system/COutputLogger.h:30
CTicTac.h
mrpt::system::LVL_ERROR
@ LVL_ERROR
Definition:
system/COutputLogger.h:33
CFileStream.h
mrpt::slam
Definition:
CMultiMetricMapPDF.h:26
mrpt::system
Definition:
backtrace.h:14
mrpt::hmtslam::CHMTSLAM::m_terminateThreads
std::atomic_bool m_terminateThreads
Termination flag for signaling all threads to terminate.
Definition:
CHMTSLAM.h:337
Page generated by
Doxygen 1.8.17
for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020