globalrelocation.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef GLOBALRELOCATION_H
  2. #define GLOBALRELOCATION_H
  3. #include <ndt_cpu/NormalDistributionsTransform.h>
  4. #include <thread>
  5. #include <mutex>
  6. #include "ndt_matching.h"
  7. #define MAX_NDT 100
  8. namespace iv {
  9. struct Reloc
  10. {
  11. double x_guess;
  12. double y_guess;
  13. double z_guess;
  14. double yaw_guess;
  15. double pitch_guess;
  16. double roll_guess;
  17. double x_calc;
  18. double y_calc;
  19. double z_calc;
  20. double yaw_calc;
  21. double pitch_calc;
  22. double roll_calc;
  23. double trans_prob;
  24. };
  25. }
  26. class GlobalRelocation
  27. {
  28. public:
  29. GlobalRelocation();
  30. iv::Reloc pointreloc(pcl::PointCloud<pcl::PointXYZ>::Ptr raw_scan);
  31. void setndtmap(std::vector<iv::ndtmaptrace> & xvectorndtmap);
  32. private:
  33. cpu::NormalDistributionsTransform<pcl::PointXYZ, pcl::PointXYZ> mndt[MAX_NDT];
  34. std::vector<iv::ndtmaptrace> mvectorndtmap;
  35. std::vector<iv::Reloc> mvectorReloc;
  36. std::mutex mmutexReloc;
  37. std::vector<iv::ndttracepoint> mvectorseedpoint;
  38. bool mbRelocAvail = false;
  39. bool mthreadcomplete[MAX_NDT];
  40. void threadtest(int n,iv::Reloc & xReloc);
  41. void threadReloc(int nThread,cpu::NormalDistributionsTransform<pcl::PointXYZ, pcl::PointXYZ> * pndt,
  42. pcl::PointCloud<pcl::PointXYZ>::Ptr raw_scan,
  43. iv::Reloc xReloc);
  44. void RunReloc(std::vector<iv::ndttracepoint> & xtrace,pcl::PointCloud<pcl::PointXYZ>::Ptr raw_scan,bool bCheckComplete);
  45. int mnThreadNum = 8;
  46. std::thread * mpthread[MAX_NDT];
  47. const double mfSeedDisThresh = 3.0;
  48. const int mnCirclDivide = 20;
  49. };
  50. #endif // GLOBALRELOCATION_H