标签:cto 影响 pos map tab 类型 值传递 cas ext
(1) SLAM对象的数据成员
// 传感器的类型
eSensor mSensor;
// ORB 字典 ORBVocabulary* mpVocabulary;
// 用于重定位与回环检测的关键帧数据库
KeyFrameDatabase* mpKeyFrameDatabase;
// 存放所有关键帧与地图点的指针 Map* mpMap;
// Tracker
// 1:跟踪局部地图,计算pose
// 2:判断关键帧
// 3:重定位
Tracking* mpTracker;
// Local Mapper
// 管理局部地图
LocalMapping* mpLocalMapper;
// Loop Closer
// 关键帧回环检测
LoopClosing* mpLoopClosing;
// 绘图类(对)
View* mpViewer;
FrameDrawer* mpFrameDrawer;
MapDrawer* mpMapDrawer;
// 跟踪部分在主线中执行,除此之外还有其他三个线程
std::thread* mpLocalMapping;
std::thread* mpLoopClosing;
std::thread* mpViewer;
// 复位标志位
std::mutex; //线程锁
bool mbReset;
// 模式切换标志位
std::mutex mMutexMode;
bool mbActivateLocalizationMode;
bool mbDeactivateLocalizationMode;
// 跟踪标志位
std::mutex mMutexState;
int mTrackingState;
std::vector<MapPoint*> mTrackedMapPoints;
std::vector<cv::KeyPoint> mTrackedKeyPointsUn;
(2) SLAM对象的构造函数
初始化列表:
System::System(const string &strVocFile, const string &strSettingsFile, const eSensor sensor, const bool bUseViewer):
mSensor(sensor), mpViewer(static_cast<View*>(NULL)), mbReset(false), mbActivateLocalizationMode(false), mbDeactivateLocalizationMode(false)
内部成员数据初始化及关联:
mpVocabulary = new ORBVocabulary();
mpVocabulary->loadFromTextFile(strVocFile);
mpKeyFrameDatabase = new KeyFrameDatabase(*mpVocabulary); //注意这里是值传递
mpMap = new Map();
mpFrameDrawer = new FrameDrawer(mpMap);
mpMapDrawer = new MapDrawer(mapMap, strSettingsFile);
// 初始化Tracker
mpTracker = new Tracking(this, mpVocabulary, mpFrameDrawer, mpMapDrawer, mpMap, mpKeyFrameDatabase, strSettingFile, mSensor);
// 开启局部建图线程
mpLocalMapper = new LocalMapping(mpMap, mSensor == MONOCULAR);
mptLocalMapping = new thread(&ORB_SLAM2::LocalMapping::Run, mpLocalMapper);
// 开启回环检测线程
mpLoopCloser = new LoopCloser(mpMap, mpKeyFramDatabase, mpVocabulary, mSensor!=MONOCULAR);
mptLoopClosing = new thread(&ORB_SLAM2::LoopingClosing::Run, mpLoopcloser);
//if (bUseViewer == 1)
mpViewer = new(this, mpFrameDrawer, mpMapDrawer, strSettingsFile);
mptViewer = new thread(&Viewer::Run, mpViewer);
mpTracker->SetViewer(mpViewer);
//三个线程相互影响,相互引用 ("铁三角")
mpTracker->SetLocalMapper(mpLocalMapper);
mpTracker->SetLoopClosing(mpLoopCloser);
mpLocalMapper->SetTracker(mpTracker);
mpLocalMapper->SetLoopCloser(mpLoopCloser);
mpLoopCloser->SetTracker(mpTracker);
mpLoopCloser->SetLocalMapper(mpLocalMapper)
博客扩展接口
标签:cto 影响 pos map tab 类型 值传递 cas ext
原文地址:https://www.cnblogs.com/npulzb/p/11605189.html