loaded_mpc.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // Created by zx on 22-12-1.
  3. //
  4. #ifndef LIO_LIVOX_CPP_MPC_LOADED_MPC_H_
  5. #define LIO_LIVOX_CPP_MPC_LOADED_MPC_H_
  6. #include <Eigen/Core>
  7. #include "trajectory.h"
  8. #include "custom_type.h"
  9. class LoadedMPC {
  10. public:
  11. typedef struct {
  12. float shortest_radius;
  13. float dt;
  14. float acc_velocity;
  15. float acc_angular;
  16. } MPC_parameter;
  17. public:
  18. LoadedMPC(const Pose2d &obs, double obs_w, double obs_h, double min_velocity, double max_velocity);
  19. virtual ~LoadedMPC();
  20. virtual MpcError solve(Trajectory trajectory, Pose2d target, Eigen::VectorXd statu, MPC_parameter mpc_param,
  21. std::vector<double> &out, Trajectory &select_traj,
  22. Trajectory &optimize_trajectory,bool directY);
  23. protected:
  24. /*
  25. * 根据当前点和轨迹,选择前方 point_num
  26. * point:当前点,target:目标点
  27. */
  28. static bool filte_Path(const Pose2d &point, Pose2d target,
  29. Trajectory trajectory, std::vector<Pose2d> &poses, int point_num = 10);
  30. /*
  31. * 根据路径点,拟合曲线
  32. */
  33. static Eigen::VectorXd fit_path(const std::vector<Pose2d> &trajectory);
  34. Pose2d obs_relative_pose_; //障碍物相对小车的位姿
  35. double min_velocity_;
  36. double max_velocity_;
  37. double obs_w_;
  38. double obs_h_;
  39. };
  40. #endif //LIO_LIVOX_CPP_MPC_LOADED_MPC_H_