@@ -33,11 +33,13 @@ void RTABMapSLAM::buildInternal() {
3333}
3434
3535RTABMapSLAM::~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
114116void 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