ivdecision.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 <QMutex>
  12. #include <memory>
  13. namespace iv {
  14. class ivdecision : public ivmodule
  15. {
  16. public:
  17. ivdecision();
  18. public:
  19. virtual void modulerun();
  20. public:
  21. virtual void rundecision() = 0;
  22. virtual void sharemsg() = 0;
  23. private:
  24. std::string mstrgpsmsgname = "hcp2_gpsimu";
  25. std::string mstrlidarmsgname = "lidar_obs";
  26. std::string mstrradarmsgname = "radar";
  27. std::string mstrmapmsgname = "tracemap";
  28. std::string mstrmobileyemsgname = "mobileye";
  29. std::string mstrhmimsgname = "hmi";
  30. std::string mstrpadmsgname = "pad";
  31. private:
  32. void * mpagpsmsg;
  33. void * mpalidarmsg;
  34. void * mparadarmsg;
  35. void * mpamapmsg;
  36. void * mpamobileyemsg;
  37. void * mpahmimsg;
  38. void * mpapadmsg;
  39. private:
  40. void UpdateGPS(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  41. void UpdateRADAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  42. void UpdateLIDAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  43. void UpdateMAP(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  44. void UpdateMobileye(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  45. void UpdateHMI(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  46. private:
  47. iv::GPSData mNowGPS;
  48. std::shared_ptr<iv::gps::gpsimu> mGPSIMUptr = 0;
  49. qint64 mnGPSUpdateTime = 0;
  50. QMutex mMutexGPS;
  51. std::shared_ptr<iv::radar::radarobjectarray> mRADAR = 0;
  52. qint64 mnRADARUpdateTime = 0;
  53. QMutex mMutexRADAR;
  54. std::shared_ptr<std::vector<iv::ObstacleBasic> > mlidar_obs;
  55. qint64 mnLIDARUpdateTime = 0;
  56. QMutex mMutexLIDAR;
  57. std::vector<iv::GPSData> mnavigation_data; //导航数据,GPS结构体数组
  58. qint64 mnMAPUpdateTime = 0;
  59. QMutex mMutexMAP;
  60. std::shared_ptr<iv::mobileye::mobileye> mmobileye;
  61. qint64 mnmobileyeUpdateTime = 0;
  62. QMutex mMutexmobileye;
  63. std::shared_ptr<iv::hmi::hmimsg> mHMImsg;
  64. qint64 mnHMIUpdateTime = 0;
  65. QMutex mMutexHMI;
  66. private:
  67. const qint64 mnNewThresh = 1000; //3 seconds
  68. public:
  69. bool GetGPS(iv::GPSData & xGPSData);
  70. bool GetRADAR(std::shared_ptr<iv::radar::radarobjectarray> & xRADAR);
  71. bool GetLIDARGrid(iv::LidarGridPtr & lidargridptr);
  72. bool GetLIDARObs(std::shared_ptr<std::vector<iv::ObstacleBasic> > & xlidar_obs);
  73. bool IsMAPUpdate(qint64 & nLastUpdateTime);
  74. bool GetMAP(std::vector<iv::GPSData> & navigation_data,qint64 & nLastUpdateTime);
  75. bool GetMobileye(std::shared_ptr<iv::mobileye::mobileye> & xmobileye);
  76. bool GetHMImsg(std::shared_ptr<iv::hmi::hmimsg> & xhmimsg);
  77. // void GetLidarPtr();
  78. // void GetRadar();
  79. // void GetMap();
  80. // bool IsMapUpdate();
  81. // void GetMobileye();
  82. };
  83. }
  84. #endif // IVDECISION_H