ivdecision.h 3.3 KB

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