carrier.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // Created by huli on 2021/3/12.
  3. //
  4. #ifndef NNXX_TESTS_CARRIER_H
  5. #define NNXX_TESTS_CARRIER_H
  6. #include "../dispatch/carrier_task.h"
  7. #include "../dispatch/dispatch_device_base.h"
  8. //搬运器的基类, 普爱项目就是搬运器(中跑车 电梯 小跑车 三合一)(长度单位mm)
  9. class Carrier:public Dispatch_device_base
  10. {
  11. public:
  12. Carrier();
  13. Carrier(const Carrier& other)= default;
  14. Carrier& operator =(const Carrier& other)= default;
  15. ~Carrier();
  16. public://API functions
  17. //检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
  18. Error_manager check_task_type(std::shared_ptr<Task_Base> p_task);
  19. public://get or set member variable
  20. //获取硬件设备的状态, 必须子类继承
  21. Hardware_device_status get_actual_device_status();
  22. protected://member functions
  23. //把任务单写入到内存中, 子类必须重载
  24. Error_manager write_task_to_memory(std::shared_ptr<Task_Base> p_task);
  25. //更新设备底层通信数据, 子类必须重载
  26. Error_manager update_device_communication();
  27. //从内存中读数据到任务单, 子类必须重载
  28. Error_manager check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task);
  29. //取消下发的指令, 子类必须重载, 用来向下发送命令取消任务.
  30. Error_manager cancel_command();
  31. //更新真实 空间位置的id.
  32. Error_manager update_actual_coordinates_id();
  33. protected://member variable
  34. public:
  35. //调度下发到plc
  36. std::string m_request_key; //请求唯一码, 用作识别
  37. //请求的目标坐标和动作
  38. float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
  39. float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
  40. float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
  41. float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  42. float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  43. Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  44. Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  45. Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  46. int m_request_space_id; //搬运器空间位置的id.
  47. int m_request_floor_id; //搬运器楼层位置的id.
  48. float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  49. //plc反馈给调度
  50. std::string m_respons_key; //应答的唯一码, 用作识别
  51. Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  52. //答复的实际坐标和动作
  53. float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
  54. float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
  55. float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
  56. float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  57. float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  58. Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  59. Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  60. Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  61. int m_respons_space_id; //搬运器空间位置的id.
  62. int m_respons_floor_id; //搬运器楼层位置的id.
  63. float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  64. //硬件状态, 目前只做显示判断
  65. std::chrono::system_clock::time_point m_status_updata_time; //状态更新时间点
  66. unsigned char m_last_heartbeat; //上一次的心跳
  67. //搬运器的设备状态数据,
  68. Hardware_device_status m_actual_device_status; //搬运器的硬件设备状态(短流程)
  69. Load_status m_actual_load_status; //搬运器的负载状态, 小跑车上面是否有车.
  70. //搬运器的真实状态, 可能是路径中间的坐标
  71. float m_actual_x; //搬运器坐标x轴, 中跑车控制横向移动
  72. float m_actual_y; //搬运器坐标y轴, 小跑车控制纵向移动
  73. float m_actual_z; //搬运器坐标z轴, 电梯控制上下移动
  74. float m_actual_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  75. float m_actual_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  76. Clamp_motion m_actual_clamp_motion1; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  77. Clamp_motion m_actual_clamp_motion2; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  78. Small_sports_car_motion m_actual_small_sports_car_motion; //小跑车的位置,是否在中跑车上面, 0=无动作,1=出发到位,2=返回到位
  79. Joint_motion m_actual_joint_motion_x1; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
  80. Joint_motion m_actual_joint_motion_x2; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
  81. //搬运器设备的错误码
  82. unsigned char m_actual_error_code[50]; //搬运器设备的故障信息位
  83. unsigned char m_actual_warning_code[50]; //搬运器设备的警告信息位
  84. std::string m_actual_error_description;//搬运器设备的错误描述
  85. int m_actual_coordinates_id; //搬运器真实 空间位置的id.
  86. private:
  87. };
  88. #endif //NNXX_TESTS_CARRIER_H