123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- #ifndef MAP_H
- #define MAP_H
- #include "MapPoint.h"
- #include "KeyFrame.h"
- #include <set>
- #include <pangolin/pangolin.h>
- #include <mutex>
- #include <boost/serialization/base_object.hpp>
- namespace ORB_SLAM3
- {
- class MapPoint;
- class KeyFrame;
- class Atlas;
- class KeyFrameDatabase;
- class Map
- {
- friend class boost::serialization::access;
- template<class Archive>
- void serialize(Archive &ar, const unsigned int version)
- {
- ar & mnId;
- ar & mnInitKFid;
- ar & mnMaxKFid;
- ar & mnBigChangeIdx;
-
-
-
- ar & mvpBackupKeyFrames;
- ar & mvpBackupMapPoints;
- ar & mvBackupKeyFrameOriginsId;
- ar & mnBackupKFinitialID;
- ar & mnBackupKFlowerID;
- ar & mbImuInitialized;
- ar & mbIsInertial;
- ar & mbIMU_BA1;
- ar & mbIMU_BA2;
- ar & mnInitKFid;
- ar & mnMaxKFid;
- ar & mnLastLoopKFid;
- }
- public:
- Map();
- Map(int initKFid);
- ~Map();
- void AddKeyFrame(KeyFrame* pKF);
- void AddMapPoint(MapPoint* pMP);
- void EraseMapPoint(MapPoint* pMP);
- void EraseKeyFrame(KeyFrame* pKF);
- void SetReferenceMapPoints(const std::vector<MapPoint*> &vpMPs);
- void InformNewBigChange();
- int GetLastBigChangeIdx();
- std::vector<KeyFrame*> GetAllKeyFrames();
- std::vector<MapPoint*> GetAllMapPoints();
- std::vector<MapPoint*> GetReferenceMapPoints();
- long unsigned int MapPointsInMap();
- long unsigned KeyFramesInMap();
- long unsigned int GetId();
- long unsigned int GetInitKFid();
- void SetInitKFid(long unsigned int initKFif);
- long unsigned int GetMaxKFid();
- KeyFrame* GetOriginKF();
- void SetCurrentMap();
- void SetStoredMap();
- bool HasThumbnail();
- bool IsInUse();
- void SetBad();
- bool IsBad();
- void clear();
- int GetMapChangeIndex();
- void IncreaseChangeIndex();
- int GetLastMapChange();
- void SetLastMapChange(int currentChangeId);
- void SetImuInitialized();
- bool isImuInitialized();
- void RotateMap(const cv::Mat &R);
- void ApplyScaledRotation(const cv::Mat &R, const float s, const bool bScaledVel=false, const cv::Mat t=cv::Mat::zeros(cv::Size(1,3),CV_32F));
- void SetInertialSensor();
- bool IsInertial();
- void SetIniertialBA1();
- void SetIniertialBA2();
- bool GetIniertialBA1();
- bool GetIniertialBA2();
- void PrintEssentialGraph();
- bool CheckEssentialGraph();
- void ChangeId(long unsigned int nId);
- unsigned int GetLowerKFID();
- void PreSave(std::set<GeometricCamera*> &spCams);
- void PostLoad(KeyFrameDatabase* pKFDB, ORBVocabulary* pORBVoc, map<long unsigned int, KeyFrame*>& mpKeyFrameId, map<unsigned int, GeometricCamera*> &mpCams);
- void printReprojectionError(list<KeyFrame*> &lpLocalWindowKFs, KeyFrame* mpCurrentKF, string &name, string &name_folder);
- vector<KeyFrame*> mvpKeyFrameOrigins;
- vector<unsigned long int> mvBackupKeyFrameOriginsId;
- KeyFrame* mpFirstRegionKF;
- std::mutex mMutexMapUpdate;
-
- std::mutex mMutexPointCreation;
- bool mbFail;
-
- static const int THUMB_WIDTH = 512;
- static const int THUMB_HEIGHT = 512;
- static long unsigned int nNextId;
- protected:
- long unsigned int mnId;
- std::set<MapPoint*> mspMapPoints;
- std::set<KeyFrame*> mspKeyFrames;
- std::vector<MapPoint*> mvpBackupMapPoints;
- std::vector<KeyFrame*> mvpBackupKeyFrames;
- KeyFrame* mpKFinitial;
- KeyFrame* mpKFlowerID;
- unsigned long int mnBackupKFinitialID;
- unsigned long int mnBackupKFlowerID;
- std::vector<MapPoint*> mvpReferenceMapPoints;
- bool mbImuInitialized;
- int mnMapChange;
- int mnMapChangeNotified;
- long unsigned int mnInitKFid;
- long unsigned int mnMaxKFid;
- long unsigned int mnLastLoopKFid;
-
- int mnBigChangeIdx;
-
- GLubyte* mThumbnail;
- bool mIsInUse;
- bool mHasTumbnail;
- bool mbBad = false;
- bool mbIsInertial;
- bool mbIMU_BA1;
- bool mbIMU_BA2;
- std::mutex mMutexMap;
- };
- }
- #endif
|