DanceGame.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include "PublicSDKMotion.h"
  2. #define PRESS_WINDOW_SIZE 10
  3. struct origin_pos_struct {
  4. int step_count;
  5. float original_pos_x;
  6. float original_pos_y;
  7. };
  8. enum DANCE_GAME_POINT {
  9. ZERO_POINT = 0,
  10. RIGHT_UP_POINT = 1,
  11. LEFT_UP_POINT = 2,
  12. RIGHT_DOWN_POINT = 3,
  13. LEFT_DOWN_POINT = 4,
  14. };
  15. class DanceGame : public PublicSDKMotion
  16. {
  17. public:
  18. DanceGame();
  19. void setData(deque<shoes_data_cell>& shoes_data_vector, int time_stamp, float pos_x, float pos_y, float pos_z, float heading, float pitch, float roll, int zupt, int rssi);
  20. void calGlobalPos(deque<shoes_data_cell>& shoes_data_vector, deque<shoes_data_cell>& step_data_vector,
  21. float* global_pos, int LEFT_OR_RIGHT);
  22. //void ProcessResult(int zupt, int& zupt_count, int& has_init, float heading,
  23. // float& rotate_heading, float* global_pos, deque<shoes_data_cell>& step_data_vector,
  24. // deque<globalPos_struct>& global_pos_vector, int LEFT_OR_RIGHT);
  25. 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,
  26. int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
  27. int jump, int down, int rssi);
  28. virtual void getResult(int* dec);
  29. virtual float getGamePos(int left_or_right, int index);
  30. void setPolarAccUnzupt(int* max_acc, int* min_acc, int* acc, int zupt);
  31. bool unzuptValid(int* max_acc, int* min_acc);
  32. private:
  33. const float rotate_sin = sin(15.0 / 180 * PI);
  34. const float rotate_cos = cos(15.0 / 180 * PI);
  35. deque<shoes_data_cell> left_shoes_data_vector;
  36. deque<shoes_data_cell> right_shoes_data_vector;
  37. deque<globalPos_struct> right_global_pos_vector;
  38. deque<globalPos_struct> left_global_pos_vector;
  39. float left_step_heading;
  40. float right_step_heading;
  41. float left_global_pos[3];
  42. float right_global_pos[3];
  43. deque<shoes_data_cell> left_step_data_vector;
  44. deque<shoes_data_cell> right_step_data_vector;
  45. float left_step_pos[3];
  46. float right_step_pos[3];
  47. int jump_count;
  48. int down_count;
  49. int last_down;
  50. int last_jump;
  51. int down_wait_after_jump;
  52. int result[4];
  53. int last_left_zupt;
  54. int last_right_zupt;
  55. float left_heading;
  56. float right_heading;
  57. int left_foot_has_init;
  58. int right_foot_has_init;
  59. int left_zupt_count;
  60. int right_zupt_count;
  61. int right_cmd_status;
  62. int left_cmd_status;
  63. int last_right_cmd_status;
  64. int last_left_cmd_status;
  65. int right_cmd_cur_status;
  66. int left_cmd_cur_status;
  67. int rssi_buff[5];
  68. int max_acc_unzupt_left[3];
  69. int min_acc_unzupt_left[3];
  70. int max_acc_unzupt_right[3];
  71. int min_acc_unzupt_right[3];
  72. const int rssi_threshold = 32;
  73. };