real_match_2d.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _REAL_MATCH_2D_H_
  2. #define _REAL_MATCH_2D_H_
  3. #include "common/common.h"
  4. #include "map/map.h"
  5. namespace hlzn_slam {
  6. class RealTimeMatch2D {
  7. public:
  8. RealTimeMatch2D();
  9. ~RealTimeMatch2D(){}
  10. /**
  11. * @说明: 设置匹配搜索的范围
  12. * @param
  13. * linear_range [in] : 线性搜索范围
  14. * angle_range [in] : 角度搜索范围
  15. * linear_step [in] : 线性搜索步长
  16. * angle_step [in] : 角度搜索步长
  17. */
  18. void setSearchRange(const float linear_range, const float angle_range, const float linear_step = 0.05, const float angle_step = 0.017);
  19. float match(const common::PointCloud& point_cloud,
  20. const common::Rigid2f& init_pose,
  21. common::Rigid2f& opt_pose,
  22. Map& map,
  23. bool use_smart = false);
  24. float towerMatch(const common::PointCloud& point_cloud, const common::Rigid2f& init_pose,
  25. common::Rigid2f& opt_pose, Map& map, const float multiple = 2.0, bool use_smart = false);
  26. private:
  27. float __match(const common::PointCloud& point_cloud, const common::Rigid2f& init_pose,
  28. common::Rigid2f& opt_pose, const std::vector<common::Rigid2f>& transforms,
  29. Map& map);
  30. float __smartMatch(const common::PointCloud& point_cloud,
  31. const common::Rigid2f& init_pose,
  32. common::Rigid2f& opt_pose,
  33. const std::vector<common::Rigid2f>& transforms, Map& map);
  34. common::PointCloud __transformPointCloud(
  35. const common::PointCloud& point_cloud, const common::Rigid2f& transform);
  36. std::vector<common::Rigid2f> __generateTransfroms(const float linear_range,
  37. const float angle_range,
  38. const float linear_step,
  39. const float angle_step);
  40. float linear_range_,
  41. angle_range_,
  42. linear_step_,
  43. angle_step_;
  44. std::vector<common::Rigid2f> transforms_;
  45. };
  46. }
  47. #endif