carrier_task.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // Created by huli on 2020/10/20.
  3. //
  4. #ifndef NNXX_TESTS_CARRIER_TASK_H
  5. #define NNXX_TESTS_CARRIER_TASK_H
  6. #include "../error_code/error_code.h"
  7. #include "../task/task_command_manager.h"
  8. #include "../task/task_base.h"
  9. #include <mutex>
  10. class Carrier_task :public Task_Base
  11. {
  12. public:
  13. //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  14. enum Respons_status
  15. {
  16. RESPONS_WORKING = 0, //正常
  17. RESPONS_OVER = 1, //任务完成
  18. RESPONS_MINOR_ERROR = 100, //一般故障, 可恢复
  19. RESPONS_CRITICAL_ERROR = 101, //致命故障,不可恢复
  20. };
  21. //小跑车的夹杆
  22. enum Clamp_motion
  23. {
  24. E_CLAMP_NO_ACTION = 0, //无动作.
  25. E_CLAMP_TIGHT = 1, //夹紧夹杆
  26. E_CLAMP_LOOSE = 2, //松开夹杆
  27. };
  28. //中跑车和平层轨道的对接
  29. enum Joint_motion
  30. {
  31. E_JOINT_NO_ACTION = 0, //无动作.
  32. E_JOINT_HOLD_OUT = 1, //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
  33. E_JOINT_TAKE_BACK = 2, //收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
  34. };
  35. public:
  36. Carrier_task();
  37. Carrier_task(const Carrier_task& other)= default;
  38. Carrier_task& operator =(const Carrier_task& other)= default;
  39. ~Carrier_task();
  40. public://API functions
  41. public://get or set member variable
  42. protected://member functions
  43. public://member variable
  44. std::mutex m_lock; //锁
  45. int m_step;//长流程细分为短流程, m_step 控制短流程的步骤
  46. //调度下发到plc
  47. std::string m_request_key; //请求唯一码, 用作识别
  48. //请求的目标坐标和动作
  49. float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
  50. float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
  51. float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
  52. float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  53. float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  54. Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  55. Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  56. Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  57. int m_request_space_id; //搬运器空间位置的id.
  58. int m_request_floor_id; //搬运器楼层位置的id.
  59. float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  60. //plc反馈给调度
  61. std::string m_respons_key; //应答的唯一码, 用作识别
  62. Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  63. //答复的实际坐标和动作
  64. float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
  65. float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
  66. float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
  67. float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  68. float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  69. Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  70. Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  71. Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  72. int m_respons_space_id; //搬运器空间位置的id.
  73. int m_respons_floor_id; //搬运器楼层位置的id.
  74. float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  75. private:
  76. };
  77. #endif //NNXX_TESTS_CARRIER_TASK_H