DanceGame.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #include "PublicSDKMotion.h"
  2. #define PRESS_WINDOW_SIZE 10
  3. #define RSSI_LEN 10
  4. struct origin_pos_struct {
  5. int step_count;
  6. float original_pos_x;
  7. float original_pos_y;
  8. };
  9. enum DANCE_GAME_POINT {
  10. ZERO_POINT = 0,
  11. RIGHT_UP_POINT = 1,
  12. LEFT_UP_POINT = 2,
  13. RIGHT_DOWN_POINT = 3,
  14. LEFT_DOWN_POINT = 4,
  15. };
  16. //缓存一定时间的rssi,中间缓存一步间的轨迹数据,最后再继续缓存rssi数据
  17. struct shoes_data_rssi_struct
  18. {
  19. int rssi_count;
  20. deque<shoes_data_cell> step_data_deque;
  21. };
  22. class DanceGame : public PublicSDKMotion
  23. {
  24. public:
  25. DanceGame();
  26. void set_shoes_data_with_rssi(deque<shoes_data_cell>& step_data_vector, deque<shoes_data_cell>& shoes_data_rssi_vector);
  27. 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,
  28. int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
  29. int jump, int down, int rssi);
  30. private:
  31. deque<shoes_data_cell> left_shoes_data_vector;
  32. deque<shoes_data_cell> right_shoes_data_vector;
  33. deque<globalPos_struct> right_global_pos_vector;
  34. deque<globalPos_struct> left_global_pos_vector;
  35. deque<shoes_data_rssi_struct> left_shoes_data_rssi_vector;
  36. deque<shoes_data_rssi_struct> right_shoes_data_rssi_vector;
  37. float left_step_heading;
  38. float right_step_heading;
  39. deque<shoes_data_cell> left_step_data_vector;
  40. deque<shoes_data_cell> right_step_data_vector;
  41. float left_step_pos[3];
  42. float right_step_pos[3];
  43. int last_left_zupt;
  44. int last_right_zupt;
  45. float left_heading;
  46. float right_heading;
  47. int left_foot_has_init;
  48. int right_foot_has_init;
  49. int left_zupt_count;
  50. int right_zupt_count;
  51. int right_cmd_status;
  52. int left_cmd_status;
  53. int last_right_cmd_status;
  54. int last_left_cmd_status;
  55. int right_cmd_cur_status;
  56. int left_cmd_cur_status;
  57. const int rssi_threshold = 32;
  58. int right_cmd_wait_time;
  59. int left_cmd_wait_time;
  60. int zero_point_wait_time;
  61. };