carrier_task.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. //调度下发到plc
  46. std::string m_request_key; //请求唯一码, 用作识别
  47. //请求的目标坐标和动作
  48. float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
  49. float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
  50. float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
  51. float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  52. float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  53. Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  54. Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  55. Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  56. int m_request_space_id; //搬运器空间位置的id.
  57. int m_request_floor_id; //搬运器楼层位置的id.
  58. float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  59. //plc反馈给调度
  60. std::string m_respons_key; //应答的唯一码, 用作识别
  61. Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
  62. //答复的实际坐标和动作
  63. float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
  64. float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
  65. float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
  66. float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
  67. float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
  68. Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
  69. Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  70. Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
  71. int m_respons_space_id; //搬运器空间位置的id.
  72. int m_respons_floor_id; //搬运器楼层位置的id.
  73. float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
  74. private:
  75. };
  76. #endif //NNXX_TESTS_CARRIER_TASK_H