loc_message.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #ifndef __LOC_MESSAGE__HPP
  2. #define __LOC_MESSAGE__HPP
  3. #include "ant.h"
  4. struct loc_message
  5. {
  6. std::shared_ptr<site> m_sit;
  7. uint64_t m_num_ticks; //tof时间片m_tof或tdoa相对root时间
  8. uint64_t m_loc_time;
  9. uint32_t m_card_id;
  10. int32_t m_card_ct;
  11. int8_t m_card_type;
  12. int8_t m_ant_id;
  13. int16_t m_rav;
  14. int16_t m_acc;
  15. uint16_t m_sync_ct;
  16. uint16_t m_rssi;
  17. uint16_t m_batstatus;
  18. // tdoa内容
  19. uint64_t m_interpolation; // 线性插值
  20. uint8_t m_loc_type; // 数据类型:0为tof,1为tdoa
  21. uint8_t m_loc_dimension; // 定位维度
  22. double m_freq; // 卡定位频率值
  23. // pdoa内容
  24. double m_poa[3]; // 三天线的相位值
  25. loc_message()
  26. :m_num_ticks(0)
  27. {
  28. }
  29. int tool_index()const
  30. {
  31. return m_sit->index();
  32. }
  33. loc_message(std::shared_ptr<site> s,uint64_t num_ticks,uint64_t timestamp,
  34. uint32_t cardid,int32_t ct,int8_t type,int8_t antid,
  35. int16_t rav,int16_t acc,uint16_t sync_ct,uint16_t rssi,uint16_t batstatus)
  36. :m_sit(s)
  37. ,m_num_ticks(num_ticks)
  38. ,m_loc_time(timestamp)
  39. ,m_card_id(cardid)
  40. ,m_card_ct(ct)
  41. ,m_card_type(type)
  42. ,m_ant_id(antid)
  43. ,m_rav(rav)
  44. ,m_acc(acc)
  45. ,m_sync_ct(sync_ct)
  46. ,m_rssi(rssi)
  47. ,m_batstatus(batstatus)
  48. ,m_interpolation(0)
  49. ,m_loc_type(0)
  50. ,m_loc_dimension(0)
  51. ,m_freq(0.0)
  52. {
  53. m_poa[0] = m_poa[1] = m_poa[2] = 0.0;
  54. }
  55. // tdoa定位数据,16
  56. loc_message(std::shared_ptr<site> s, uint64_t num_ticks, uint64_t timestamp,
  57. uint32_t cardid,int32_t ct,int8_t type,int8_t antid,
  58. int16_t rav,int16_t acc,uint16_t sync_ct,uint16_t rssi,uint16_t batstatus,
  59. uint64_t _interpolation, uint8_t _loc_type, uint8_t _dim, uint8_t _freq)
  60. :m_sit(s)
  61. ,m_num_ticks(num_ticks)
  62. ,m_loc_time(timestamp)
  63. ,m_card_id(cardid)
  64. ,m_card_ct(ct)
  65. ,m_card_type(type)
  66. ,m_ant_id(antid)
  67. ,m_rav(rav)
  68. ,m_acc(acc)
  69. ,m_sync_ct(sync_ct)
  70. ,m_rssi(rssi)
  71. ,m_batstatus(batstatus)
  72. ,m_interpolation(_interpolation)
  73. ,m_loc_type(_loc_type)
  74. ,m_loc_dimension(_dim)
  75. ,m_freq(_freq)
  76. {
  77. m_poa[0] = m_poa[1] = m_poa[2] = 0.0;
  78. }
  79. // pdoa定位数据,17
  80. loc_message(std::shared_ptr<site> s,uint64_t num_ticks,uint64_t timestamp,
  81. uint32_t cardid,int32_t ct,int8_t type,int8_t antid,
  82. int16_t rav,int16_t acc,uint16_t sync_ct,uint16_t rssi,uint16_t batstatus
  83. ,uint8_t _loc_type, uint8_t _dim, double _poa0, double _poa1, double _poa2)
  84. :m_sit(s)
  85. ,m_num_ticks(num_ticks)
  86. ,m_loc_time(timestamp)
  87. ,m_card_id(cardid)
  88. ,m_card_ct(ct)
  89. ,m_card_type(type)
  90. ,m_ant_id(antid)
  91. ,m_rav(rav)
  92. ,m_acc(acc)
  93. ,m_sync_ct(sync_ct)
  94. ,m_rssi(rssi)
  95. ,m_batstatus(batstatus)
  96. ,m_loc_type(_loc_type)
  97. ,m_loc_dimension(_dim)
  98. {
  99. m_poa[0] = _poa0;
  100. m_poa[1] = _poa1;
  101. m_poa[2] = _poa2;
  102. }
  103. loc_message& operator=(const loc_message& lhs)
  104. {
  105. if(this != &lhs){
  106. this->m_sit = lhs.m_sit;
  107. this->m_num_ticks = lhs.m_num_ticks;
  108. this->m_loc_time = lhs.m_loc_time;
  109. this->m_card_id = lhs.m_card_id;
  110. this->m_card_ct = lhs.m_card_ct;
  111. this->m_card_type = lhs.m_card_type;
  112. this->m_ant_id = lhs.m_ant_id;
  113. this->m_rav = lhs.m_rav;
  114. this->m_acc = lhs.m_acc;
  115. this->m_sync_ct = lhs.m_sync_ct;
  116. this->m_rssi = lhs.m_rssi;
  117. this->m_batstatus = lhs.m_batstatus;
  118. this->m_loc_type = lhs.m_loc_type;
  119. this->m_loc_dimension = lhs.m_loc_dimension;
  120. this->m_poa[0] = lhs.m_poa[0];
  121. this->m_poa[1] = lhs.m_poa[1];
  122. this->m_poa[2] = lhs.m_poa[2];
  123. this->m_interpolation = lhs.m_interpolation;
  124. this->m_freq = lhs.m_freq;
  125. }
  126. return *this;
  127. }
  128. };
  129. struct pdoa_message: point{
  130. double angle;
  131. double distance;
  132. double x_ant;
  133. double y_ant;
  134. pdoa_message(const double& _x, const double& _y, const double& _angle, const double& _distance, const double& _ax, const double& _ay):point(_x, _y), angle(_angle), distance(_distance), x_ant(_ax), y_ant(_ay)
  135. {}
  136. pdoa_message():point(0.0, 0.0),angle(0.0), distance(0.0), x_ant(0.0), y_ant(0.0)
  137. {}
  138. };
  139. using pdoa_msg_ptr = std::shared_ptr<pdoa_message>;
  140. struct pdoa_param{
  141. double pdoa;
  142. double r;
  143. double a;
  144. double ax;
  145. double ay;
  146. pdoa_param(const double& _pdoa, const double& _r, const double& _a, const double& _ax, double& _ay):pdoa(_pdoa), r(_r), a(_a), ax(_ax), ay(_ay)
  147. {}
  148. pdoa_param():pdoa(0.0), r(0.0), a(0.0), ax(0.0), ay(0.0)
  149. {}
  150. };
  151. #endif