loc_tool.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef __loc_tool_hpp__
  2. #define __loc_tool_hpp__
  3. #include "loc_message.h"
  4. #define DWT_TIME_UNITS (1.0/499.2E6/128.0)
  5. #define SPEED_OF_LIGHT (299702547.0)
  6. struct ant;
  7. struct message_locinfo;
  8. struct loc_tool
  9. {
  10. virtual std::vector<point> calc_location(std::vector<loc_message>&locm)=0;
  11. virtual int index()
  12. {
  13. return -1;
  14. }
  15. virtual ~loc_tool(){}
  16. };
  17. struct loc_tool_tdoa_3_base:loc_tool
  18. {
  19. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  20. virtual int index();
  21. };
  22. struct loc_tool_tdoa_2_base:loc_tool
  23. {
  24. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  25. virtual int index();
  26. bool is_in_triangle(const std::vector<point>& vps, const point& p);
  27. double get_triangle_area(const point& p0, const point& p1, const point&p2);
  28. };
  29. struct loc_tool_tdoa_1_base:loc_tool
  30. {
  31. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  32. virtual int index();
  33. };
  34. struct loc_tool_pdoa_1_base:loc_tool
  35. {
  36. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  37. virtual int index();
  38. };
  39. struct loc_tool_pdoa_2_base:loc_tool
  40. {
  41. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  42. virtual int index();
  43. bool cal_position_pdoa(std::vector<pdoa_msg_ptr>& vps, const pdoa_param& pa);
  44. };
  45. struct loc_tool_pdoa_3_base:loc_tool
  46. {
  47. virtual std::vector<point> calc_location(std::vector<loc_message>& locm);
  48. virtual int index();
  49. };
  50. struct loc_tool_tof_3_base:loc_tool
  51. {
  52. virtual std::vector<point> calc_location(std::vector<loc_message>&locm);
  53. virtual int index();
  54. };
  55. struct loc_tool_tof_2_base:loc_tool
  56. {
  57. virtual std::vector<point> calc_location(std::vector<loc_message>&locm);
  58. virtual int index();
  59. };
  60. struct loc_tool_tof_1_base:loc_tool
  61. {
  62. virtual std::vector<point> calc_location(std::vector<loc_message>&locm);
  63. virtual int index();
  64. };
  65. struct loc_tool_main:loc_tool
  66. {
  67. static loc_tool* g_tool[9]; // 6
  68. loc_tool_main();
  69. ~loc_tool_main();
  70. static void set_tool(loc_tool*tool);
  71. std::vector<point> calc_location(std::vector<loc_message>&locm);
  72. };
  73. #endif