detect_manager.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include <thread>
  3. #include "tool/error_code.hpp"
  4. #include "ceres_detect/detect_wheel_ceres.h"
  5. #include "proto/enum_type.pb.h"
  6. #include "proto/detect_message.pb.h"
  7. #include "thread/thread_condition.h"
  8. #include "vzense/device_tof3d.h"
  9. #include "detect/ceres_detect/car_pose_detector.h"
  10. #include "detect/ceres_detect/wheel_detector.h"
  11. #include "detect/ceres_detect/detect_wheel_ceres.h"
  12. #include "detect/data_buf_lable.hpp"
  13. #include "communication/transitData.h"
  14. #include "proto/def.grpc.pb.h"
  15. class DetectManager {
  16. public:
  17. struct DetectResult {
  18. WheelCeresDetector::WheelDetectResult wheel[DeviceAzimuth::DEVICE_AZIMUTH_MAX];
  19. Car_pose_detector::CarDetectResult car;
  20. void reset() {
  21. for (int i = 0; i < DeviceAzimuth::DEVICE_AZIMUTH_MAX; i++) {
  22. wheel[i].reset();
  23. }
  24. car.reset();
  25. }
  26. std::string info() {
  27. std::string str = car.info();
  28. for (int i = 0; i < DeviceAzimuth::DEVICE_AZIMUTH_MAX; i++) {
  29. str += wheel[i].info();
  30. }
  31. return str;
  32. }
  33. };
  34. public:
  35. static DetectManager *iter() {
  36. static DetectManager *instance = nullptr;
  37. if (instance == nullptr) {
  38. instance = new DetectManager();
  39. }
  40. return instance;
  41. }
  42. ~DetectManager() = default;
  43. Error_manager Init();
  44. Error_manager Release();
  45. MeasureStatu getMeasureResult(DetectResult &result);
  46. Error_manager carMoveStatus();
  47. protected:
  48. void run();
  49. void stop();
  50. // 车轮点云优化
  51. Error_manager WheelCloudOptimize(std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> &vct_wheel_cloud, DetectResult &result);
  52. private:
  53. std::thread *m_thread;
  54. Thread_condition m_condit;
  55. TimedLockData<bool> move_statu;
  56. TimedLockData<MeasureStatu> detect_statu;
  57. TimedLockData<DetectResult> m_detect_result_time_lock_data;
  58. };