forked from xiaoxifuhongse/ORB-SLAM-RGBD-with-Octomap
-
Notifications
You must be signed in to change notification settings - Fork 15
/
PangolinViewer.h
133 lines (92 loc) · 2.85 KB
/
PangolinViewer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/**
* This file is part of ORB-SLAM2.
* 原来的 viewr 拆开,留下的作为基类,具体的 可视化 平台 作为子类 胖果林显示子类
*/
#ifndef PANGOLIN_VIEWER_H
#define PANGOLIN_VIEWER_H
#include "Viewer.h"
#include "FrameDrawer.h"
#include "MapDrawer.h"
#include "CostMap/include/costmap_2d_HRG.h"
#include "dataStruct.h"
#include "base_local_planner/include/dwa_planner_control.h"
//#include "global_planner/include/global_planner.h"
#include <mutex>
namespace ORB_SLAM2
{
class Tracking;
class FrameDrawer;
class MapDrawer;
class System;
class PangolinViewer : public Viewer {
public:
PangolinViewer(const string &strSettingPath);
// Main thread function. Draw points, keyframes, the current camera pose and the last processed
// frame. Drawing is refreshed according to the camera fps. We use Pangolin.
void Run();
//void RequestFinish();
//void RequestStop();
//bool isFinished();
//bool isStopped();
//void Release();
void UpdateFrame(Tracking *pTracker);
void SetCurrentCameraPose(const cv::Mat &Tcw);
void Register(System* pSystem);
void RegisterGlobalCostMap(costmap_2d::Costmap2D_HRG* pCostMap)
{
mpGlobalMap = pCostMap;
}
void RegisterLocalCostMap(costmap_2d::Costmap2D_HRG* pCostMap)
{
mpLocalMap = pCostMap;
}
void RegisterObs(pcl::PointCloud<pcl::PointXYZRGB> mvObs)
{
observation = mvObs;
}
void RegisterPlan(geometry_msg::Path plan)
{
globalPlan = plan;
}
void DrawObs()
{
glPointSize(2);
glBegin(GL_POINTS);
for(int i=0; i<observation.points.size(); i++)
{
glColor3f(observation.points[i].r/255.0, observation.points[i].g/255.0,observation.points[i].b/255.0);
glVertex3f(observation.points[i].x,observation.points[i].y,observation.points[i].z);
}
glEnd();
}
void DrawPlan()
{
glPointSize(10.0f);
glBegin(GL_POINTS);
glVertex3f(0,0.6f,0);
for(int i=0; i<globalPlan.poses.size(); i++)
{
geometry_msg::Pose p =globalPlan.poses[i];
glColor3f(0.0,0.0,0.0); //gray
glVertex3f(p.position.x, 0.6f,p.position.y);
}
glEnd();
}
void RegisterMap(Map* map);
void Finalize(void);
bool GetCurrentCameraPos(cv::Mat &Rcw, cv::Mat &Ow);
private:
FrameDrawer* mpFrameDrawer;
MapDrawer* mpMapDrawer;
costmap_2d::Costmap2D_HRG* mpGlobalMap;
costmap_2d::Costmap2D_HRG* mpLocalMap;
pcl::PointCloud<pcl::PointXYZRGB>observation;
geometry_msg::Path globalPlan;
base_local_planner::Trajectory localPlan;
// 1/fps in ms
double mT;
float mImageWidth, mImageHeight;
float mViewpointX, mViewpointY, mViewpointZ, mViewpointF;
};
}
#endif // PANGOLIN_VIEWER_H