detect_wheel_ceres.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Created by zx on 2020/7/1.
  3. //
  4. #ifndef CERES_TEST_DETECT_WHEEL_CERES_H
  5. #define CERES_TEST_DETECT_WHEEL_CERES_H
  6. #include <ceres/ceres.h>
  7. #include <glog/logging.h>
  8. #include <pcl/point_types.h>
  9. #include <pcl/point_cloud.h>
  10. #include <pcl/common/centroid.h>
  11. #include <opencv2/opencv.hpp>
  12. class detect_wheel_ceres {
  13. public:
  14. static detect_wheel_ceres *iter() {
  15. static detect_wheel_ceres *instance = nullptr;
  16. if (instance == nullptr) {
  17. instance = new detect_wheel_ceres();
  18. }
  19. return instance;
  20. }
  21. ~detect_wheel_ceres();
  22. bool detect_2Step(pcl::PointCloud<pcl::PointXYZ>::Ptr cl1,pcl::PointCloud<pcl::PointXYZ>::Ptr cl2,
  23. pcl::PointCloud<pcl::PointXYZ>::Ptr cl3,pcl::PointCloud<pcl::PointXYZ>::Ptr cl4,
  24. float& cx,float& cy,float& theta,float& wheel_base,float& width,float& front_theta,float& loss);
  25. /*
  26. * 只检测动态参数, 固定参数已知
  27. */
  28. bool detect_dynP(pcl::PointCloud<pcl::PointXYZ>::Ptr cl1,pcl::PointCloud<pcl::PointXYZ>::Ptr cl2,
  29. pcl::PointCloud<pcl::PointXYZ>::Ptr cl3,pcl::PointCloud<pcl::PointXYZ>::Ptr cl4,
  30. float& cx,float& cy,float& theta,float& wheel_base,float& width,float& front_theta,float& loss);
  31. private:
  32. detect_wheel_ceres();
  33. bool detect_RYL(pcl::PointCloud<pcl::PointXYZ>::Ptr cl1,pcl::PointCloud<pcl::PointXYZ>::Ptr cl2,
  34. pcl::PointCloud<pcl::PointXYZ>::Ptr cl3,pcl::PointCloud<pcl::PointXYZ>::Ptr cl4,
  35. float& cx,float& cy,float& theta,float& wheel_base,float& width,float& front_theta,float& loss);
  36. bool detect_XWF(pcl::PointCloud<pcl::PointXYZ>::Ptr cl1,pcl::PointCloud<pcl::PointXYZ>::Ptr cl2,
  37. pcl::PointCloud<pcl::PointXYZ>::Ptr cl3,pcl::PointCloud<pcl::PointXYZ>::Ptr cl4,
  38. float& cx,float& cy,float& theta,float& wheel_base,float& width,float& front_theta,float& loss);
  39. pcl::PointCloud<pcl::PointXYZ>::Ptr filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,float r);
  40. pcl::PointCloud<pcl::PointXYZ>::Ptr m_left_front_cloud; //左前点云
  41. pcl::PointCloud<pcl::PointXYZ>::Ptr m_right_front_cloud; //右前点云
  42. pcl::PointCloud<pcl::PointXYZ>::Ptr m_left_rear_cloud; //左后点云
  43. pcl::PointCloud<pcl::PointXYZ>::Ptr m_right_rear_cloud; //右后点云
  44. public:
  45. cv::Mat m_map; //保存一份地图用作匹配
  46. cv::Mat m_mapr;
  47. std::vector<double> m_line_l;
  48. std::vector<double> m_line_r;
  49. std::vector<double> m_line_y_2stp;
  50. std::vector<double> m_line_y;
  51. };
  52. #endif //CERES_TEST_DETECT_WHEEL_CERES_H