compute_00.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 getNearestPointIndex(GPS_INS rp, const std::vector<GPSData> gpsMap, int lastIndex, double mindis, double maxAngle);
  30. static int getFirstNearestPointIndex(GPS_INS rp, std::vector<GPSData> gpsMap, int lastIndex, double mindis, double maxAngle);
  31. static int getDesiredSpeed(std::vector<GPSData> gpsMap);
  32. static double getDecideAngle(std::vector<Point2D> gpsTrace, double realSpeed);
  33. static double getAveDef(std::vector<Point2D> farTrace);
  34. static int getSpeedPointIndex(std::vector<Point2D> gpsTrace, double realSpeed);
  35. static Point2D getLidarObsPoint(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr);
  36. static Point2D getLidarRearObsPoint(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr);
  37. static Point2D getLidarObsPointAvoid(std::vector<Point2D> gpsTrace, iv::LidarGridPtr lidarGridPtr,double & lidarDistanceAvoid);
  38. static int getEsrIndex(std::vector<Point2D> gpsTrace , int roadNum, int *esrPathpoint,const double xiuzhengCs);
  39. static int getRearEsrIndex(std::vector<Point2D> gpsTrace , int roadNum,const double xiuzhengCs);
  40. static int getEsrIndexAvoid(std::vector<Point2D> gpsTrace);
  41. static double getObsSpeed(Point2D obsPoint, double realSecSpeed);
  42. static double getAvoidAveDef(std::vector<Point2D> farTrace, double avoidX);
  43. static double getDecideAvoidAngle(std::vector<Point2D> gpsTrace, double realSpeed, float avoidX
  44. ,const bool readyParkMode,const int gpsLineParkIndex);
  45. static std::vector<GPSData> getBesideGpsMapLine(iv::GPS_INS now_gps_ins, std::vector<iv::GPSData>gpsMapLine, float avoidX);
  46. static double getDecideAngleByLane(double realSpeed);
  47. static double getDecideAngleByLanePID(double realSpeed);
  48. static double bocheCompute(GPS_INS nowGps, GPS_INS aimGps);
  49. static double pingfenxian_xielv(double x_1, double y_1, double x_2, double y_2, double angle_1);
  50. static double getQieXianAngle(GPS_INS nowGps, GPS_INS aimGps);
  51. static int bocheDirectCompute(GPS_INS nowGps, GPS_INS aimGps);
  52. static double min_rad_zhuanxiang(double *R_M, double *min_rad);
  53. static double qiedian_n(double x_1,double y_1,double R_M,double min_rad,
  54. double *x_2, double *y_2, double *real_rad);
  55. static double liangzhixian_jiaodian(double x_1,double y_1,double x_2,double y_2,
  56. double ange1,double real_rad,double *x_3, double *y_3);
  57. static double chuizhipingfenxian_xielv(double x_1,double y_1,double ange1,double real_rad,
  58. double min_rad,double *angle_3);
  59. static double yuanxin(double x_2,double y_2,double x_3,double y_3,double real_rad,
  60. double angle_3,double R_M,double *x_o_1, double *y_o_1, double *x_o_2, double *y_0_2);
  61. static double yuanxin_qiedian(double angel,double x_o_1,double y_o_1, double x_o_2,double y_o_2,
  62. double x_1,double y_1,double x_2,double y_2,double x_3,double y_3,
  63. double real_rad,double angle_3,double R_M,
  64. double *x_t_n, double *y_t_n, double *x_t_f, double *y_t_f);
  65. static int getNoAngleNearestPointIndex(GPS_INS rp, const std::vector<GPSData> gpsMap);
  66. static int getEsrIndexByFrenet(std::vector<Point2D> gpsTrace,FrenetPoint &esrObsPoint, std::vector<iv::GPSData> gpsMap,int pathpoint,GPS_INS nowGps
  67. ,const double xiuzhengCs);
  68. double getObsSpeedByFrenet(Point2D obsPoint, double realSecSpeed,const std::vector<Point2D> gpsTrace, std::vector<iv::GPSData> gpsMap,int pathpoint,GPS_INS nowGps);
  69. private:
  70. };
  71. }
  72. }
  73. extern std::vector<std::vector<iv::GPSData>> gmapsL;
  74. extern std::vector<std::vector<iv::GPSData>> gmapsR;
  75. extern std::vector<int> lastEsrIdVector;
  76. extern std::vector<int> lastEsrCountVector;
  77. #endif // !_IV_DECITION_COMPUTE_00_