SingleFootAction.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include "pub.h"
  2. #include "ctime"
  3. #define STOP_ANGLE -0.65f
  4. class SingleFootAction {
  5. public:
  6. SingleFootAction(int foot_type) : can_report_motion(0), pause_signal(0), enter_signal(0),
  7. direction_signal(-1), last_zupt(1), left_or_right(foot_type), interation_state(-1),
  8. last_x(0), last_y(0), last_z(0), big_pitch_count(0), can_report_enter_signal(0), last_enter_signal(0),
  9. enter_signal_cooling(0)
  10. {};
  11. void can_listen_direction_signal(int rssi);
  12. //void pause_signal_listen(float pitch);
  13. int direction_signal_listen(int x, int y, int zupt, int rssi);
  14. //void set_motion_signal(int zupt);
  15. //获取垫脚的以及暂停的信号
  16. int enter_signal_listen(float* acc, float pitch);
  17. int can_listen_enter_signal(float* acc, float pitch);
  18. FootActionState get_interation_state();
  19. void run(uint32_t _time, int x, int y, int z, int zupt, int rssi, float pitch, float* acc);
  20. //新的脚步命令
  21. int direction_signal_listen_new(uint32_t _time, int x, int y, int zupt, int rssi, float pitch);
  22. void reset_interation_state();
  23. int enter_signal_listen_new(uint32_t _time, float* acc, float pitch, int zupt_trigger);
  24. private:
  25. int pause_signal_count;
  26. int can_report_motion;
  27. int pause_signal;
  28. int enter_signal;
  29. int direction_signal;
  30. int last_zupt;
  31. int left_or_right;
  32. int interation_state;
  33. int last_x;
  34. int last_y;
  35. int last_z;
  36. float acc_x_buff[10];
  37. float big_pitch_count;
  38. int shake_tag = 0;
  39. int station_count = 0;
  40. float acc_x_max = 0;
  41. float acc_x_min = 0;
  42. int can_report_enter_signal;
  43. int last_enter_signal;
  44. int enter_signal_cooling;
  45. int on_floor_count = 0;
  46. int has_reset_signal = 0;
  47. int cmd_stage = 0;
  48. clock_t time_s = clock();
  49. FootActionState footActionState = {0, 0 , 0};
  50. };