ivdecision.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 "radio_send.pb.h"
  17. #include "chassis.pb.h"
  18. #include <QMutex>
  19. #include <memory>
  20. namespace iv {
  21. class ivdecision : public ivmodule
  22. {
  23. public:
  24. ivdecision();
  25. public:
  26. virtual void modulerun();
  27. public:
  28. virtual int getdecision(iv::brain::decition & xdecition,iv::brain::brainstate & xbs) = 0;
  29. void sharemsg(iv::brain::decition & xdecition,iv::brain::brainstate & xbs);
  30. private:
  31. std::string mstrgpsmsgname = "hcp2_gpsimu";
  32. std::string mstrlidarmsgname = "lidar_obs";
  33. std::string mstrradarmsgname = "radar";
  34. std::string mstrmapmsgname = "tracemap";
  35. std::string mstrmobileyemsgname = "mobileye";
  36. std::string mstrhmimsgname = "hmi";
  37. std::string mstrpadmsgname = "pad";
  38. std::string mstrp900msgname = "p900_send";
  39. std::string mstrv2xmsgname = "v2x";
  40. std::string mstrultramsgname = "ultra";
  41. std::string mstrvboxmsgname = "vbox";
  42. std::string mstrchassismsgname = "chassis";
  43. std::string mstrdecisionmsgname = "deciton";
  44. std::string mstrbrainstatemsgname = "brainstate";
  45. private:
  46. void * mpagpsmsg;
  47. void * mpalidarmsg;
  48. void * mparadarmsg;
  49. void * mpamapmsg;
  50. void * mpamobileyemsg;
  51. void * mpahmimsg;
  52. void * mpapadmsg;
  53. void * mpap900msg;
  54. void * mpav2xmsg;
  55. void * mpaultramsg;
  56. void * mpavboxmsg;
  57. void * mpachassismsg;
  58. void * mpaDecition;
  59. void * mpaVechicleState;
  60. private:
  61. void UpdateGPS(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  62. void UpdateRADAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  63. void UpdateLIDAR(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  64. void UpdateMAP(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  65. void UpdateMobileye(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  66. void UpdateHMI(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  67. void UpdateVbox(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  68. void Updatev2x(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  69. void Updateultrasonic(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  70. void Updatep900(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  71. void UpdatepChassis(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  72. private:
  73. iv::GPSData mNowGPS;
  74. std::shared_ptr<iv::gps::gpsimu> mGPSIMUptr = 0;
  75. qint64 mnGPSUpdateTime = 0;
  76. QMutex mMutexGPS;
  77. std::shared_ptr<iv::radar::radarobjectarray> mRADAR = 0;
  78. qint64 mnRADARUpdateTime = 0;
  79. QMutex mMutexRADAR;
  80. std::shared_ptr<std::vector<iv::ObstacleBasic> > mlidar_obs;
  81. qint64 mnLIDARUpdateTime = 0;
  82. QMutex mMutexLIDAR;
  83. std::vector<iv::GPSData> mnavigation_data; //导航数据,GPS结构体数组
  84. qint64 mnMAPUpdateTime = 0;
  85. QMutex mMutexMAP;
  86. std::shared_ptr<iv::mobileye::mobileye> mmobileye;
  87. qint64 mnmobileyeUpdateTime = 0;
  88. QMutex mMutexmobileye;
  89. std::shared_ptr<iv::hmi::hmimsg> mHMImsg;
  90. qint64 mnHMIUpdateTime = 0;
  91. QMutex mMutexHMI;
  92. std::shared_ptr<iv::vbox::vbox> mvboxmsg;
  93. qint64 mnvboxUpdateTime = 0;
  94. QMutex mMutexvbox;
  95. std::shared_ptr<iv::v2x::v2x> mv2xmsg;
  96. qint64 mnv2xUpdateTime = 0;
  97. QMutex mMutexv2x;
  98. std::shared_ptr<iv::ultrasonic::ultrasonic> multrasonicmsg;
  99. qint64 mnultrasonicUpdateTime = 0;
  100. QMutex mMutexultrasonic;
  101. std::shared_ptr<iv::radio::radio_send> mp900msg;
  102. qint64 mnp900UpdateTime = 0;
  103. QMutex mMutexp900;
  104. std::shared_ptr<iv::chassis> mchassismsg;
  105. qint64 mnchassisUpdateTime = 0;
  106. QMutex mMutexchassis;
  107. private:
  108. const qint64 mnNewThresh = 1000; //1 seconds
  109. public:
  110. bool GetGPS(iv::GPSData & xGPSData);
  111. bool GetRADAR(std::shared_ptr<iv::radar::radarobjectarray> & xRADAR);
  112. bool GetLIDARGrid(iv::LidarGridPtr & lidargridptr);
  113. bool GetLIDARObs(std::shared_ptr<std::vector<iv::ObstacleBasic> > & xlidar_obs);
  114. bool IsMAPUpdate(qint64 & nLastUpdateTime);
  115. bool GetMAP(std::vector<iv::GPSData> & navigation_data,qint64 & nLastUpdateTime);
  116. bool GetMobileye(std::shared_ptr<iv::mobileye::mobileye> & xmobileye);
  117. bool GetHMImsg(std::shared_ptr<iv::hmi::hmimsg> & xhmimsg);
  118. bool Getvboxmsg(std::shared_ptr<iv::vbox::vbox> & xvboxmsg);
  119. bool Getv2xmsg(std::shared_ptr<iv::v2x::v2x> & xv2xmsg);
  120. bool Getultrasonic(std::shared_ptr<iv::ultrasonic::ultrasonic> & xultramsg);
  121. bool Getp900(std::shared_ptr<iv::radio::radio_send> & xp900msg);
  122. bool Getchassis(std::shared_ptr<iv::chassis> & xchassismsg);
  123. // void GetLidarPtr();
  124. // void GetRadar();
  125. // void GetMap();
  126. // bool IsMapUpdate();
  127. // void GetMobileye();
  128. };
  129. }
  130. #endif // IVDECISION_H