ivdecision.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #ifndef IVDECISION_H
  2. #define IVDECISION_H
  3. #include "ivmodule.h"
  4. #include "modulecomm.h"
  5. #include "gps_type.h"
  6. #include "obstacle_type.h"
  7. #include "gpsimu.pb.h"
  8. #include "radarobjectarray.pb.h"
  9. #include "mobileye.pb.h"
  10. #include "hmi.pb.h"
  11. #include "decition.pb.h"
  12. #include "vbox.pb.h"
  13. #include "v2x.pb.h"
  14. #include "ultrasonic.pb.h"
  15. #include "brainstate.pb.h"
  16. #include <QMutex>
  17. #include <memory>
  18. namespace iv {
  19. class ivdecision : public ivmodule
  20. {
  21. public:
  22. ivdecision();
  23. public:
  24. virtual void modulerun();
  25. public:
  26. virtual int getdecision(iv::brain::decition & xdecition,iv::brain::brainstate & xbs) = 0;
  27. void sharemsg(iv::brain::decition & xdecition,iv::brain::brainstate & xbs);
  28. private:
  29. std::string mstrgpsmsgname = "hcp2_gpsimu";
  30. std::string mstrlidarmsgname = "lidar_obs";
  31. std::string mstrradarmsgname = "radar";
  32. std::string mstrmapmsgname = "tracemap";
  33. std::string mstrmobileyemsgname = "mobileye";
  34. std::string mstrhmimsgname = "hmi";
  35. std::string mstrpadmsgname = "pad";
  36. std::string mstrdecisionmsgname = "deciton";
  37. std::string mstrbrainstatemsgname = "brainstate";
  38. private:
  39. void * mpagpsmsg;
  40. void * mpalidarmsg;
  41. void * mparadarmsg;
  42. void * mpamapmsg;
  43. void * mpamobileyemsg;
  44. void * mpahmimsg;
  45. void * mpapadmsg;
  46. void * mpaDecition;
  47. void * mpaVechicleState;
  48. private:
  49. void UpdateGPS(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  50. void UpdateRADAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  51. void UpdateLIDAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  52. void UpdateMAP(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  53. void UpdateMobileye(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  54. void UpdateHMI(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  55. void UpdateVbox(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  56. void Updatev2x(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  57. void Updateultrasonic(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  58. private:
  59. iv::GPSData mNowGPS;
  60. std::shared_ptr<iv::gps::gpsimu> mGPSIMUptr = 0;
  61. qint64 mnGPSUpdateTime = 0;
  62. QMutex mMutexGPS;
  63. std::shared_ptr<iv::radar::radarobjectarray> mRADAR = 0;
  64. qint64 mnRADARUpdateTime = 0;
  65. QMutex mMutexRADAR;
  66. std::shared_ptr<std::vector<iv::ObstacleBasic> > mlidar_obs;
  67. qint64 mnLIDARUpdateTime = 0;
  68. QMutex mMutexLIDAR;
  69. std::vector<iv::GPSData> mnavigation_data; //导航数据,GPS结构体数组
  70. qint64 mnMAPUpdateTime = 0;
  71. QMutex mMutexMAP;
  72. std::shared_ptr<iv::mobileye::mobileye> mmobileye;
  73. qint64 mnmobileyeUpdateTime = 0;
  74. QMutex mMutexmobileye;
  75. std::shared_ptr<iv::hmi::hmimsg> mHMImsg;
  76. qint64 mnHMIUpdateTime = 0;
  77. QMutex mMutexHMI;
  78. std::shared_ptr<iv::vbox::vbox> mvboxmsg;
  79. qint64 mnvboxUpdateTime = 0;
  80. QMutex mMutexvbox;
  81. std::shared_ptr<iv::v2x::v2x> mv2xmsg;
  82. qint64 mnv2xUpdateTime = 0;
  83. QMutex mMutexv2x;
  84. std::shared_ptr<iv::ultrasonic::ultrasonic> multrasonicmsg;
  85. qint64 mnultrasonicUpdateTime = 0;
  86. QMutex mMutexultrasonic;
  87. private:
  88. const qint64 mnNewThresh = 1000; //1 seconds
  89. public:
  90. bool GetGPS(iv::GPSData & xGPSData);
  91. bool GetRADAR(std::shared_ptr<iv::radar::radarobjectarray> & xRADAR);
  92. bool GetLIDARGrid(iv::LidarGridPtr & lidargridptr);
  93. bool GetLIDARObs(std::shared_ptr<std::vector<iv::ObstacleBasic> > & xlidar_obs);
  94. bool IsMAPUpdate(qint64 & nLastUpdateTime);
  95. bool GetMAP(std::vector<iv::GPSData> & navigation_data,qint64 & nLastUpdateTime);
  96. bool GetMobileye(std::shared_ptr<iv::mobileye::mobileye> & xmobileye);
  97. bool GetHMImsg(std::shared_ptr<iv::hmi::hmimsg> & xhmimsg);
  98. bool Getvboxmsg(std::shared_ptr<iv::vbox::vbox> & xvboxmsg);
  99. bool Getv2xmsg(std::shared_ptr<iv::v2x::v2x> & xv2xmsg);
  100. bool Getultrasonic(std::shared_ptr<iv::ultrasonic::ultrasonic> & xultramsg);
  101. // void GetLidarPtr();
  102. // void GetRadar();
  103. // void GetMap();
  104. // bool IsMapUpdate();
  105. // void GetMobileye();
  106. };
  107. }
  108. #endif // IVDECISION_H