/** * This file is part of ORB-SLAM3 * * Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez Rodríguez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. * Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. * * ORB-SLAM3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ORB-SLAM3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with ORB-SLAM3. * If not, see . */ #ifndef ATLAS_H #define ATLAS_H #include "Map.h" #include "MapPoint.h" #include "KeyFrame.h" #include "GeometricCamera.h" #include "Pinhole.h" #include "KannalaBrandt8.h" #include #include #include #include namespace ORB_SLAM3 { class Viewer; class Map; class MapPoint; class KeyFrame; class KeyFrameDatabase; class Frame; class KannalaBrandt8; class Pinhole; //BOOST_CLASS_EXPORT_GUID(Pinhole, "Pinhole") //BOOST_CLASS_EXPORT_GUID(KannalaBrandt8, "KannalaBrandt8") class Atlas { friend class boost::serialization::access; template void serialize(Archive &ar, const unsigned int version) { //ar.template register_type(); //ar.template register_type(); // Save/load the set of maps, the set is broken in libboost 1.58 for ubuntu 16.04 //ar & mspMaps; ar & mvpBackupMaps; ar & mvpCameras; //ar & mvpBackupCamPin; //ar & mvpBackupCamKan; // Need to save/load the static Id from Frame, KeyFrame, MapPoint and Map ar & Map::nNextId; ar & Frame::nNextId; ar & KeyFrame::nNextId; ar & MapPoint::nNextId; ar & GeometricCamera::nNextId; ar & mnLastInitKFidMap; } public: Atlas(); Atlas(int initKFid); // When its initialization the first map is created ~Atlas(); void CreateNewMap(); void ChangeMap(Map* pMap); unsigned long int GetLastInitKFid(); void SetViewer(Viewer* pViewer); // Method for change components in the current map void AddKeyFrame(KeyFrame* pKF); void AddMapPoint(MapPoint* pMP); //void EraseMapPoint(MapPoint* pMP); //void EraseKeyFrame(KeyFrame* pKF); void AddCamera(GeometricCamera* pCam); /* All methods without Map pointer work on current map */ void SetReferenceMapPoints(const std::vector &vpMPs); void InformNewBigChange(); int GetLastBigChangeIdx(); long unsigned int MapPointsInMap(); long unsigned KeyFramesInMap(); // Method for get data in current map std::vector GetAllKeyFrames(); std::vector GetAllMapPoints(); std::vector GetReferenceMapPoints(); vector GetAllMaps(); int CountMaps(); void clearMap(); void clearAtlas(); Map* GetCurrentMap(); void SetMapBad(Map* pMap); void RemoveBadMaps(); bool isInertial(); void SetInertialSensor(); void SetImuInitialized(); bool isImuInitialized(); // Function for garantee the correction of serialization of this object void PreSave(); void PostLoad(); void SetKeyFrameDababase(KeyFrameDatabase* pKFDB); KeyFrameDatabase* GetKeyFrameDatabase(); void SetORBVocabulary(ORBVocabulary* pORBVoc); ORBVocabulary* GetORBVocabulary(); long unsigned int GetNumLivedKF(); long unsigned int GetNumLivedMP(); protected: std::set mspMaps; std::set mspBadMaps; // Its necessary change the container from set to vector because libboost 1.58 and Ubuntu 16.04 have an error with this cointainer std::vector mvpBackupMaps; Map* mpCurrentMap; std::vector mvpCameras; std::vector mvpBackupCamKan; std::vector mvpBackupCamPin; //Pinhole testCam; std::mutex mMutexAtlas; unsigned long int mnLastInitKFidMap; Viewer* mpViewer; bool mHasViewer; // Class references for the map reconstruction from the save file KeyFrameDatabase* mpKeyFrameDB; ORBVocabulary* mpORBVocabulary; }; // class Atlas } // namespace ORB_SLAM3 #endif // ATLAS_H