SportFunction.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #include "PublicSDKMotion.h"
  2. struct sport_data_struct
  3. {
  4. float pos_x;
  5. float pos_y;
  6. float pos_z;
  7. float acc_x;
  8. float acc_y;
  9. float acc_z;
  10. int front_press;
  11. int back_press;
  12. int jump;
  13. int zupt;
  14. float max_z;
  15. float min_z;
  16. float max_pos_z;
  17. int not_on_floor;
  18. int time_stamp;
  19. };
  20. struct single_jump_data_struct
  21. {
  22. int jump_tag;
  23. int jump_high;
  24. int jump_length;
  25. int start_time_stamp;
  26. };
  27. struct dual_jump_data_struct
  28. {
  29. int live_time;
  30. single_jump_data_struct left_jump_data;
  31. single_jump_data_struct right_jump_data;
  32. };
  33. struct double_press_struct
  34. {
  35. int front_press;
  36. int back_press;
  37. int up_flag;
  38. int get_flag;
  39. };
  40. struct jump_data_struct
  41. {
  42. float max_pos_z;
  43. float max_pos_xy;
  44. };
  45. struct long_jump_data_struct
  46. {
  47. int step_length;
  48. int start_time;
  49. int end_time;
  50. };
  51. class SportFunction : public PublicSDKMotion
  52. {
  53. public:
  54. SportFunction();
  55. void setData(deque<sport_data_struct>& shoes_data_vector, float pos_x, float pos_y, float pos_z,
  56. float acc_x, float acc_y, float acc_z, int front_press, int back_press,
  57. int jump, int zupt, int times_stamp);
  58. void checkShoesData(deque<sport_data_struct>& shoes_data_vector);
  59. int checkRopeSkip(deque<sport_data_struct>& left_shoes_data_vector, deque<sport_data_struct>& right_shoes_data_vector);
  60. void getJumpHighLength(dual_jump_data_struct& dual_jump_data, deque<sport_data_struct>& shoes_data_vector, int left_or_right);
  61. void processJumpHighLength(dual_jump_data_struct& dual_jump_data, int rssi);
  62. void processStepData(deque<sport_data_struct>& shoes_data_vector, int left_or_right);
  63. float getJumpLength(deque<sport_data_struct>& shoes_data_vector);
  64. virtual void Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
  65. int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
  66. int jump, int down, int rssi);
  67. private:
  68. deque<sport_data_struct> left_shoes_data_vector;
  69. deque<sport_data_struct> right_shoes_data_vector;
  70. dual_jump_data_struct dual_jump_data;
  71. single_jump_data_struct left_jump_data;
  72. single_jump_data_struct right_jump_data;
  73. int left_step;
  74. int right_step;
  75. int left_step_length;
  76. int right_step_length;
  77. int step_length;
  78. int jump_count;
  79. int last_jump_count;
  80. int jump_high;
  81. int jump_length;
  82. };