pangolinViewer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // Created by zx on 22-12-2.
  3. //
  4. #ifndef LIO_LIVOX_CPP__PANGOLINVIEWER_H_
  5. #define LIO_LIVOX_CPP__PANGOLINVIEWER_H_
  6. #include <pangolin/var/var.h>
  7. #include <pangolin/var/varextra.h>
  8. #include <pangolin/gl/gl.h>
  9. #include <pangolin/gl/gldraw.h>
  10. #include <pangolin/display/display.h>
  11. #include <pangolin/display/view.h>
  12. #include <pangolin/display/widgets.h>
  13. #include <pangolin/display/default_font.h>
  14. #include <pangolin/handler/handler.h>
  15. #include <thread>
  16. #include "dijkstra/dijkstra.h"
  17. #include "dijkstra/trajectory.h"
  18. #include "define/typedef.h"
  19. class PangolinViewer
  20. {
  21. public:
  22. typedef void(*ViewerSpinOnceCallback)(PangolinViewer*);
  23. typedef void(*StartLocateBtnCallback)(std::string);
  24. typedef void(*StartBtnCallback)();
  25. typedef void(*PauseBtnCallback)();
  26. typedef void(*StopBtnCallback)();
  27. typedef void(*AutoTestBtnCallback)();
  28. typedef void(*FreqChangedCallback)(int);
  29. typedef bool(*DijkstraBtnCallback)(int ,int ,float& ,std::vector<int>&);
  30. public:
  31. static PangolinViewer* CreateViewer();
  32. void SetCallbacks(ViewerSpinOnceCallback spinOnce,DijkstraBtnCallback dijkstra);
  33. void SetNavigationCallbacks(StartBtnCallback startBtn,
  34. PauseBtnCallback pauseBtn,
  35. StopBtnCallback stopBtn);
  36. void SetAutoTestNavCallback(AutoTestBtnCallback callback);
  37. void ShowRealtimeStatu(Eigen::Matrix4d pose,double velocity,double angular);
  38. void ShowBrotherStatu(Eigen::Matrix4d pose,double velocity,double angular);
  39. void ResetPathInfo(int beg,int end,float distance);
  40. void DrawCloud(PointCloud::Ptr cloud,double r,double g,double b,
  41. double alpha,double psize);
  42. void DrawDijkastraMap(PathMap& map,std::vector<int> path);
  43. void DrawTrajectory(const Trajectory& traj,double r,double g,double b,double ptsize);
  44. void Join();
  45. ~PangolinViewer();
  46. private:
  47. static void loop(PangolinViewer* p);
  48. PangolinViewer();
  49. void Init();
  50. protected:
  51. static PangolinViewer* viewer_;
  52. std::thread* thread_;
  53. pangolin::GlFont *text_font_ ;
  54. pangolin::OpenGlRenderState* s_cam_;
  55. pangolin::View *d_cam_ ;
  56. pangolin::Var<bool>* lvx_checkbox_;
  57. pangolin::Var<std::string>* lvx_file_;
  58. /*pangolin::Var<bool>* start_button_;
  59. pangolin::Var<bool>* stop_button_;
  60. pangolin::Var<double>* freq_double_;*/
  61. pangolin::Var<std::string>* timequeue_string_;
  62. pangolin::Var<std::string>* xyz_string_;
  63. pangolin::Var<std::string>* rpy_string_;
  64. pangolin::Var<std::string>* velocity_string_;
  65. pangolin::Var<int>* beg_Int_;
  66. pangolin::Var<int>* end_Int_;
  67. pangolin::Var<double>* v_;
  68. pangolin::Var<double>* a_;
  69. pangolin::Var<std::string>* path_string_;
  70. pangolin::Var<std::string>* distance_string_;
  71. std::vector<int> shortest_path_;
  72. ViewerSpinOnceCallback spinOnce_callback_=nullptr;
  73. DijkstraBtnCallback dijkstraBtn_callback_= nullptr;
  74. StartBtnCallback naviagtion_startBtn_callback_=nullptr;
  75. PauseBtnCallback naviagtion_pauseBtn_callback_=nullptr;
  76. StopBtnCallback navigation_stopBtn_callback_= nullptr;
  77. AutoTestBtnCallback navigation_AutoBtn_callback_= nullptr;
  78. };
  79. #endif //LIO_LIVOX_CPP__PANGOLINVIEWER_H_