ivdecision.h 4.3 KB

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