carrier_task.h 4.0 KB

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