carrier.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. 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. protected://member variable
  32. //调度下发到plc
  33. std::string m_request_key; //请求唯一码, 用作识别
  34. //请求的目标坐标和动作
  35. float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
  36. float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
  37. float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
  38. float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  39. float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  40. Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  41. Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  42. Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  43. int m_request_space_id; //搬运器空间位置的id.
  44. int m_request_floor_id; //搬运器楼层位置的id.
  45. float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  46. //plc反馈给调度
  47. std::string m_respons_key; //应答的唯一码, 用作识别
  48. Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  49. //答复的实际坐标和动作
  50. float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
  51. float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
  52. float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
  53. float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  54. float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  55. Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  56. Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  57. Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  58. int m_respons_space_id; //搬运器空间位置的id.
  59. int m_respons_floor_id; //搬运器楼层位置的id.
  60. float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  61. //硬件状态, 目前只做显示判断
  62. std::chrono::system_clock::time_point m_status_updata_time; //状态更新时间点
  63. unsigned char m_last_heartbeat; //上一次的心跳
  64. //搬运器的设备状态数据,
  65. Device_status m_actual_device_status; //搬运器的硬件设备状态
  66. Load_status m_actual_load_status; //搬运器的负载状态, 小跑车上面是否有车.
  67. //搬运器的真实状态, 可能是路径中间的坐标
  68. float m_actual_x; //搬运器坐标x轴, 中跑车控制横向移动
  69. float m_actual_y; //搬运器坐标y轴, 小跑车控制纵向移动
  70. float m_actual_z; //搬运器坐标z轴, 电梯控制上下移动
  71. float m_actual_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  72. float m_actual_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  73. Clamp_motion m_actual_clamp_motion1; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  74. Clamp_motion m_actual_clamp_motion2; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  75. Small_sports_car_motion m_actual_small_sports_car_motion; //小跑车的位置,是否在中跑车上面
  76. Joint_motion m_actual_joint_motion_x1; //电梯与X轴的横向轨道对接,0=无动作,
  77. Joint_motion m_actual_joint_motion_x2; //电梯与X轴的横向轨道对接,0=无动作,
  78. //搬运器设备的错误码
  79. unsigned char m_actual_error_code[50]; //搬运器设备的故障信息位
  80. unsigned char m_actual_warning_code[50]; //搬运器设备的警告信息位
  81. std::string m_actual_error_description;//搬运器设备的错误描述
  82. private:
  83. };
  84. #endif //NNXX_TESTS_CARRIER_H