carrier.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. virtual std::string get_current_command_key();
  23. protected://member functions
  24. //把任务单写入到内存中, 子类必须重载
  25. Error_manager write_task_to_memory(std::shared_ptr<Task_Base> p_task);
  26. //更新设备底层通信数据, 子类必须重载
  27. Error_manager update_device_communication();
  28. //从内存中读数据到任务单, 子类必须重载
  29. Error_manager check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task);
  30. //取消下发的指令, 子类必须重载, 用来向下发送命令取消任务.
  31. Error_manager cancel_command();
  32. //更新真实 空间位置的id.
  33. Error_manager update_actual_coordinates_id();
  34. protected://member variable
  35. public:
  36. //调度下发到plc
  37. std::string m_request_key; //请求唯一码, 用作识别
  38. //请求的目标坐标和动作
  39. float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
  40. float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
  41. float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
  42. float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  43. float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  44. Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  45. Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  46. Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  47. int m_request_space_id; //搬运器空间位置的id.
  48. int m_request_floor_id; //搬运器楼层位置的id.
  49. float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  50. //plc反馈给调度
  51. std::string m_respons_key; //应答的唯一码, 用作识别
  52. Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  53. //答复的实际坐标和动作
  54. float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
  55. float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
  56. float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
  57. float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  58. float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  59. Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  60. Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  61. Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  62. int m_respons_space_id; //搬运器空间位置的id.
  63. int m_respons_floor_id; //搬运器楼层位置的id.
  64. float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  65. //硬件状态, 目前只做显示判断
  66. std::chrono::system_clock::time_point m_status_updata_time; //状态更新时间点
  67. unsigned char m_last_heartbeat; //上一次的心跳
  68. //搬运器的设备状态数据,
  69. Hardware_device_status m_actual_device_status; //搬运器的硬件设备状态(短流程)
  70. Load_status m_actual_load_status; //搬运器的负载状态, 小跑车上面是否有车.
  71. //搬运器的真实状态, 可能是路径中间的坐标
  72. float m_actual_x; //搬运器坐标x轴, 中跑车控制横向移动
  73. float m_actual_y; //搬运器坐标y轴, 小跑车控制纵向移动
  74. float m_actual_z; //搬运器坐标z轴, 电梯控制上下移动
  75. float m_actual_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  76. float m_actual_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  77. Clamp_motion m_actual_clamp_motion1; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  78. Clamp_motion m_actual_clamp_motion2; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  79. Small_sports_car_motion m_actual_small_sports_car_motion; //小跑车的位置,是否在中跑车上面, 0=无动作,1=出发到位,2=返回到位
  80. Joint_motion m_actual_joint_motion_x1; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
  81. Joint_motion m_actual_joint_motion_x2; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
  82. //搬运器设备的错误码
  83. unsigned char m_actual_error_code[50]; //搬运器设备的故障信息位
  84. unsigned char m_actual_warning_code[50]; //搬运器设备的警告信息位
  85. std::string m_actual_error_description;//搬运器设备的错误描述
  86. int m_actual_coordinates_id; //搬运器真实 空间位置的id.
  87. int m_actual_coordinates_rows; //搬运器真实 空间位置的行.
  88. int m_actual_coordinates_columns; //搬运器真实 空间位置的列.
  89. //改道模块, 3级存车任务和1级取车任务 此时需要改道
  90. bool m_redirect_flag; //能否改道的标志位, 真:存车时搬运器还没有做电梯上去, 此时可以为了下一辆取车改道, 假:不能改道
  91. bool m_catcher_run_flag; //存车任务是否在等机器人就绪, 假:存车时机器人在干别的事情, 此时可能要等很久, 降低改道的权重, 真:机器人已经在做3级存车任务
  92. int m_redirect_pickup_parkspace_id; //一级取车任务 需要改道去的停车位
  93. Common_data::Car_type m_redirect_pickup_car_type; //一级取车任务 车辆类型
  94. int m_redirect_store_parkspace_id; //三级存车任务 需要被改道的停车位
  95. Common_data::Car_type m_redirect_store_car_type; //三级存车任务 车辆类型
  96. private:
  97. };
  98. #endif //NNXX_TESTS_CARRIER_H