transitData.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // Created by zx on 23-11-28.
  3. //
  4. #ifndef CERES_TEST_TransitData_H
  5. #define CERES_TEST_TransitData_H
  6. #include <opencv2/opencv.hpp>
  7. #include <pcl/point_types.h>
  8. #include <pcl/point_cloud.h>
  9. #include "tool/timedlockdata.hpp"
  10. #include "tool/singleton.hpp"
  11. #include "proto/enum_type.pb.h"
  12. #include <mutex>
  13. class TransitData : public Singleton<TransitData> {
  14. friend Singleton<TransitData>;
  15. public:
  16. struct MeasureInfo {
  17. float x;
  18. float y;
  19. float transx;
  20. float transy;
  21. float theta;
  22. float width;
  23. float wheelbase;
  24. float ftheta;
  25. int border_plc;
  26. int border_display;
  27. std::string error;
  28. MeasureInfo &operator=(const MeasureInfo &info) {
  29. x = info.x;
  30. y = info.y;
  31. theta = info.theta;
  32. transx = info.transx;
  33. transy = info.transy;
  34. width = info.width;
  35. wheelbase = info.wheelbase;
  36. ftheta = info.ftheta;
  37. border_plc = info.border_plc;
  38. border_display = info.border_display;
  39. error = info.error;
  40. return *this;
  41. }
  42. };
  43. public:
  44. void setImage(cv::Mat image, int id);
  45. void setImageCL(cv::Mat &image, int id);
  46. void setMask(std::vector<cv::Point> mask, int id);
  47. void setMeasureInfo(MeasureInfo info);
  48. bool getImage(cv::Mat &image, int id, float timeout);
  49. bool getImageCL(cv::Mat &image, int id, float timeout);
  50. bool getMask(std::vector<cv::Point> &mask, int id, float timeout);
  51. bool getMeasureInfo(MeasureInfo &info, float timeout);
  52. private:
  53. TransitData();
  54. std::mutex mutex_;
  55. TimedLockData<cv::Mat> image_[DeviceAzimuth::DEVICE_AZIMUTH_MAX];
  56. TimedLockData<cv::Mat> imageCL_[DeviceAzimuth::DEVICE_AZIMUTH_MAX];
  57. TimedLockData<std::vector<cv::Point>> mask_[DeviceAzimuth::DEVICE_AZIMUTH_MAX];
  58. TimedLockData<MeasureInfo> measureInfo_;
  59. };
  60. #endif //CERES_TEST_TransitData_H