pid_controller.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _IV_DECITION__PID_CONTROLLER_
  2. #define _IV_DECITION__PID_CONTROLLER_
  3. #include <gps_type.h>
  4. #include <decition_type.h>
  5. #include <obstacle_type.h>
  6. #include<vector>
  7. #include <gnss_coordinate_convert.h>
  8. #include <adc_controller/base_controller.h>
  9. #include <adc_tools/transfer.h>
  10. namespace iv {
  11. namespace decition {
  12. //根据传感器传输来的信息作出决策
  13. class PIDController: public BaseController {
  14. public:
  15. float lastEA;
  16. float lastEP;
  17. float lastAng;
  18. float angleLimit=600;
  19. float lastU ;
  20. float lastEv ;
  21. float lastVt ;
  22. float Iv;
  23. float eAngSum=0;
  24. float ePosSum=0;
  25. PIDController();
  26. ~PIDController();
  27. /**
  28. * @brief getControlDecition
  29. * pid方式计算横向方向盘和纵向加速度
  30. *
  31. * @param now_gps_ins 实时gps信息
  32. * @param path 目标路径
  33. * @param dSpeed 决策速度
  34. * @param obsDistacne 障碍物距离
  35. * @param obsSpeed 障碍物速度
  36. * @param computeAngle 是否要计算方向盘角度
  37. * @param computeAcc 是否要计算纵向加速度
  38. * @param decition 决策信息结构体的指针
  39. * @return iv::decition::Decition
  40. */
  41. iv::decition::Decition getControlDecition(GPS_INS now_gps_ins, std::vector<Point2D> path,float dSpeed, float obsDistacne,float obsSpeed,
  42. bool computeAngle, bool computeAcc, Decition *decition);
  43. float getPidAngle (float realSpeed, std::vector<Point2D> trace,int roadMode);
  44. float getAveDef (std::vector<Point2D> farTrace);
  45. float getPidAcc (GPS_INS gpsIns,float dSpeed, float obsDistacne, float obsSpeed);
  46. float computeU(float obsDistance, float ds,float vs,float vt,float vh,float vl,float ttc,float ttcr);
  47. float limiteU(float u ,float ttc);
  48. private:
  49. };
  50. }
  51. }
  52. #endif // PID_CONTROLLER_H