123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- #ifndef SYSTEM_H
- #define SYSTEM_H
- #include <unistd.h>
- #include<stdio.h>
- #include<stdlib.h>
- #include<string>
- #include<thread>
- #include<opencv2/core/core.hpp>
- #include "Tracking.h"
- #include "FrameDrawer.h"
- #include "MapDrawer.h"
- #include "Atlas.h"
- #include "LocalMapping.h"
- #include "LoopClosing.h"
- #include "KeyFrameDatabase.h"
- #include "ORBVocabulary.h"
- #include "Viewer.h"
- #include "ImuTypes.h"
- namespace ORB_SLAM3
- {
- class Verbose
- {
- public:
- enum eLevel
- {
- VERBOSITY_QUIET=0,
- VERBOSITY_NORMAL=1,
- VERBOSITY_VERBOSE=2,
- VERBOSITY_VERY_VERBOSE=3,
- VERBOSITY_DEBUG=4
- };
- static eLevel th;
- public:
- static void PrintMess(std::string str, eLevel lev)
- {
- if(lev <= th)
- cout << str << endl;
- }
- static void SetTh(eLevel _th)
- {
- th = _th;
- }
- };
- class Viewer;
- class FrameDrawer;
- class Atlas;
- class Tracking;
- class LocalMapping;
- class LoopClosing;
- class System
- {
- public:
-
- enum eSensor{
- MONOCULAR=0,
- STEREO=1,
- RGBD=2,
- IMU_MONOCULAR=3,
- IMU_STEREO=4
- };
-
- enum eFileType{
- TEXT_FILE=0,
- BINARY_FILE=1,
- };
- public:
-
- System(const string &strVocFile, const string &strSettingsFile, const eSensor sensor, const bool bUseViewer = true, const int initFr = 0, const string &strSequence = std::string(), const string &strLoadingFile = std::string());
-
-
-
- cv::Mat TrackStereo(const cv::Mat &imLeft, const cv::Mat &imRight, const double ×tamp, const vector<IMU::Point>& vImuMeas = vector<IMU::Point>(), string filename="");
-
-
-
-
- cv::Mat TrackRGBD(const cv::Mat &im, const cv::Mat &depthmap, const double ×tamp, string filename="");
-
-
-
- cv::Mat TrackMonocular(const cv::Mat &im, const double ×tamp, const vector<IMU::Point>& vImuMeas = vector<IMU::Point>(), string filename="");
-
- void ActivateLocalizationMode();
-
- void DeactivateLocalizationMode();
-
-
- bool MapChanged();
-
- void Reset();
- void ResetActiveMap();
-
-
-
- void Shutdown();
-
-
-
-
- void SaveTrajectoryTUM(const string &filename);
-
-
-
-
- void SaveKeyFrameTrajectoryTUM(const string &filename);
- void SaveTrajectoryEuRoC(const string &filename);
- void SaveKeyFrameTrajectoryEuRoC(const string &filename);
-
- void SaveDebugData(const int &iniIdx);
-
-
-
-
- void SaveTrajectoryKITTI(const string &filename);
-
-
-
-
-
- int GetTrackingState();
- std::vector<MapPoint*> GetTrackedMapPoints();
- std::vector<cv::KeyPoint> GetTrackedKeyPointsUn();
-
- double GetTimeFromIMUInit();
- bool isLost();
- bool isFinished();
- void ChangeDataset();
-
- private:
-
-
-
- eSensor mSensor;
-
- ORBVocabulary* mpVocabulary;
-
- KeyFrameDatabase* mpKeyFrameDatabase;
-
-
- Atlas* mpAtlas;
-
-
-
- Tracking* mpTracker;
-
- LocalMapping* mpLocalMapper;
-
-
- LoopClosing* mpLoopCloser;
-
- Viewer* mpViewer;
- FrameDrawer* mpFrameDrawer;
- MapDrawer* mpMapDrawer;
-
-
- std::thread* mptLocalMapping;
- std::thread* mptLoopClosing;
- std::thread* mptViewer;
-
- std::mutex mMutexReset;
- bool mbReset;
- bool mbResetActiveMap;
-
- std::mutex mMutexMode;
- bool mbActivateLocalizationMode;
- bool mbDeactivateLocalizationMode;
-
- int mTrackingState;
- std::vector<MapPoint*> mTrackedMapPoints;
- std::vector<cv::KeyPoint> mTrackedKeyPointsUn;
- std::mutex mMutexState;
- };
- }
- #endif
|