compute_00.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #pragma once
  2. #ifndef _IV_DECITION_COMPUTE_00_
  3. #define _IV_DECITION_COMPUTE_00_
  4. #include <gps_type.h>
  5. #include <obstacle_type.h>
  6. #include <decition_type.h>
  7. #include <vector>
  8. //#include <decision/decide_gps_00.h>
  9. #include "adc_planner/frenet_planner.h"
  10. namespace iv {
  11. namespace decition {
  12. //根据传感器传输来的信息作出决策
  13. class Compute00 {
  14. public:
  15. Compute00();
  16. ~Compute00();
  17. static double maxAngle;
  18. static double angleLimit; //角度限制
  19. static double lastEA; //上一次角度误差
  20. static double lastEP; //上一次位置误差
  21. static double decision_Angle; //决策角度
  22. static double lastAng; //上次角度
  23. static int lastEsrID; //上次毫米波障碍物ID
  24. static int lastEsrCount; //毫米波障碍物累计次数
  25. static int lastEsrIDAvoid; //上次毫米波障碍物ID Avoid
  26. static int lastEsrCountAvoid; //毫米波障碍物累计次数 Avoid
  27. static iv::GPS_INS nearTpoint, farTpoint,dTpoint0,dTpoint1,dTpoint2,dTpoint3;
  28. static double bocheAngle,dBocheAngle;
  29. static int nParkType;
  30. static int getNearestPointIndex(GPS_INS rp, const std::vector<GPSData> gpsMap, int lastIndex, double mindis, double maxAngle);
  31. static int getFirstNearestPointIndex(GPS_INS rp, std::vector<GPSData> gpsMap, int lastIndex, double mindis, double maxAngle);
  32. static int getDesiredSpeed(std::vector<GPSData> gpsMap);
  33. static double getDecideAngle(std::vector<Point2D> gpsTrace, double realSpeed);
  34. static double getAveDef(std::vector<Point2D> farTrace);
  35. static int getSpeedPointIndex(std::vector<Point2D> gpsTrace, double realSpeed);
  36. static Point2D getLidarObsPoint(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr);
  37. static Point2D getLidarRearObsPoint(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr);
  38. static Point2D getLidarObsPointAvoid(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr,double & lidarDistanceAvoid);
  39. static int getEsrIndex(std::vector<Point2D> gpsTrace , int roadNum, int *esrPathpoint,const double xiuzhengCs);
  40. static int getRearEsrIndex(std::vector<Point2D> gpsTrace , int roadNum,const double xiuzhengCs);
  41. static int getEsrIndexAvoid(std::vector<Point2D> gpsTrace);
  42. static double getObsSpeed(Point2D obsPoint, double realSecSpeed);
  43. static double getAvoidAveDef(std::vector<Point2D> farTrace, double avoidX);
  44. static double getDecideAvoidAngle(std::vector<Point2D> gpsTrace, double realSpeed, float avoidX
  45. ,const bool readyParkMode,const int gpsLineParkIndex);
  46. static std::vector<GPSData> getBesideGpsMapLine(iv::GPS_INS now_gps_ins, std::vector<iv::GPSData>gpsMapLine, float avoidX);
  47. static double getDecideAngleByLane(double realSpeed);
  48. static double getDecideAngleByLanePID(double realSpeed);
  49. static double bocheCompute(GPS_INS nowGps, GPS_INS aimGps);
  50. //xvectorPoint save qiedianpoint; dBocheAngle wheel angle; fDirectRearDis first rear dis.
  51. static int bocheCompute(GPS_INS nowGps,GPS_INS aimGps,std::vector<GPS_INS> & xvectorPoint,double & dBocheAngle,double & fDirectRearDis,double l = 2.95);
  52. static double pingfenxian_xielv(double x_1, double y_1, double x_2, double y_2, double angle_1);
  53. static double getQieXianAngle(GPS_INS nowGps, GPS_INS aimGps);
  54. static int bocheDirectCompute(GPS_INS nowGps, GPS_INS aimGps);
  55. //xvectorPoint save qiedianpoint; dBocheAngle wheel angle; fDirectRearDis first rear dis.
  56. static int bocheDirectCompute(GPS_INS nowGps,GPS_INS aimGps,std::vector<GPS_INS> & xvectorPoint,double & dBocheAngle,double & fDirectRearDis,double l = 2.95);
  57. static double min_rad_zhuanxiang(double *R_M, double *min_rad);
  58. static double qiedian_n(double x_1,double y_1,double R_M,double min_rad,
  59. double *x_2, double *y_2, double *real_rad);
  60. static double liangzhixian_jiaodian(double x_1,double y_1,double x_2,double y_2,
  61. double ange1,double real_rad,double *x_3, double *y_3);
  62. static double chuizhipingfenxian_xielv(double x_1,double y_1,double ange1,double real_rad,
  63. double min_rad,double *angle_3);
  64. static double yuanxin(double x_2,double y_2,double x_3,double y_3,double real_rad,
  65. double angle_3,double R_M,double *x_o_1, double *y_o_1, double *x_o_2, double *y_0_2);
  66. static double yuanxin_qiedian(double angel,double x_o_1,double y_o_1, double x_o_2,double y_o_2,
  67. double x_1,double y_1,double x_2,double y_2,double x_3,double y_3,
  68. double real_rad,double angle_3,double R_M,
  69. double *x_t_n, double *y_t_n, double *x_t_f, double *y_t_f);
  70. static int getNoAngleNearestPointIndex(GPS_INS rp, const std::vector<GPSData> gpsMap);
  71. static int getEsrIndexByFrenet(std::vector<Point2D> gpsTrace,FrenetPoint &esrObsPoint, std::vector<iv::GPSData> gpsMap,int pathpoint,GPS_INS nowGps
  72. ,const double xiuzhengCs);
  73. double getObsSpeedByFrenet(Point2D obsPoint, double realSecSpeed,const std::vector<Point2D> gpsTrace, std::vector<iv::GPSData> gpsMap,int pathpoint,GPS_INS nowGps);
  74. private:
  75. };
  76. }
  77. }
  78. extern std::vector<std::vector<iv::GPSData>> gmapsL;
  79. extern std::vector<std::vector<iv::GPSData>> gmapsR;
  80. extern std::vector<int> lastEsrIdVector;
  81. extern std::vector<int> lastEsrCountVector;
  82. #endif // !_IV_DECITION_COMPUTE_00_