pointcloudmapping.h
Go to the documentation of this file.
1 /*
2  * <one line to give the program's name and a brief idea of what it does.>
3  * Copyright (C) 2016 <copyright holder> <email>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef POINTCLOUDMAPPING_H
21 #define POINTCLOUDMAPPING_H
22 
23 #include "System.h"
24 
25 #include <pcl/common/transforms.h>
26 #include <pcl/point_types.h>
27 #include <pcl/filters/voxel_grid.h>
28 #include <condition_variable>
29 #include <pcl/io/pcd_io.h>
30 #include "DataCache/DataCache.h"
31 
32 using namespace ORB_SLAM2;
33 using namespace NS_DataCache;
34 
36 {
37 public:
38  typedef pcl::PointXYZRGBA PointT;
39  typedef pcl::PointCloud<PointT> PointCloud;
40 
41  PointCloudMapping( double resolution_ );
42 
43  DataCache<PointCloud>* GetPointCloudDataCache();
44  int32_t GetPointCloudDataCacheIndex();
45 
46  // 插入一个keyframe,会更新一次地图
47  void insertKeyFrame( KeyFrame* kf, cv::Mat& color, cv::Mat& depth );
48  void shutdown();
49  void viewer();
50 
51  bool* GetPointCloudState();
52  mutex* GetPointCloudMutex();
53  PointCloud::Ptr GetPointCloudPtr();
54  mutex* GetPointCloudStateMutex();
55 
56 protected:
57  PointCloud::Ptr generatePointCloud(KeyFrame* kf, cv::Mat& color, cv::Mat& depth);
58 
59  PointCloud::Ptr globalMap;
60  PointCloud::Ptr globalMapBack;
61  shared_ptr<thread> viewerThread;
62 
63  bool shutDownFlag =false;
64  bool bIsPointCloudGenerated = false;
65  mutex shutDownMutex;
66 
67  condition_variable keyFrameUpdated;
69 
70  // data to generate point clouds
71  vector<KeyFrame*> keyframes;
72  vector<cv::Mat> colorImgs;
73  vector<cv::Mat> depthImgs;
78  uint16_t lastKeyframeSize =0;
79 
80  double resolution = 0.05;
81  pcl::VoxelGrid<PointT> voxel;
82 private:
85 };
86 
87 #endif // POINTCLOUDMAPPING_H
vector< cv::Mat > colorImgs
PointCloud::Ptr globalMapBack
pcl::PointXYZRGBA PointT
DataCache< PointCloud > * mpPointCloudDataCache
vector< cv::Mat > depthImgs
shared_ptr< thread > viewerThread
PointCloud::Ptr globalMap
pcl::PointCloud< PointT > PointCloud
vector< KeyFrame * > keyframes
pcl::VoxelGrid< PointT > voxel
condition_variable keyFrameUpdated


orb_slam2_with_maps_odom
Author(s): teng zhang
autogenerated on Fri Sep 25 2020 03:24:47