LivoxMid70.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // Created by zx on 2021/12/15.
  3. //
  4. #ifndef SHUTTER_VERIFY_LASER_LIVOXMID70_H_
  5. #define SHUTTER_VERIFY_LASER_LIVOXMID70_H_
  6. #include "lds_lidar.h"
  7. #include <pcl/point_types.h>
  8. #include <pcl/point_cloud.h>
  9. #include <pcl/io/pcd_io.h>
  10. #include <pcl/common/transforms.h>
  11. #include <mutex>
  12. namespace livox
  13. {
  14. #define MAX_FRAME 1024
  15. class TimedLivoxExtendRawPoint
  16. {
  17. public:
  18. std::mutex m_mutex;
  19. LivoxExtendRawPoint* m_frame;
  20. int m_point_num;
  21. std::chrono::steady_clock::time_point m_time_point;
  22. float m_timeout;
  23. TimedLivoxExtendRawPoint();
  24. void Reset(LivoxExtendRawPoint* data ,int count,float timeout_time=0.5);
  25. void operator=(const TimedLivoxExtendRawPoint& frame);
  26. ~TimedLivoxExtendRawPoint();
  27. bool is_timeout();
  28. };
  29. class LivoxMid70 : public LdsLidar
  30. {
  31. public:
  32. LivoxMid70();
  33. virtual ~LivoxMid70();
  34. void SetFPS(float fps)
  35. {
  36. m_fps=fps;
  37. }
  38. pcl::PointCloud<pcl::PointXYZ>::Ptr GetCloud();
  39. void SetTransformParam(Eigen::Vector3f rpy,Eigen::Vector3f transpose);
  40. bool is_connected();
  41. private:
  42. virtual void LidarDataCallback(uint8_t handle, LivoxEthPacket *data,uint32_t data_num);
  43. protected:
  44. std::chrono::steady_clock::time_point m_last_data_tp;
  45. std::mutex m_mutex;
  46. TimedLivoxExtendRawPoint m_frames[MAX_FRAME];
  47. int m_idx;
  48. float m_fps;
  49. Eigen::Affine3f m_transform;
  50. };
  51. }
  52. #endif //SHUTTER_VERIFY_LASER_LIVOXMID70_H_