123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- //
- // Created by huli on 2021/3/12.
- //
- #ifndef NNXX_TESTS_CARRIER_H
- #define NNXX_TESTS_CARRIER_H
- #include "../dispatch/carrier_task.h"
- #include "../dispatch/dispatch_device_base.h"
- //搬运器的基类, 普爱项目就是搬运器(中跑车 电梯 小跑车 三合一)(长度单位mm)
- class Carrier:public Dispatch_device_base
- {
- public:
- Carrier();
- Carrier(const Carrier& other)= default;
- Carrier& operator =(const Carrier& other)= default;
- ~Carrier();
- public://API functions
- //检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
- Error_manager check_task_type(std::shared_ptr<Task_Base> p_task);
- public://get or set member variable
- //获取硬件设备的状态, 必须子类继承
- Hardware_device_status get_actual_device_status();
- virtual std::string get_current_command_key();
- protected://member functions
- //把任务单写入到内存中, 子类必须重载
- Error_manager write_task_to_memory(std::shared_ptr<Task_Base> p_task);
- //更新设备底层通信数据, 子类必须重载
- Error_manager update_device_communication();
- //从内存中读数据到任务单, 子类必须重载
- Error_manager check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task);
- //取消下发的指令, 子类必须重载, 用来向下发送命令取消任务.
- Error_manager cancel_command();
- //更新真实 空间位置的id.
- Error_manager update_actual_coordinates_id();
- protected://member variable
- public:
- //调度下发到plc
- std::string m_request_key; //请求唯一码, 用作识别
- //请求的目标坐标和动作
- float m_request_x; //搬运器坐标x轴, 中跑车控制横向移动
- float m_request_y; //搬运器坐标y轴, 小跑车控制纵向移动
- float m_request_z; //搬运器坐标z轴, 电梯控制上下移动
- float m_request_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
- float m_request_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
- Clamp_motion m_request_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
- Joint_motion m_request_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
- Joint_motion m_request_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
- int m_request_space_id; //搬运器空间位置的id.
- int m_request_floor_id; //搬运器楼层位置的id.
- float m_request_wheelbase; //搬运器小跑车的抓车杆前后轮距.
- //plc反馈给调度
- std::string m_respons_key; //应答的唯一码, 用作识别
- Respons_status m_respons_status; //指令完成状态, 搬运器答复指令, 返回任务完成的情况
- //答复的实际坐标和动作
- float m_respons_x; //搬运器坐标x轴, 中跑车控制横向移动
- float m_respons_y; //搬运器坐标y轴, 小跑车控制纵向移动
- float m_respons_z; //搬运器坐标z轴, 电梯控制上下移动
- float m_respons_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
- float m_respons_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
- Clamp_motion m_respons_clamp_motion; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
- Joint_motion m_respons_joint_motion_x; //电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
- Joint_motion m_respons_joint_motion_y; //小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
- int m_respons_space_id; //搬运器空间位置的id.
- int m_respons_floor_id; //搬运器楼层位置的id.
- float m_respons_wheelbase; //搬运器小跑车的抓车杆前后轮距.
- //硬件状态, 目前只做显示判断
- std::chrono::system_clock::time_point m_status_updata_time; //状态更新时间点
- unsigned char m_last_heartbeat; //上一次的心跳
- //搬运器的设备状态数据,
- Hardware_device_status m_actual_device_status; //搬运器的硬件设备状态(短流程)
- Load_status m_actual_load_status; //搬运器的负载状态, 小跑车上面是否有车.
- //搬运器的真实状态, 可能是路径中间的坐标
- float m_actual_x; //搬运器坐标x轴, 中跑车控制横向移动
- float m_actual_y; //搬运器坐标y轴, 小跑车控制纵向移动
- float m_actual_z; //搬运器坐标z轴, 电梯控制上下移动
- float m_actual_y1; //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
- float m_actual_y2; //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
- Clamp_motion m_actual_clamp_motion1; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
- Clamp_motion m_actual_clamp_motion2; //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
- Small_sports_car_motion m_actual_small_sports_car_motion; //小跑车的位置,是否在中跑车上面, 0=无动作,1=出发到位,2=返回到位
- Joint_motion m_actual_joint_motion_x1; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
- Joint_motion m_actual_joint_motion_x2; //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
- //搬运器设备的错误码
- unsigned char m_actual_error_code[50]; //搬运器设备的故障信息位
- unsigned char m_actual_warning_code[50]; //搬运器设备的警告信息位
- std::string m_actual_error_description;//搬运器设备的错误描述
- int m_actual_coordinates_id; //搬运器真实 空间位置的id.
- int m_actual_coordinates_rows; //搬运器真实 空间位置的行.
- int m_actual_coordinates_columns; //搬运器真实 空间位置的列.
- //改道模块, 3级存车任务和1级取车任务 此时需要改道
- bool m_redirect_flag; //能否改道的标志位, 真:存车时搬运器还没有做电梯上去, 此时可以为了下一辆取车改道, 假:不能改道
- bool m_catcher_run_flag; //存车任务是否在等机器人就绪, 假:存车时机器人在干别的事情, 此时可能要等很久, 降低改道的权重, 真:机器人已经在做3级存车任务
- int m_redirect_pickup_parkspace_id; //一级取车任务 需要改道去的停车位
- Common_data::Car_type m_redirect_pickup_car_type; //一级取车任务 车辆类型
- int m_redirect_store_parkspace_id; //三级存车任务 需要被改道的停车位
- Common_data::Car_type m_redirect_store_car_type; //三级存车任务 车辆类型
- private:
- };
- #endif //NNXX_TESTS_CARRIER_H
|