monkeycar_person.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __MONKEYCAR_PERSON__
  2. #define __MONKEYCAR_PERSON__
  3. #include "base_card.h"
  4. #include "base_area.h"
  5. #include "base_data.h"
  6. #include "linear_fit.h"
  7. #include "fp_path.h"
  8. #include "cacti/util/Timestamp.h"
  9. #include "cacti/kernel/Mutex.h"
  10. #include "monkey_fit.h"
  11. struct monkey_bus;
  12. struct monkey_area;
  13. #define MAX_POINT_V 30
  14. #define MAX_GETOFF_NUM 5
  15. #define ZERO_ 1E-5
  16. extern const int num_fit_point[4];
  17. struct monkey_person:position_interface
  18. {
  19. typedef cacti::RecursiveMutex::ScopedLock ScopedLock;
  20. std::weak_ptr<monkey_bus> m_bus;
  21. std::shared_ptr<person> m_person;
  22. //µ÷¼ä¾àµÄµã
  23. std::deque<st_coord> m_fit_point;
  24. monkey_person(std::shared_ptr<Card> ptr,monkey_area* pma);
  25. ~monkey_person();
  26. void GetOnTheBus(std::shared_ptr<monkey_bus> bus,double speed);
  27. void GetOffTheBus();
  28. bool Judge_OffIndex();
  29. void resetOffIndex();
  30. std::string & getCardId();
  31. bool is_on_bus() const;
  32. bool on_step_map(POS_21::fp_path & fppath);
  33. bool fit_speed(double*ret_speed);
  34. bool get_num_point(int * p);
  35. bool init_another_list(size_t index);
  36. void updata_position() ;
  37. virtual point_2 get_position();
  38. virtual bool save_point();
  39. inline void setCompensationSpeed(double v)
  40. {
  41. debug_print_syslog(0,"[framework adjust speed] :%s,v:%f",getCardId().c_str(),v);
  42. m_compensation_speed = v;
  43. }
  44. bool screen_Point(u16 ct,double dis);
  45. void reset(double speed);
  46. void Set_AverageSpeed();
  47. void handle_monkeycar_fit(double);
  48. public:
  49. int m_getOffIndex;
  50. uint16_t m_ori_ct;
  51. double m_cur_distance; //curTime distance
  52. u16 m_longTime_NoRecvData_Index ;
  53. double m_compensation_speed;
  54. u64 m_timeval;
  55. u64 m_adjustDis_timeval;
  56. uint64_t m_timestamp;
  57. st_coord m_go_up_point; // go on point
  58. comp_linear_fit* m_linear_fit;
  59. cacti::RecursiveMutex m_monitor;
  60. std::array<monkey_fit*,2> mp_monkey_fit;
  61. };
  62. #endif