Skip to content

Commit ff870b0

Browse files
author
Matevz Morato
committed
Make RTBAMap consistent with logger usage
1 parent 52788d3 commit ff870b0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/rtabmap/RTABMapSLAM.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ void RTABMapSLAM::buildInternal() {
3333
}
3434

3535
RTABMapSLAM::~RTABMapSLAM() {
36+
auto& logger = pimpl->logger;
37+
3638
if(saveDatabaseOnClose) {
3739
if(databasePath.empty()) {
3840
databasePath = "/tmp/rtabmap.db";
3941
}
40-
pimpl->logger->info("Saving database at {}", databasePath);
42+
logger->info("Saving database at {}", databasePath);
4143
rtabmap.close(true, databasePath);
4244
}
4345
}
@@ -112,6 +114,7 @@ void RTABMapSLAM::odomPoseCB(std::shared_ptr<dai::ADatatype> data) {
112114
}
113115

114116
void RTABMapSLAM::run() {
117+
auto& logger = pimpl->logger;
115118
while(isRunning()) {
116119
if(!initialized) {
117120
continue;
@@ -124,7 +127,7 @@ void RTABMapSLAM::run() {
124127
if(success) {
125128
stats = rtabmap.getStatistics();
126129
if(rtabmap.getLoopClosureId() > 0) {
127-
pimpl->logger->debug("Loop closure detected! last loop closure id = {}", rtabmap.getLoopClosureId());
130+
logger->debug("Loop closure detected! last loop closure id = {}", rtabmap.getLoopClosureId());
128131
}
129132
odomCorr = stats.mapCorrection();
130133

@@ -154,7 +157,7 @@ void RTABMapSLAM::run() {
154157
if(saveDatabasePeriodically && std::chrono::duration<double>(std::chrono::steady_clock::now() - startTime).count() > databaseSaveInterval) {
155158
rtabmap.close(true, databasePath);
156159
rtabmap.init(rtabParams, databasePath);
157-
pimpl->logger->info("Database saved at {}", databasePath);
160+
logger->info("Database saved at {}", databasePath);
158161
startTime = std::chrono::steady_clock::now();
159162
}
160163
}

0 commit comments

Comments
 (0)