|
@@ -6,20 +6,6 @@
|
|
|
#include "MPC/navigation.h"
|
|
|
PangolinViewer* PangolinViewer::viewer_= nullptr;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-bool Create_trajectoris(PathMap map,std::vector<int> nodes_id,std::queue<Trajectory>& trajs)
|
|
|
-{
|
|
|
- if(nodes_id.size()<2)
|
|
|
- return false;
|
|
|
- for(int i=0;i<nodes_id.size()-1;++i)
|
|
|
- {
|
|
|
- Trajectory traj;
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
PangolinViewer* PangolinViewer::CreateViewer()
|
|
|
{
|
|
|
if (viewer_== nullptr)
|
|
@@ -54,7 +40,14 @@ void PangolinViewer::Join()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void PangolinViewer::SetCallbacks(ViewerSpinOnceCallback spinOnce,StartBtnCallback startBtn,
|
|
|
+void PangolinViewer::SetNavigationCallbacks(StartBtnCallback startBtn,
|
|
|
+ StopBtnCallback stopBtn)
|
|
|
+{
|
|
|
+ naviagtion_startBtn_callback_=startBtn;
|
|
|
+ navigation_stopBtn_callback_=stopBtn;
|
|
|
+}
|
|
|
+
|
|
|
+void PangolinViewer::SetCallbacks(ViewerSpinOnceCallback spinOnce,StartLocateBtnCallback startBtn,
|
|
|
StopBtnCallback stopBtn,FreqChangedCallback freqChanged,DijkstraBtnCallback dijkstra)
|
|
|
{
|
|
|
spinOnce_callback_=spinOnce;
|
|
@@ -66,7 +59,7 @@ void PangolinViewer::SetCallbacks(ViewerSpinOnceCallback spinOnce,StartBtnCallba
|
|
|
|
|
|
void PangolinViewer::Init()
|
|
|
{
|
|
|
- pangolin::CreateWindowAndBind("Main", 1280, 640);
|
|
|
+ pangolin::CreateWindowAndBind("Main", 1280, 760);
|
|
|
// 3D Mouse handler requires depth testing to be enabled
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
glEnable(GL_BLEND); // 启用混合
|
|
@@ -74,12 +67,12 @@ void PangolinViewer::Init()
|
|
|
|
|
|
text_font_ = new pangolin::GlFont("../config/tt0102m_.ttf", 30.0);
|
|
|
s_cam_=new pangolin::OpenGlRenderState(
|
|
|
- pangolin::ProjectionMatrix(1480, 640, 840, 840, 480, 320, 0.1, 1000),
|
|
|
+ pangolin::ProjectionMatrix(1480, 760, 840, 840, 480, 380, 0.1, 1000),
|
|
|
pangolin::ModelViewLookAt(25, 0, 90, 25, 0, 20, pangolin::AxisY)
|
|
|
);
|
|
|
const int UI_WIDTH = 30 * pangolin::default_font().MaxWidth();
|
|
|
d_cam_ = &pangolin::CreateDisplay()
|
|
|
- .SetBounds(0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0, 1280.0f / 640.0f)
|
|
|
+ .SetBounds(0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0, 1280.0f / 760.0f)
|
|
|
.SetHandler(new pangolin::Handler3D(*s_cam_));
|
|
|
pangolin::CreatePanel("ui")
|
|
|
.SetBounds(0.0, 1.0, 0.0, pangolin::Attach::Pix(UI_WIDTH));
|
|
@@ -139,20 +132,22 @@ void PangolinViewer::Init()
|
|
|
|
|
|
});
|
|
|
|
|
|
- /*pangolin::Var<std::function<void(void)>> navigation_start("ui.navigation_start", [&]()
|
|
|
+ pangolin::Var<std::function<void(void)>> navigation_start("ui.navigation_start", [&]()
|
|
|
{
|
|
|
- std::queue<Trajectory> global_trajectorys;
|
|
|
- Navigation::GetInstance()->Start(global_trajectorys);
|
|
|
+ if(naviagtion_startBtn_callback_!=nullptr)
|
|
|
+ naviagtion_startBtn_callback_();
|
|
|
});
|
|
|
|
|
|
|
|
|
- pangolin::Var<std::function<void(void)>> navigation_end("ui.navigation_start", [&]()
|
|
|
+ pangolin::Var<std::function<void(void)>> navigation_end("ui.navigation_cancel", [&]()
|
|
|
{
|
|
|
- Navigation::GetInstance()->Cancel();
|
|
|
+ if(navigation_stopBtn_callback_!= nullptr)
|
|
|
+ navigation_stopBtn_callback_();
|
|
|
+
|
|
|
});
|
|
|
-*/
|
|
|
|
|
|
}
|
|
|
+
|
|
|
void PangolinViewer::DrawCloud(PointCloud::Ptr cloud,double r,double g,double b,
|
|
|
double alpha,double psize)
|
|
|
{
|
|
@@ -167,6 +162,7 @@ void PangolinViewer::DrawCloud(PointCloud::Ptr cloud,double r,double g,double b,
|
|
|
}
|
|
|
glEnd();
|
|
|
}
|
|
|
+
|
|
|
void PangolinViewer::DrawDijkastraMap(PathMap& map,std::vector<int> path)
|
|
|
{
|
|
|
//绘制顶点
|
|
@@ -234,7 +230,6 @@ void PangolinViewer::DrawDijkastraMap(PathMap& map,std::vector<int> path)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void PangolinViewer::ShowRealtimePose(Eigen::Matrix4d pose)
|
|
|
{
|
|
|
double l=2;
|