recharge_tool.hpp 1.0 KB

1234567891011121314151617181920212223242526272829
  1. // recharge_tool.hpp
  2. #ifndef RECHARGE_TOOL_HPP
  3. #define RECHARGE_TOOL_HPP
  4. #include "wheelchair_types.hpp"
  5. #include <vector>
  6. #include <Eigen/Dense>
  7. class RechargeTool
  8. {
  9. public:
  10. static double angleBetween(const IndexPoint &p1, const IndexPoint &p2);
  11. static double angleDiff(double a1, double a2);
  12. static double averageAngle(const std::vector<double> &angles);
  13. static std::vector<std::vector<IndexPoint>> splitPointsToSegments(
  14. const std::vector<IndexPoint> &points,
  15. double angle_threshold_deg = 15.0,
  16. int history_window_size = 3);
  17. static std::pair<double, double> calculateAngleBisector(double k1, double b1, double k2, double b2);
  18. static std::pair<double, double> fitLineLeastSquares(const Eigen::MatrixXd &points);
  19. static std::pair<double, double> computeDockingVelocity(double dx, double dy, double yaw_error);
  20. // 直线拟合(简化版,用于基础功能)
  21. static std::pair<double, double> simpleFitLine(const std::vector<IndexPoint> &points);
  22. };
  23. #endif // RECHARGE_TOOL_HPP