mpc_tools.h 768 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef MPC_TOOLS_HH
  2. #define MPC_TOOLS_HH
  3. #include <vector>
  4. #include <Eigen/Core>
  5. #include <Eigen/QR>
  6. #include <pcl/point_types.h>
  7. // For converting back and forth between radians and degrees.
  8. constexpr double pi() { return M_PI; }
  9. double deg2rad(double x) { return x * pi() / 180; }
  10. double rad2deg(double x) { return x * 180 / pi(); }
  11. class mpc_tools{
  12. public:
  13. mpc_tools();
  14. ~mpc_tools();
  15. Eigen::VectorXd polyfit(Eigen::VectorXd xvals, Eigen::VectorXd yvals, int order);
  16. double polyeval(Eigen::VectorXd coeffs, double x);
  17. bool filterPath(pcl::PointXYZ curr_pos, double theta, Eigen::VectorXd *x_car, Eigen::VectorXd *y_car, int numOfPoints);
  18. public:
  19. std::vector<double> ptsx;
  20. std::vector<double> ptsy;
  21. };
  22. #endif /* MPC_TOOLS_HH */