WheelFactor.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // Created by zx on 23-9-20.
  3. //
  4. #pragma once
  5. #include <sys/param.h>
  6. #include <pcl/point_types.h>
  7. #include <pcl/point_cloud.h>
  8. #include "defines.hpp"
  9. class WheelsPredictor {
  10. public:
  11. struct PreResult{
  12. double x;
  13. double y;
  14. double theta;
  15. double w;
  16. double wheelBase;
  17. double frontTheta;
  18. std::string log() {
  19. std::string log = ("x: " + std::to_string(x) +
  20. ", y: " + std::to_string(y) +
  21. ", theta: " + std::to_string(theta) +
  22. ", w: " + std::to_string(w) +
  23. ", wheelBase: " + std::to_string(wheelBase) +
  24. ", frontTheta: " + std::to_string(frontTheta));
  25. return log;
  26. }
  27. };
  28. public:
  29. WheelsPredictor();
  30. ~WheelsPredictor();
  31. void reset();
  32. bool update(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, double cx, double cy, double theta,
  33. double width, double wheelbase);
  34. bool predict(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, double theta, PreResult &res);
  35. protected:
  36. bool valid_;
  37. double length_;
  38. double wheelBase_;
  39. double width_;
  40. double diff_;
  41. };