// // Created by zx on 22-12-2. // #ifndef LIO_LIVOX_CPP__PANGOLINVIEWER_H_ #define LIO_LIVOX_CPP__PANGOLINVIEWER_H_ #include #include #include #include #include #include #include #include #include #include #include "dijkstra/dijkstra.h" #include "dijkstra/trajectory.h" #include "define/typedef.h" class PangolinViewer { public: typedef void(*ViewerSpinOnceCallback)(PangolinViewer*); typedef void(*StartLocateBtnCallback)(std::string); typedef void(*StartBtnCallback)(); typedef void(*PauseBtnCallback)(); typedef void(*StopBtnCallback)(); typedef void(*AutoTestBtnCallback)(); typedef void(*FreqChangedCallback)(int); typedef bool(*DijkstraBtnCallback)(int ,int ,float& ,std::vector&); public: static PangolinViewer* CreateViewer(); void SetCallbacks(ViewerSpinOnceCallback spinOnce,DijkstraBtnCallback dijkstra); void SetNavigationCallbacks(StartBtnCallback startBtn, PauseBtnCallback pauseBtn, StopBtnCallback stopBtn); void SetAutoTestNavCallback(AutoTestBtnCallback callback); void ShowRealtimeStatu(Eigen::Matrix4d pose,double velocity,double angular); void ShowBrotherStatu(Eigen::Matrix4d pose,double velocity,double angular); void ResetPathInfo(int beg,int end,float distance); void DrawCloud(PointCloud::Ptr cloud,double r,double g,double b, double alpha,double psize); void DrawDijkastraMap(PathMap& map,std::vector path); void DrawTrajectory(const Trajectory& traj,double r,double g,double b,double ptsize); void Join(); ~PangolinViewer(); private: static void loop(PangolinViewer* p); PangolinViewer(); void Init(); protected: static PangolinViewer* viewer_; std::thread* thread_; pangolin::GlFont *text_font_ ; pangolin::OpenGlRenderState* s_cam_; pangolin::View *d_cam_ ; pangolin::Var* lvx_checkbox_; pangolin::Var* lvx_file_; /*pangolin::Var* start_button_; pangolin::Var* stop_button_; pangolin::Var* freq_double_;*/ pangolin::Var* timequeue_string_; pangolin::Var* xyz_string_; pangolin::Var* rpy_string_; pangolin::Var* velocity_string_; pangolin::Var* beg_Int_; pangolin::Var* end_Int_; pangolin::Var* v_; pangolin::Var* a_; pangolin::Var* path_string_; pangolin::Var* distance_string_; std::vector shortest_path_; ViewerSpinOnceCallback spinOnce_callback_=nullptr; DijkstraBtnCallback dijkstraBtn_callback_= nullptr; StartBtnCallback naviagtion_startBtn_callback_=nullptr; PauseBtnCallback naviagtion_pauseBtn_callback_=nullptr; StopBtnCallback navigation_stopBtn_callback_= nullptr; AutoTestBtnCallback navigation_AutoBtn_callback_= nullptr; }; #endif //LIO_LIVOX_CPP__PANGOLINVIEWER_H_