// // 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 "segment/LidarFeatureExtractor.h" #include #include "define/typedef.h" class PangolinViewer { public: typedef void(*ViewerSpinOnceCallback)(PangolinViewer*); typedef void(*StartLocateBtnCallback)(std::string); typedef void(*StartBtnCallback)(); typedef void(*StopBtnCallback)(); typedef void(*FreqChangedCallback)(int); public: static PangolinViewer* CreateViewer(); void SetCallbacks(ViewerSpinOnceCallback spinOnce,StartLocateBtnCallback startBtn, StopBtnCallback stopBtn,FreqChangedCallback freqChanged); void ShowRealtimePose(Eigen::Matrix4d pose); void ShowSlamCost(double cost); void ShowSlamQueueTime(int queue,double tm); void DrawCloud(PointCloud::Ptr cloud,double r,double g,double b, double alpha,double psize); 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* cost_string_; ViewerSpinOnceCallback spinOnce_callback_=nullptr; StartLocateBtnCallback startBtn_callback_=nullptr; StopBtnCallback stopBtn_callback_= nullptr; FreqChangedCallback freqChanged_callback_= nullptr; }; #endif //LIO_LIVOX_CPP__PANGOLINVIEWER_H_