huli 4 rokov pred
rodič
commit
3844bc1955

+ 2 - 1
CMakeLists.txt

@@ -25,7 +25,8 @@ include_directories(
         message
         error_code
         tool
-	system
+		system
+		dispatch
 )
 link_directories("/usr/local/lib")
 

+ 296 - 0
dispatch/carrier.cpp

@@ -0,0 +1,296 @@
+//
+// Created by huli on 2021/3/12.
+//
+
+#include "carrier.h"
+
+Carrier::Carrier()
+{
+	m_request_x = 0;				//搬运器坐标x轴,
+	m_request_y = 0;				//搬运器坐标y轴,
+	m_request_z = 0;				//搬运器坐标z轴,
+	m_request_y1 = 0;				//搬运器坐标y1轴, 搬运器抓车杆纵向移动(前轮抓杆)
+	m_request_y2 = 0;				//搬运器坐标y2轴, 搬运器抓车杆纵向移动(后轮抓杆)
+	m_request_clamp_motion = E_CLAMP_NO_ACTION;		//搬运器夹车杆. 0=无动作,1=夹紧,2=松开
+	m_request_joint_motion_x = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_request_joint_motion_y = E_JOINT_NO_ACTION;	//小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_request_space_id = 0;			//搬运器空间位置的id.
+	m_request_floor_id = 0;			//搬运器楼层位置的id.
+	m_request_wheelbase = 0;		//搬运器抓车杆前后轮距.
+
+	m_respons_status = RESPONS_WORKING;			//指令完成状态, 搬运器答复指令, 返回任务完成的情况
+	m_respons_x = 0;				//搬运器坐标x轴,
+	m_respons_y = 0;				//搬运器坐标y轴,
+	m_respons_z = 0;				//搬运器坐标z轴,
+	m_respons_y1 = 0;				//搬运器坐标y1轴, 搬运器抓车杆纵向移动(前轮抓杆)
+	m_respons_y2 = 0;				//搬运器坐标y2轴, 搬运器抓车杆纵向移动(后轮抓杆)
+	m_respons_clamp_motion = E_CLAMP_NO_ACTION;		//搬运器夹车杆. 0=无动作,1=夹紧,2=松开
+	m_respons_joint_motion_x = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_respons_joint_motion_y = E_JOINT_NO_ACTION;	//小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_respons_space_id = 0;			//搬运器空间位置的id.
+	m_respons_floor_id = 0;			//搬运器楼层位置的id.
+	m_respons_wheelbase = 0;		//搬运器抓车杆前后轮距.
+
+	m_status_updata_time = std::chrono::system_clock::now();
+	m_last_heartbeat = 0;			//上一次的心跳
+	m_actual_device_status = DEVICE_UNKNOWN;			//搬运器的硬件设备状态
+	m_actual_load_status = LOAD_UNKNOWN;				//搬运器的负载状态, 小跑车上面是否有车.
+	m_actual_x = 0;					//搬运器坐标x轴,
+	m_actual_y = 0;					//搬运器坐标y轴,
+	m_actual_z = 0;					//搬运器坐标z轴,
+	m_actual_y1 = 0;				//搬运器坐标y1轴, 搬运器抓车杆纵向移动(前轮抓杆)
+	m_actual_y2 = 0;				//搬运器坐标y2轴, 搬运器抓车杆纵向移动(后轮抓杆)
+	m_actual_clamp_motion1 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_clamp_motion2 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_small_sports_car_motion = E_SMALL_SPORTS_NO_ACTION;
+	m_actual_joint_motion_x1 = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_actual_joint_motion_x2 = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+
+	memset(m_actual_error_code, 0, 50);	//搬运器设备的报警信息位
+	memset(m_actual_warning_code, 0, 50);	//升降机设备的报警信息位
+}
+
+Carrier::~Carrier()
+{
+
+}
+
+//检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
+Error_manager Carrier::check_task_type(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CATCHER_TASK)
+	{
+		return Error_manager(Error_code::CATCHER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Carrier::check_task_type  get_task_type() != CATCHER_TASK ");
+	}
+
+	return Error_code::SUCCESS;
+}
+
+//获取硬件设备的状态, 必须子类继承
+Carrier::Device_status Carrier::get_actual_device_status()
+{
+	return m_actual_device_status;
+}
+
+
+//把任务单写入到内存中, 子类必须重载
+Error_manager Carrier::write_task_to_memory(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CARRIER_TASK)
+	{
+		return Error_manager(Error_code::CARRIER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Carrier::check_task_type  get_task_type() != CARRIER_TASK ");
+	}
+	else
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+
+		Carrier_task* tp_carrier_task = (Carrier_task*)p_task.get();
+		std::unique_lock<std::mutex> t_lock1(tp_carrier_task->m_lock);
+		m_request_key = tp_carrier_task->m_request_key;
+		m_request_x = tp_carrier_task->m_request_x;
+		m_request_y = tp_carrier_task->m_request_y;
+		m_request_z = tp_carrier_task->m_request_z;
+		m_request_y1 = tp_carrier_task->m_request_y1;
+		m_request_y2 = tp_carrier_task->m_request_y2;
+		m_request_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_carrier_task->m_request_clamp_motion;
+		m_request_joint_motion_x = (Dispatch_device_base::Joint_motion)tp_carrier_task->m_request_joint_motion_x;
+		m_request_joint_motion_y = (Dispatch_device_base::Joint_motion)tp_carrier_task->m_request_joint_motion_y;
+		m_request_space_id = tp_carrier_task->m_request_space_id;
+		m_request_floor_id = tp_carrier_task->m_request_floor_id;
+		m_request_wheelbase = tp_carrier_task->m_request_wheelbase;
+
+		return Error_code::SUCCESS;
+	}
+	return Error_code::SUCCESS;
+}
+//更新设备底层通信数据, 子类必须重载
+Error_manager Carrier::update_device_communication()
+{
+	std::unique_lock<std::mutex> t_lock1(Dispatch_communication::get_instance_references().m_data_lock);
+	std::unique_lock<std::mutex> t_lock(m_lock);
+
+	//请求消息, 调度->plc
+	Dispatch_communication::Carrier_request_from_dispatch_to_plc_for_data * tp_carrier_request_from_dispatch_to_plc_for_data =
+	& Dispatch_communication::get_instance_references().m_carrier_request_from_dispatch_to_plc_for_data[m_device_id];
+	Dispatch_communication::Carrier_request_from_dispatch_to_plc_for_key * tp_carrier_request_from_dispatch_to_plc_for_key =
+	& Dispatch_communication::get_instance_references().m_carrier_request_from_dispatch_to_plc_for_key[m_device_id];
+	memset(tp_carrier_request_from_dispatch_to_plc_for_key->m_request_key, 0, 50);
+	memcpy(tp_carrier_request_from_dispatch_to_plc_for_key->m_request_key, m_request_key.c_str(), m_request_key.size());
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_x = m_request_x;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y = m_request_y;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_b = m_request_b;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_z = m_request_z;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_clamp_motion = m_request_clamp_motion;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_wheelbase = m_request_wheelbase;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y1 = m_request_y1;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y2 = m_request_y2;
+
+
+
+	//答复消息, plc->调度
+	Dispatch_communication::Carrier_response_from_plc_to_dispatch * tp_carrier_response_from_plc_to_dispatch =
+	& Dispatch_communication::get_instance_references().m_carrier_response_from_plc_to_dispatch[m_device_id];
+	m_respons_key = (char*) tp_carrier_response_from_plc_to_dispatch->m_respons_key;
+	m_respons_status = (Dispatch_device_base::Respons_status)tp_carrier_response_from_plc_to_dispatch->m_respons_status;
+	m_respons_x = tp_carrier_response_from_plc_to_dispatch->m_respons_x;
+	m_respons_y = tp_carrier_response_from_plc_to_dispatch->m_respons_y;
+	m_respons_b = tp_carrier_response_from_plc_to_dispatch->m_respons_b;
+	m_respons_z = tp_carrier_response_from_plc_to_dispatch->m_respons_z;
+	m_respons_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_carrier_response_from_plc_to_dispatch->m_respons_clamp_motion;
+	m_respons_wheelbase = tp_carrier_response_from_plc_to_dispatch->m_respons_wheelbase;
+	m_respons_y1 = tp_carrier_response_from_plc_to_dispatch->m_respons_y1;
+	m_respons_y2 = tp_carrier_response_from_plc_to_dispatch->m_respons_y2;
+
+
+	//状态消息, plc->调度
+	Dispatch_communication::Carrier_status_from_plc_to_dispatch *tp_carrier_status_from_plc_to_dispatch =
+	& Dispatch_communication::get_instance_references().m_carrier_status_from_plc_to_dispatch[m_device_id];
+	//通过心跳帧来判断通信是否正常
+	if ( m_last_heartbeat != tp_carrier_status_from_plc_to_dispatch->m_heartbeat )
+	{
+		m_last_heartbeat = tp_carrier_status_from_plc_to_dispatch->m_heartbeat;
+		m_status_updata_time = std::chrono::system_clock::now();
+
+		//设备异常  //注注注注注注注注意了, ==的优先级比&要高.
+		if ( (tp_carrier_status_from_plc_to_dispatch->m_safe_status & 0x02) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_EMERGENCY_STOP;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+		else if ( (tp_carrier_status_from_plc_to_dispatch->m_safe_status & 0x01) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_FAULT;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+		else if ( (tp_carrier_status_from_plc_to_dispatch->m_safe_status & 0x08) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_COLLISION;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+			//正常状态
+		else
+		{
+			if (tp_carrier_status_from_plc_to_dispatch->m_work_status == 1)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_WORKING;
+			}
+			else if(tp_carrier_status_from_plc_to_dispatch->m_work_status == 2)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_READY;
+			}
+			else if(tp_carrier_status_from_plc_to_dispatch->m_work_status == 0)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_UNKNOWN;
+			}
+
+			//故障恢复之后   E_FAULT  ->>  E_THREE_LEVEL_WORK
+			if ( m_dispatch_device_status == Dispatch_device_base::E_FAULT )
+			{
+				m_dispatch_device_status = Dispatch_device_base::E_THREE_LEVEL_WORK;
+			}
+			//else 流程状态维持不变
+		}
+
+		m_actual_load_status = (Dispatch_device_base::Load_status)tp_carrier_status_from_plc_to_dispatch->m_actual_load_status;
+		m_actual_x = tp_carrier_status_from_plc_to_dispatch->m_actual_x;
+		m_actual_y = tp_carrier_status_from_plc_to_dispatch->m_actual_y;
+		m_actual_b = tp_carrier_status_from_plc_to_dispatch->m_actual_b;
+		m_actual_z = tp_carrier_status_from_plc_to_dispatch->m_actual_z;
+		m_actual_y1 = tp_carrier_status_from_plc_to_dispatch->m_actual_y1;
+		m_actual_y2 = tp_carrier_status_from_plc_to_dispatch->m_actual_y2;
+		m_actual_clamp_motion1 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion1;
+		m_actual_clamp_motion2 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion2;
+		m_actual_clamp_motion3 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion3;
+		m_actual_clamp_motion4 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion4;
+		memcpy(m_actual_error_code, tp_carrier_status_from_plc_to_dispatch->m_actual_error_code, 50);
+		memcpy(m_actual_warning_code, tp_carrier_status_from_plc_to_dispatch->m_actual_warning_code, 50);
+		m_actual_error_description = (char*)(tp_carrier_status_from_plc_to_dispatch->m_actual_error_description);
+
+		//重连之后,搬运器状态   E_DISCONNECT  ->>  E_THREE_LEVEL_WORK
+		if ( m_dispatch_device_status == Dispatch_device_base::E_DISCONNECT )
+		{
+			m_dispatch_device_status = Dispatch_device_base::E_THREE_LEVEL_WORK;
+		}
+	}
+	else if(std::chrono::system_clock::now() - m_status_updata_time > std::chrono::milliseconds(COMMUNICATION_OVER_TIME_MS))
+	{
+		m_dispatch_device_status = Dispatch_device_base::E_DISCONNECT;
+	}
+	//else 继续等待,直到消息刷新或者超时.
+
+	return Error_code::SUCCESS;
+}
+//从内存中读数据到任务单, 子类必须重载
+Error_manager Carrier::check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CARRIER_TASK)
+	{
+		return Error_manager(Error_code::CARRIER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Carrier::check_task_type  get_task_type() != CARRIER_TASK ");
+	}
+	else
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+		if ( m_respons_key == m_request_key && m_respons_status != RESPONS_WORKING )
+		{
+			Carrier_task* tp_carrier_task = (Carrier_task*)p_task.get();
+			std::unique_lock<std::mutex> t_lock1(tp_carrier_task->m_lock);
+
+			tp_carrier_task->m_respons_key = m_respons_key;
+			tp_carrier_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
+			tp_carrier_task->m_respons_x = m_respons_x;
+			tp_carrier_task->m_respons_y = m_respons_y;
+			tp_carrier_task->m_respons_b = m_respons_b;
+			tp_carrier_task->m_respons_z = m_respons_z;
+			tp_carrier_task->m_respons_space_id = m_respons_space_id;
+			tp_carrier_task->m_respons_y1 = m_respons_y1;
+			tp_carrier_task->m_respons_y2 = m_respons_y2;
+			tp_carrier_task->m_respons_wheelbase = m_respons_wheelbase;
+			tp_carrier_task->m_respons_clamp_motion = (Carrier_task::Clamp_motion)m_respons_clamp_motion;
+
+			//如果故障,则添加错误码
+			if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+			{
+				//添加错误码
+				Error_manager t_error(CATCHER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+				tp_carrier_task->set_task_error_manager(t_error);
+			}
+
+			return Error_code::SUCCESS;
+		}
+			//返回没有收到数据
+		else
+		{
+			return Error_code::NODATA;
+		}
+	}
+	return Error_code::SUCCESS;
+}
+
+
+
+//取消下发的指令
+Error_manager Carrier::cancel_command()
+{
+	//以后再写 need programe
+	//目前调度和plc的通信指令做的很简单,没有暂停和急停 复位等操作.
+	//这里先空着,以后再写.
+	//调度模块单方面销毁任务, 不管底层plc的执行情况, 也不去告知plc任务取消.
+
+	return Error_code::SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+

+ 100 - 0
dispatch/carrier.h

@@ -0,0 +1,100 @@
+//
+// 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
+	//获取硬件设备的状态, 必须子类继承
+	Device_status get_actual_device_status();
+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();
+protected://member variable
+
+	//调度下发到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;			//上一次的心跳
+	//搬运器的设备状态数据,
+	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;	//小跑车的位置,是否在中跑车上面
+	Joint_motion						m_actual_joint_motion_x1;		//电梯与X轴的横向轨道对接,0=无动作,
+	Joint_motion						m_actual_joint_motion_x2;		//电梯与X轴的横向轨道对接,0=无动作,
+	//搬运器设备的错误码
+	unsigned char						m_actual_error_code[50];	//搬运器设备的故障信息位
+	unsigned char						m_actual_warning_code[50];	//搬运器设备的警告信息位
+	std::string							m_actual_error_description;//搬运器设备的错误描述
+
+
+private:
+
+};
+
+#endif //NNXX_TESTS_CARRIER_H

+ 180 - 174
dispatch/carrier_base.cpp

@@ -4,33 +4,50 @@
 
 #include "carrier_base.h"
 #include "dispatch_communication.h"
-
+/*
 Carrier_base::Carrier_base()
 {
 	m_carrier_status = E_UNKNOW;
-	m_carrier_id = 0;
-
-	m_parkspace_unit_id = 0;		//车位单元号(楚天项目为1~3)
-	m_parkspace_floor_id = 0;		//车位楼层号(楚天项目为1~14)
-	m_parkspace_room_id = 0;		//车位同层的房间号	(楚天项目一楼为1~4, 楼上为1~6)
-//	m_command_key = 0;				//任务唯一码
-	m_motion_direction = 0;			//调度方向, 根据停车取车选择出入口, 	1=入口,0=非入口
-	m_car_center_x = 0;				//汽车的中心坐标x
-	m_car_center_y = 0;				//汽车的中心坐标y
-	m_car_angle = 0;				//汽车的旋转角(角度-90~90)
-
-	m_carrier_coordinate_x = 0;				//搬运器坐标x轴, 中跑车控制横向移动
-	m_carrier_coordinate_y = 0;				//搬运器坐标y轴, (本模块默认为0, 由AGV模块去控制纵向移动)
-	m_carrier_coordinate_z = 0;				//搬运器坐标z轴, 电梯控制上下移动
-	m_respons_status = RESPONS_NORMAL;			//指令完成状态, 搬运器答复指令, 返回任务完成的情况
-
-	//硬件状态, 目前只做显示判断
-	m_carrier_device_status = E_UNKNOW;	//搬运器设备的状态, 楚天项目就是中跑车
+	m_carrier_id = -1;
+
+	m_request_x = 0;				//搬运器坐标x轴, 中跑车控制横向移动
+	m_request_y = 0;				//搬运器坐标y轴, 小跑车控制纵向移动
+	m_request_z = 0;				//搬运器坐标z轴, 电梯控制上下移动
+	m_request_space_id = 0;			//搬运器空间位置的id.
+	m_request_y1 = 0;				//搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	m_request_y2 = 0;				//搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	m_request_wheelbase = 0;		//搬运器小跑车的抓车杆前后轮距.
+	m_request_clamp_motion = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_request_joint_motion = E_JOINT_NO_ACTION;		//电梯与X轴的横向轨道对接,0=无动作,
+
+	m_respons_status = RESPONS_WORKING;
+	m_respons_x = 0;				//搬运器坐标x轴, 中跑车控制横向移动
+	m_respons_y = 0;				//搬运器坐标y轴, 小跑车控制纵向移动
+	m_respons_z = 0;				//搬运器坐标z轴, 电梯控制上下移动
+	m_respons_space_id = 0;			//搬运器空间位置的id.
+	m_respons_y1 = 0;				//搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	m_respons_y2 = 0;				//搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	m_respons_wheelbase = 0;		//搬运器小跑车的抓车杆前后轮距.
+	m_respons_clamp_motion = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_respons_joint_motion = E_JOINT_NO_ACTION;		//电梯与X轴的横向轨道对接,0=无动作,
+
+	m_status_updata_time = std::chrono::system_clock::now();
+	m_last_heartbeat = 0;
+	m_device_status = DEVICE_UNKNOWN;
+	m_load_status = LOAD_UNKNOWN;
+	m_actual_x = 0;					//搬运器坐标x轴, 中跑车控制横向移动
+	m_actual_y = 0;					//搬运器坐标y轴, 小跑车控制纵向移动
+	m_actual_z = 0;					//搬运器坐标z轴, 电梯控制上下移动
+	m_actual_y1 = 0;				//搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	m_actual_y2 = 0;				//搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	m_actual_clamp_motion1 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_clamp_motion2 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_joint_motion1 = E_JOINT_NO_ACTION;		//电梯与X轴的横向轨道对接,0=无动作,
+	m_actual_joint_motion2 = E_JOINT_NO_ACTION;		//电梯与X轴的横向轨道对接,0=无动作,
+	m_actual_small_sports_car_motion = E_SMALL_SPORTS_NO_ACTION;	//小跑车的位置,是否在中跑车上面
+
 	memset(m_carrier_error_code, 0, 50);	//搬运器设备的报警信息位
-//	m_carrier_error_description = 0;//搬运器设备的报警状态描述
-	m_elevator_device_status = E_UNKNOW;	//升降机设备状态, 楚天项目就是电梯
-	memset(m_elevator_error_code, 0, 50);	//升降机设备的报警信息位
-//	m_elevator_error_description = 0;//升降机设备的报警状态描述
+	memset(m_carrier_warning_code, 0, 50);	//升降机设备的报警信息位
 
 	mp_execute_thread = NULL;
 
@@ -92,6 +109,7 @@ Error_manager Carrier_base::execute_one_level_task(std::shared_ptr<Carrier_task>
 							 "Carrier_base::execute_one_level_task  get_task_type() != CARRIER_TASK ");
 	}
 
+
 	//检查接收方的状态
 	t_error = check_one_level_task();
 	if ( t_error != SUCCESS )
@@ -111,7 +129,8 @@ Error_manager Carrier_base::execute_one_level_task(std::shared_ptr<Carrier_task>
 		//通知 thread_work 子线程启动。
 
 		//将任务的状态改为 TASK_WORKING 处理中
-		mp_carrier_one_level_task->set_task_statu(TASK_WORKING);
+		//20200225, 在线程真正的执行的时候,才改为工作中, (执行线程可能会先处理更高优先级的任务单)
+//		mp_carrier_one_level_task->set_task_statu(TASK_WORKING);
 	}
 
 	if ( t_result != Error_code::SUCCESS )
@@ -159,7 +178,8 @@ Error_manager Carrier_base::execute_two_level_task(std::shared_ptr<Carrier_task>
 		//通知 thread_work 子线程启动。
 
 		//将任务的状态改为 TASK_WORKING 处理中
-		mp_carrier_two_level_task->set_task_statu(TASK_WORKING);
+		//20200225, 在线程真正的执行的时候,才改为工作中, (执行线程可能会先处理更高优先级的任务单)
+//		mp_carrier_two_level_task->set_task_statu(TASK_WORKING);
 	}
 
 	if ( t_result != Error_code::SUCCESS )
@@ -207,7 +227,8 @@ Error_manager Carrier_base::execute_three_level_task(std::shared_ptr<Carrier_tas
 		//通知 thread_work 子线程启动。
 
 		//将任务的状态改为 TASK_WORKING 处理中
-		mp_carrier_three_level_task->set_task_statu(TASK_WORKING);
+		//20200225, 在线程真正的执行的时候,才改为工作中, (执行线程可能会先处理更高优先级的任务单)
+//		mp_carrier_three_level_task->set_task_statu(TASK_WORKING);
 	}
 
 	if ( t_result != Error_code::SUCCESS )
@@ -305,7 +326,7 @@ Error_manager Carrier_base::end_task(std::shared_ptr<Carrier_task> carrier_task)
 {
 	LOG(INFO) << " ---Carrier_base::end_task run---"<< this;
 
-	carrier_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
+//	carrier_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
 
 	//注:这里只修改任务单的状态, 搬运器的状态不管
 	//在结束任务单时,将雷达任务状态改为 TASK_OVER 已结束
@@ -442,33 +463,46 @@ void Carrier_base::execute_thread_fun()
 				{
 					if ( mp_carrier_three_level_task.get() != NULL )
 					{
+						mp_carrier_three_level_task->set_task_statu(TASK_WORKING);
 						//执行三级任务
 						std::unique_lock<std::mutex> t_lock(mp_carrier_three_level_task->m_lock);
-						m_parkspace_unit_id = mp_carrier_three_level_task->m_parkspace_unit_id;
-						m_parkspace_floor_id = mp_carrier_three_level_task->m_parkspace_floor_id;
-						m_parkspace_room_id = mp_carrier_three_level_task->m_parkspace_room_id;
-						m_command_key = mp_carrier_three_level_task->m_command_key;
-						m_motion_direction = mp_carrier_three_level_task->m_motion_direction;
-						m_car_center_x = mp_carrier_three_level_task->m_car_center_x;
-						m_car_center_y = mp_carrier_three_level_task->m_car_center_y;
-						m_car_angle = mp_carrier_three_level_task->m_car_angle;
+						m_request_key = mp_carrier_three_level_task->m_request_key;
+						m_request_x = mp_carrier_three_level_task->m_request_x;
+						m_request_y = mp_carrier_three_level_task->m_request_y;
+						m_request_z = mp_carrier_three_level_task->m_request_z;
+						m_request_space_id = mp_carrier_three_level_task->m_request_space_id;
+						m_request_y1 = mp_carrier_three_level_task->m_request_y1;
+						m_request_y2 = mp_carrier_three_level_task->m_request_y2;
+						m_request_wheelbase = mp_carrier_three_level_task->m_request_wheelbase;
+						m_request_clamp_motion = (Carrier_base::Clamp_motion)mp_carrier_three_level_task->m_request_clamp_motion;
+						m_request_joint_motion = (Carrier_base::Joint_motion)mp_carrier_three_level_task->m_request_joint_motion;
 
 						//更新通信
 						update_device_communication();
 
-						//检查设备的答复
-						if ( m_respons_status == RESPONS_OVER )
+						//检查plc的答复状态
+						if ( m_respons_key == m_request_key && m_respons_status != RESPONS_WORKING )
 						{
+							mp_carrier_three_level_task->m_respons_key = m_respons_key;
 							mp_carrier_three_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							end_task(mp_carrier_three_level_task);
-							m_carrier_status = E_THREE_LEVEL_OVER;
-						}
-						else if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
-						{
-							mp_carrier_three_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							//添加错误码
-							Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
-							mp_carrier_three_level_task->set_task_error_manager(t_error);
+							mp_carrier_three_level_task->m_respons_x = m_respons_x;
+							mp_carrier_three_level_task->m_respons_y = m_respons_y;
+							mp_carrier_three_level_task->m_respons_z = m_respons_z;
+							mp_carrier_three_level_task->m_respons_space_id = m_respons_space_id;
+							mp_carrier_three_level_task->m_respons_y1 = m_respons_y1;
+							mp_carrier_three_level_task->m_respons_y2 = m_respons_y2;
+							mp_carrier_three_level_task->m_respons_wheelbase = m_respons_wheelbase;
+							mp_carrier_three_level_task->m_respons_clamp_motion = (Carrier_task::Clamp_motion)m_respons_clamp_motion;
+							mp_carrier_three_level_task->m_respons_joint_motion = (Carrier_task::Joint_motion)m_respons_joint_motion;
+
+							//如果故障,则添加错误码
+							if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+							{
+								//添加错误码
+								Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+								mp_carrier_three_level_task->set_task_error_manager(t_error);
+							}
+
 							end_task(mp_carrier_three_level_task);
 							m_carrier_status = E_THREE_LEVEL_OVER;
 						}
@@ -478,6 +512,7 @@ void Carrier_base::execute_thread_fun()
 							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
 							std::this_thread::sleep_for(std::chrono::milliseconds(1));
 						}
+						//else继续等待,直到任务完成
 					}
 					else
 					{
@@ -499,6 +534,12 @@ void Carrier_base::execute_thread_fun()
 							mp_carrier_three_level_task->set_task_statu(TASK_FREE);
 							mp_carrier_three_level_task.reset();
 							m_carrier_status = E_TWO_LEVEL_WORK;
+						}
+							//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_carrier_three_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_carrier_three_level_task->set_task_statu(TASK_SIGNED);
+							m_carrier_status = E_THREE_LEVEL_WORK;
 						}
 						//else //保持不动, 直到发送方给定新的任务,
 					}
@@ -513,35 +554,48 @@ void Carrier_base::execute_thread_fun()
 				{
 					if ( mp_carrier_two_level_task.get() != NULL )
 					{
-						//执行三级任务
+						mp_carrier_two_level_task->set_task_statu(TASK_WORKING);
+						//执行二级任务
 						std::unique_lock<std::mutex> t_lock(mp_carrier_two_level_task->m_lock);
-						m_parkspace_unit_id = mp_carrier_two_level_task->m_parkspace_unit_id;
-						m_parkspace_floor_id = mp_carrier_two_level_task->m_parkspace_floor_id;
-						m_parkspace_room_id = mp_carrier_two_level_task->m_parkspace_room_id;
-						m_command_key = mp_carrier_two_level_task->m_command_key;
-						m_motion_direction = mp_carrier_two_level_task->m_motion_direction;
-						m_car_center_x = mp_carrier_two_level_task->m_car_center_x;
-						m_car_center_y = mp_carrier_two_level_task->m_car_center_y;
-						m_car_angle = mp_carrier_two_level_task->m_car_angle;
+						m_request_key = mp_carrier_two_level_task->m_request_key;
+						m_request_x = mp_carrier_two_level_task->m_request_x;
+						m_request_y = mp_carrier_two_level_task->m_request_y;
+						m_request_z = mp_carrier_two_level_task->m_request_z;
+						m_request_space_id = mp_carrier_two_level_task->m_request_space_id;
+						m_request_y1 = mp_carrier_two_level_task->m_request_y1;
+						m_request_y2 = mp_carrier_two_level_task->m_request_y2;
+						m_request_wheelbase = mp_carrier_two_level_task->m_request_wheelbase;
+						m_request_clamp_motion = (Carrier_base::Clamp_motion)mp_carrier_two_level_task->m_request_clamp_motion;
+						m_request_joint_motion = (Carrier_base::Joint_motion)mp_carrier_two_level_task->m_request_joint_motion;
 
 						//更新通信
 						update_device_communication();
 
-						//检查设备的答复
-						if ( m_respons_status == RESPONS_OVER )
-						{
-							mp_carrier_two_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							end_task(mp_carrier_two_level_task);
-							m_carrier_status = E_TWO_LEVEL_OVER;
-						}
-						else if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+						//检查plc的答复状态
+						if ( m_respons_key == m_request_key && m_respons_status != RESPONS_WORKING )
 						{
+							mp_carrier_two_level_task->m_respons_key = m_respons_key;
 							mp_carrier_two_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							//添加错误码
-							Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
-							mp_carrier_two_level_task->set_task_error_manager(t_error);
+							mp_carrier_two_level_task->m_respons_x = m_respons_x;
+							mp_carrier_two_level_task->m_respons_y = m_respons_y;
+							mp_carrier_two_level_task->m_respons_z = m_respons_z;
+							mp_carrier_two_level_task->m_respons_space_id = m_respons_space_id;
+							mp_carrier_two_level_task->m_respons_y1 = m_respons_y1;
+							mp_carrier_two_level_task->m_respons_y2 = m_respons_y2;
+							mp_carrier_two_level_task->m_respons_wheelbase = m_respons_wheelbase;
+							mp_carrier_two_level_task->m_respons_clamp_motion = (Carrier_task::Clamp_motion)m_respons_clamp_motion;
+							mp_carrier_two_level_task->m_respons_joint_motion = (Carrier_task::Joint_motion)m_respons_joint_motion;
+
+							//如果故障,则添加错误码
+							if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+							{
+								//添加错误码
+								Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+								mp_carrier_two_level_task->set_task_error_manager(t_error);
+							}
+
 							end_task(mp_carrier_two_level_task);
-							m_carrier_status = E_TWO_LEVEL_OVER;
+							m_carrier_status = E_THREE_LEVEL_OVER;
 						}
 						else
 						{
@@ -549,6 +603,7 @@ void Carrier_base::execute_thread_fun()
 							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
 							std::this_thread::sleep_for(std::chrono::milliseconds(1));
 						}
+						//else继续等待,直到任务完成
 					}
 					else
 					{
@@ -570,6 +625,12 @@ void Carrier_base::execute_thread_fun()
 							mp_carrier_two_level_task->set_task_statu(TASK_FREE);
 							mp_carrier_two_level_task.reset();
 							m_carrier_status = E_ONE_LEVEL_WORK;
+						}
+							//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_carrier_two_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_carrier_two_level_task->set_task_statu(TASK_SIGNED);
+							m_carrier_status = E_TWO_LEVEL_WORK;
 						}
 						//else //保持不动, 直到发送方给定新的任务,
 					}
@@ -584,42 +645,55 @@ void Carrier_base::execute_thread_fun()
 				{
 					if ( mp_carrier_one_level_task.get() != NULL )
 					{
-						//执行三级任务
+						mp_carrier_one_level_task->set_task_statu(TASK_WORKING);
+						//执行一级任务,
 						std::unique_lock<std::mutex> t_lock(mp_carrier_one_level_task->m_lock);
-						m_parkspace_unit_id = mp_carrier_one_level_task->m_parkspace_unit_id;
-						m_parkspace_floor_id = mp_carrier_one_level_task->m_parkspace_floor_id;
-						m_parkspace_room_id = mp_carrier_one_level_task->m_parkspace_room_id;
-						m_command_key = mp_carrier_one_level_task->m_command_key;
-						m_motion_direction = mp_carrier_one_level_task->m_motion_direction;
-						m_car_center_x = mp_carrier_one_level_task->m_car_center_x;
-						m_car_center_y = mp_carrier_one_level_task->m_car_center_y;
-						m_car_angle = mp_carrier_one_level_task->m_car_angle;
+						m_request_key = mp_carrier_one_level_task->m_request_key;
+						m_request_x = mp_carrier_one_level_task->m_request_x;
+						m_request_y = mp_carrier_one_level_task->m_request_y;
+						m_request_z = mp_carrier_one_level_task->m_request_z;
+						m_request_space_id = mp_carrier_one_level_task->m_request_space_id;
+						m_request_y1 = mp_carrier_one_level_task->m_request_y1;
+						m_request_y2 = mp_carrier_one_level_task->m_request_y2;
+						m_request_wheelbase = mp_carrier_one_level_task->m_request_wheelbase;
+						m_request_clamp_motion = (Carrier_base::Clamp_motion)mp_carrier_one_level_task->m_request_clamp_motion;
+						m_request_joint_motion = (Carrier_base::Joint_motion)mp_carrier_one_level_task->m_request_joint_motion;
 
 						//更新通信
 						update_device_communication();
 
-						//检查设备的答复
-						if ( m_respons_status == RESPONS_OVER )
-						{
-							mp_carrier_one_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							end_task(mp_carrier_one_level_task);
-							m_carrier_status = E_ONE_LEVEL_OVER;
-						}
-						else if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+						//检查plc的答复状态
+						if ( m_respons_key == m_request_key && m_respons_status != RESPONS_WORKING )
 						{
-							mp_carrier_one_level_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
-							//添加错误码
-							Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
-							mp_carrier_one_level_task->set_task_error_manager(t_error);
+							mp_carrier_one_level_task->m_respons_x = m_respons_x;
+							mp_carrier_one_level_task->m_respons_y = m_respons_y;
+							mp_carrier_one_level_task->m_respons_z = m_respons_z;
+							mp_carrier_one_level_task->m_respons_space_id = m_respons_space_id;
+							mp_carrier_one_level_task->m_respons_y1 = m_respons_y1;
+							mp_carrier_one_level_task->m_respons_y2 = m_respons_y2;
+							mp_carrier_one_level_task->m_respons_wheelbase = m_respons_wheelbase;
+							mp_carrier_one_level_task->m_respons_clamp_motion = (Carrier_task::Clamp_motion)m_respons_clamp_motion;
+							mp_carrier_one_level_task->m_respons_joint_motion = (Carrier_task::Joint_motion)m_respons_joint_motion;
+
+							//如果故障,则添加错误码
+							if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+							{
+								//添加错误码
+								Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+								mp_carrier_one_level_task->set_task_error_manager(t_error);
+							}
+
 							end_task(mp_carrier_one_level_task);
 							m_carrier_status = E_ONE_LEVEL_OVER;
+
 						}
-						else if(m_carrier_status == E_ONE_LEVEL_WORK)
+						else
 						{
 							//设备正常运行
 							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
 							std::this_thread::sleep_for(std::chrono::milliseconds(1));
 						}
+						//else继续等待,直到任务完成
 					}
 					else
 					{
@@ -642,6 +716,12 @@ void Carrier_base::execute_thread_fun()
 							mp_carrier_one_level_task.reset();
 							m_carrier_status = E_READY;
 						}
+						//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_carrier_one_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_carrier_one_level_task->set_task_statu(TASK_SIGNED);
+							m_carrier_status = E_ONE_LEVEL_WORK;
+						}
 						//else //保持不动, 直到发送方给定新的任务,
 					}
 					else
@@ -739,94 +819,20 @@ void Carrier_base::execute_thread_fun()
 	return;
 }
 
+//执行线程工作函数, 正在执行任务单.
+Error_manager Carrier_base::execute_thread_working(std::shared_ptr<Carrier_task> p_carrier_task, Carrier_status & carrier_status)
+{
+	return Error_code::SUCCESS;
+}
+//执行线程工作函数, 已经完成任务单. 等待新的指令
+Error_manager Carrier_base::execute_thread_over(std::shared_ptr<Carrier_task> p_carrier_task, Carrier_status & carrier_status)
+{
+	return Error_code::SUCCESS;
+}
 
 //更新设备底层通信数据
 Error_manager Carrier_base::update_device_communication()
 {
-	//加锁
-	std::mutex * tp_data_lock = 	Dispatch_communication::get_instance_references().get_data_lock();
-	std::unique_lock<std::mutex> t_lock(*tp_data_lock);
-
-	//请求消息, 调度->plc
-	Dispatch_communication::Request_from_dispatch_to_plc * tp_request_from_dispatch_to_plc =
-	Dispatch_communication::get_instance_references().get_request_from_dispatch_to_plc();
-	tp_request_from_dispatch_to_plc->m_block_id = m_parkspace_unit_id;
-	tp_request_from_dispatch_to_plc->m_floor_id = m_parkspace_floor_id;
-	tp_request_from_dispatch_to_plc->m_parkspace_id = m_parkspace_room_id;
-	memcpy(tp_request_from_dispatch_to_plc->m_command_key, m_command_key.c_str(), m_command_key.size());
-	tp_request_from_dispatch_to_plc->m_is_entrance_flag = m_motion_direction;
-	tp_request_from_dispatch_to_plc->m_center_x = m_car_center_x;
-	tp_request_from_dispatch_to_plc->m_center_y = m_car_center_y;
-	tp_request_from_dispatch_to_plc->m_car_angle = m_car_angle;
-
-
-	//答复消息, plc->调度
-	Dispatch_communication::Response_from_plc_to_dispatch * tp_response_from_plc_to_dispatch =
-	Dispatch_communication::get_instance_references().get_response_from_plc_to_dispatch();
-	m_respons_key = (char*)(tp_response_from_plc_to_dispatch->m_command_key);
-	if ( m_respons_key == m_command_key )
-	{
-		if ( tp_response_from_plc_to_dispatch->m_task_status == 0 )
-		{
-			if ( tp_response_from_plc_to_dispatch->m_command_flag == 0 )
-			{
-				m_respons_status = RESPONS_NORMAL;
-			}
-			else
-			{
-				m_respons_status = RESPONS_OVER;
-			}
-		}
-		else if ( tp_response_from_plc_to_dispatch->m_task_status == 1 )
-		{
-			m_respons_status = RESPONS_MINOR_ERROR;
-		}
-		else
-		{
-			m_respons_status = RESPONS_CRITICAL_ERROR;
-		}
-	}
-	else
-	{
-		m_respons_status = RESPONS_NORMAL;
-	}
-
-	//状态消息, 调度->plc
-	Dispatch_communication::Status_from_dispatch_to_plc * tp_status_from_dispatch_to_plc =
-	Dispatch_communication::get_instance_references().get_status_from_dispatch_to_plc();
-	tp_status_from_dispatch_to_plc->m_heartbeat++;
-
-	//状态消息, plc->调度
-	Dispatch_communication::Status_from_plc_to_dispatch * tp_status_from_plc_to_dispatch =
-	Dispatch_communication::get_instance_references().get_status_from_plc_to_dispatch();
-	//通过心跳帧来判断通信是否正常
-	if ( m_last_heartbeat != tp_status_from_plc_to_dispatch->m_heartbeat )
-	{
-		m_last_heartbeat = tp_status_from_plc_to_dispatch->m_heartbeat;
-		m_status_updata_time = std::chrono::system_clock::now();
-
-		m_carrier_coordinate_x = tp_status_from_plc_to_dispatch->m_carrier_coordinates;
-		m_carrier_coordinate_z = tp_status_from_plc_to_dispatch->m_elevator_coordinates;
-		m_carrier_angle = tp_status_from_plc_to_dispatch->m_carrier_angle;
-
-		m_elevator_device_status = tp_status_from_plc_to_dispatch->m_elevator_information;
-		memcpy(m_elevator_error_code, tp_status_from_plc_to_dispatch->m_elevator_error_code, 50);
-		m_elevator_error_description = (char*)(tp_status_from_plc_to_dispatch->m_carrier_error_string);
-
-		m_carrier_device_status = tp_status_from_plc_to_dispatch->m_carrier_information;
-		memcpy(m_carrier_error_code, tp_status_from_plc_to_dispatch->m_carrier_error_code, 50);
-		m_carrier_error_description = (char*)(tp_status_from_plc_to_dispatch->m_carrier_error_string);
-
-		if ( m_carrier_status == E_DISCONNECT )
-		{
-			m_carrier_status = E_THREE_LEVEL_WORK;
-		}
-	}
-	else if(std::chrono::system_clock::now() - m_status_updata_time > std::chrono::milliseconds(CARRIER_COMMUNICATION_OVER_TIME_MS))
-	{
-		m_carrier_status = E_DISCONNECT;
-	}
-
 
 	return Error_code::SUCCESS;
 }
@@ -843,5 +849,5 @@ Error_manager Carrier_base::cancel_command()
 }
 
 
-
+*/
 

+ 121 - 37
dispatch/carrier_base.h

@@ -12,14 +12,15 @@
 #include "../tool/thread_condition.h"
 #include "../dispatch/carrier_task.h"
 
-//搬运器的基类, 楚天项目就是电梯和中跑车的合并
+
+//搬运器的基类, 普爱项目就是 电梯和中跑车和小跑车 三合一
 class Carrier_base
 {
 public:
 	//搬运器底层通信延时5000ms
 #define	CARRIER_COMMUNICATION_OVER_TIME_MS	5000
 
-	//搬运器状态,
+	//搬运器状态,这个类的总状态,这里指工作任务流程
 	enum Carrier_status
 	{
 		E_UNKNOW               	= 0,    //未知
@@ -37,15 +38,61 @@ public:
 		E_DISCONNECT			= 101, 	//通信故障
 	};
 
+	//小跑车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0,    //无动作.
+	    E_CLAMP_TIGHT               	= 1,    //夹紧夹杆
+	    E_CLAMP_LOOSE					= 2,	//松开夹杆
+	};
+
+	//中跑车和平层轨道的对接
+	enum Joint_motion
+	{
+		E_JOINT_NO_ACTION            	= 0,    //无动作.
+		E_JOINT_HOLD_OUT               	= 1,    //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+		E_JOINT_TAKE_BACK				= 2,	//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+	};
+
+	//小跑车的位置,是否在中跑车上面
+	enum Small_sports_car_motion
+	{
+		E_SMALL_SPORTS_NO_ACTION		= 0,    //无动作.
+		E_SMALL_SPORTS_CAR_GET_AWAY 	= 1,    //小跑车离开中跑车
+		E_SMALL_SPORTS_CAR_GET_BACK		= 2,	//小跑车返回中跑车
+	};
+
+	
 	//指令完成状态, 搬运器答复指令, 返回任务完成的情况
 	enum Respons_status
 	{
-		RESPONS_NORMAL             	= 0,    //正常
+		RESPONS_WORKING            	= 0,    //任务进行中
 		RESPONS_OVER               	= 1,    //任务完成
 		RESPONS_MINOR_ERROR			= 100,	//一般故障, 可恢复
 		RESPONS_CRITICAL_ERROR		= 101,	//致命故障,不可恢复
 	};
 
+	//搬运器的硬件设备状态
+	enum Device_status
+	{
+		DEVICE_UNKNOWN              = 0,    //设备未知
+		DEVICE_READY                = 1,    //设备空闲(可以接受新的指令任务)
+		DEVICE_WORKING				= 2,	//设备工作中
+		DEVICE_EMERGENCY_STOP		= 3,	//设备急停
+		DEVICE_UNSAFETY				= 4,	//设备不安全
+		DEVICE_COLLISION			= 5,	//设备发生碰撞
+		DEVICE_FAULT				= 6,	//设备故障
+	};
+
+	//搬运器的负载状态, 小跑车上面是否有车.
+	enum Load_status
+	{
+		LOAD_UNKNOWN				= 0,	//负载未知
+		HAVE_CAR               		= 1,    //有车
+		NO_CAR            			= 2,    //没车
+	};
+
+
 public:
 	Carrier_base();
 	Carrier_base(const Carrier_base& other)= default;
@@ -64,23 +111,23 @@ public://API functions
 	//处理三级任务, 核心任务
 	virtual Error_manager execute_three_level_task(std::shared_ptr<Carrier_task> p_carrier_task);
 	//检查状态,是否正常运行
-	Error_manager check_status();
+	virtual Error_manager check_status();
 
 	//注意了, 调度任务允许同时接受多个任务
 	//判断能否执行一级任务
-	Error_manager	check_one_level_task();
+	virtual Error_manager	check_one_level_task();
 	//判断能否执行二级任务
-	Error_manager	check_two_level_task();
+	virtual Error_manager	check_two_level_task();
 	//判断能否执行三级任务
-	Error_manager	check_three_level_task();
+	virtual Error_manager	check_three_level_task();
 
 	//结束任务单,里面会根据任务的故障等级修正 任务单的状态
-	Error_manager end_task(std::shared_ptr<Carrier_task> carrier_task);
+	virtual Error_manager end_task(std::shared_ptr<Carrier_task> carrier_task);
 	//取消任务单,由发送方提前取消任务单
-	Error_manager cancel_task(std::shared_ptr<Carrier_task> carrier_task);
+	virtual Error_manager cancel_task(std::shared_ptr<Carrier_task> carrier_task);
 
 	//判断是否为待机,如果已经准备好,则可以执行任务。
-	bool is_ready();
+	virtual bool is_ready();
 public://get or set member variable
 	Carrier_status get_carrier_status();
 
@@ -88,50 +135,87 @@ protected://member functions
 	//执行外界任务的执行函数
 	void execute_thread_fun();
 
+	//执行线程工作函数, 正在执行任务单.
+	virtual Error_manager execute_thread_working(std::shared_ptr<Carrier_task> p_carrier_task, Carrier_status & carrier_status);
+	//执行线程工作函数, 已经完成任务单. 等待新的指令
+	virtual Error_manager execute_thread_over(std::shared_ptr<Carrier_task> p_carrier_task, Carrier_status & carrier_status);
+
+
 	//更新设备底层通信数据
 	virtual Error_manager update_device_communication();
 
 	//取消下发的指令
 	virtual Error_manager cancel_command();
+
+
 protected://member variable
 	std::atomic<Carrier_status>			m_carrier_status;			//搬运器总状态, 控制任务流程
 	int 								m_carrier_id;				//搬运器id, (楚天项目和单元号对应)
-	
-	//下发到硬件
-	//搬运器的目标车位
-	unsigned short 						m_parkspace_unit_id;		//车位单元号(楚天项目为1~3)
-	unsigned short 						m_parkspace_floor_id;		//车位楼层号(楚天项目为1~14)
-	unsigned short 						m_parkspace_room_id;		//车位同层的房间号	(楚天项目一楼为1~4, 楼上为1~6)
-	std::string							m_command_key;				//任务唯一码, 用作识别
-	unsigned char						m_motion_direction;			//调度方向, 根据停车取车选择出入口, 	1=入口,0=非入口
-	float 								m_car_center_x;				//汽车的中心坐标x
-	float 								m_car_center_y;				//汽车的中心坐标y
-	float 								m_car_angle;				//汽车的旋转角(角度-90~90)
-
-	//硬件反馈
-	//搬运器当前坐标
+
+
+
+
+	//调度下发到plc
+	std::string							m_request_key;				//请求唯一码, 用作识别
+	//请求的目标坐标和动作
+	float 								m_request_x;				//搬运器坐标x轴, 中跑车控制横向移动
+	float 								m_request_y;				//搬运器坐标y轴, 小跑车控制纵向移动
+	float 								m_request_z;				//搬运器坐标z轴, 电梯控制上下移动
+	int 								m_request_space_id;			//搬运器空间位置的id.
+	float 								m_request_y1;				//搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	float 								m_request_y2;				//搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	float 								m_request_wheelbase;		//搬运器小跑车的抓车杆前后轮距.
+	Clamp_motion						m_request_clamp_motion;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	Joint_motion						m_request_joint_motion;		//电梯与X轴的横向轨道对接,0=无动作,
+	//1=进行对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+	//2=松开对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+
+
+
+	//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轴, 电梯控制上下移动
+	int 								m_respons_space_id;			//搬运器空间位置的id.
+	float 								m_respons_y1;				//搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	float 								m_respons_y2;				//搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	float 								m_respons_wheelbase;		//搬运器小跑车的抓车杆前后轮距.
+	Clamp_motion						m_respons_clamp_motion;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	Joint_motion						m_respons_joint_motion;		//电梯与X轴的横向轨道对接,0=无动作,
+	//1=进行对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+	//2=松开对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+
 
 
 
 	//硬件状态, 目前只做显示判断
 	std::chrono::system_clock::time_point	m_status_updata_time;	//状态更新时间点
 	unsigned char						m_last_heartbeat;			//上一次的心跳
+	//搬运器的设备状态数据,
+	Device_status						m_device_status;			//搬运器的硬件设备状态
+	Load_status							m_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=松开
+	Joint_motion						m_actual_joint_motion1;		//电梯与X轴的横向轨道对接,0=无动作,
+	Joint_motion						m_actual_joint_motion2;		//电梯与X轴的横向轨道对接,0=无动作,
+	Small_sports_car_motion				m_actual_small_sports_car_motion;	//小跑车的位置,是否在中跑车上面
+	//搬运器设备的错误码
+	unsigned char						m_carrier_error_code[50];	//搬运器设备的故障信息位
+	unsigned char						m_carrier_warning_code[50];	//搬运器设备的警告信息位
+	std::string							m_carrier_error_description;//搬运器设备的错误描述
+
+
+
 
-	//硬件坐标,
-	float 								m_carrier_coordinate_x;			//搬运器坐标x轴, 中跑车控制横向移动
-	float 								m_carrier_coordinate_y;			//搬运器坐标y轴, (本模块默认为0, 由AGV模块去控制纵向移动)
-	float 								m_carrier_coordinate_z;			//搬运器坐标z轴, 电梯控制上下移动
-	float 								m_carrier_angle;				//搬运器角度
-	//搬运器设备的状态(0bit为1:急停正常, 1bit为1:处于安全位置, 2bit为1:静止状态, 3bit为1:可执行新指令, 4bit为1:存在故障)
-	unsigned char						m_carrier_device_status;	//搬运器设备的状态, 楚天项目就是中跑车
-	unsigned char						m_carrier_error_code[50];	//搬运器设备的报警信息位
-	std::string							m_carrier_error_description;//搬运器设备的报警状态描述
-	//升降机设备的状态(0bit为1:急停正常, 1bit为1:处于安全位置, 2bit为1:静止状态, 3bit为1:可执行新指令, 4bit为1:存在故障)
-	unsigned char						m_elevator_device_status;	//升降机设备状态, 楚天项目就是电梯
-	unsigned char						m_elevator_error_code[50];	//升降机设备的报警信息位
-	std::string							m_elevator_error_description;//升降机设备的报警状态描述
 
 
 	//任务执行线程

+ 26 - 53
dispatch/carrier_task.cpp

@@ -12,64 +12,38 @@ Carrier_task::Carrier_task()
 	m_task_statu_information.clear();
 	m_task_error_manager.error_manager_clear_all();
 
-	m_parkspace_unit_id = 0;
-	m_parkspace_floor_id = 0;
-	m_parkspace_room_id = 0;
-//	m_command_key = "";
-	m_motion_direction = 0;
-	m_car_center_x = 0;
-	m_car_center_y = 0;
-	m_car_angle = 0;
-
-
-
-	unsigned short 						m_parkspace_floor_id;		//车位楼层号(楚天项目为1~14)
-	unsigned short 						m_parkspace_room_id;		//车位同层的房间号	(楚天项目一楼为1~4, 楼上为1~6)
-	std::string							m_command_key;				//任务唯一码
-	unsigned char						m_motion_direction;			//调度方向, 根据停车取车选择出入口, 	1=入口,0=非入口
-	float 								m_car_center_x;				//汽车的中心坐标x
-	float 								m_car_center_y;				//汽车的中心坐标y
-	float 								m_car_angle;				//汽车的旋转角(角度-90~90)
-
-	//任务执行结果
-	Respons_status						m_respons_status;			//指令完成状态, 搬运器答复指令, 返回任务完成的情况
-}
 
-Carrier_task::~Carrier_task()
-{
+	m_request_x = 0;				//搬运器坐标x轴,
+	m_request_y = 0;				//搬运器坐标y轴,
+	m_request_z = 0;				//搬运器坐标z轴,
+	m_request_y1 = 0;				//搬运器坐标y1轴, 搬运器抓车杆纵向移动(前轮抓杆)
+	m_request_y2 = 0;				//搬运器坐标y2轴, 搬运器抓车杆纵向移动(后轮抓杆)
+	m_request_clamp_motion = E_CLAMP_NO_ACTION;		//搬运器夹车杆. 0=无动作,1=夹紧,2=松开
+	m_request_joint_motion_x = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_request_joint_motion_y = E_JOINT_NO_ACTION;	//小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_request_space_id = 0;			//搬运器空间位置的id.
+	m_request_floor_id = 0;			//搬运器楼层位置的id.
+	m_request_wheelbase = 0;		//搬运器抓车杆前后轮距.
+
+	m_respons_status = RESPONS_WORKING;			//指令完成状态, 搬运器答复指令, 返回任务完成的情况
+	m_respons_x = 0;				//搬运器坐标x轴,
+	m_respons_y = 0;				//搬运器坐标y轴,
+	m_respons_z = 0;				//搬运器坐标z轴,
+	m_respons_y1 = 0;				//搬运器坐标y1轴, 搬运器抓车杆纵向移动(前轮抓杆)
+	m_respons_y2 = 0;				//搬运器坐标y2轴, 搬运器抓车杆纵向移动(后轮抓杆)
+	m_respons_clamp_motion = E_CLAMP_NO_ACTION;		//搬运器夹车杆. 0=无动作,1=夹紧,2=松开
+	m_respons_joint_motion_x = E_JOINT_NO_ACTION;	//电梯与X轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_respons_joint_motion_y = E_JOINT_NO_ACTION;	//小跑车与Y轴的横向轨道对接,0=无动作,1=进行对接, 2=松开对接
+	m_respons_space_id = 0;			//搬运器空间位置的id.
+	m_respons_floor_id = 0;			//搬运器楼层位置的id.
+	m_respons_wheelbase = 0;		//搬运器抓车杆前后轮距.
 
-}
 
+}
 
-//初始化任务单,必须初始化之后才可以使用,(可选参数)
-//    input:tast_receiver 接受对象
-//    input:task_over_time 超时时间
-Error_manager Carrier_task::task_init(void* p_tast_receiver,
-						std::chrono::milliseconds task_over_time,
-						unsigned short parkspace_unit_id,
-						unsigned shortparkspace_floor_id,
-						unsigned shortparkspace_room_id,
-						std::string command_key,
-						unsigned char motion_direction,
-						float car_center_x,
-						float car_center_y,
-						float car_angle
-)
+Carrier_task::~Carrier_task()
 {
-	m_task_statu = TASK_CREATED;
-	m_task_statu_information.clear();
-	m_task_error_manager.error_manager_clear_all();
 
-	m_parkspace_unit_id = parkspace_unit_id;
-	m_parkspace_floor_id = shortparkspace_floor_id;
-	m_parkspace_room_id = shortparkspace_room_id;
-	m_command_key = command_key;
-	m_motion_direction = motion_direction;
-	m_car_center_x = car_center_x;
-	m_car_center_y = car_center_y;
-	m_car_angle = car_angle;
-
-	m_respons_status = RESPONS_NORMAL;
 }
 
 
@@ -79,4 +53,3 @@ Error_manager Carrier_task::task_init(void* p_tast_receiver,
 
 
 
-

+ 47 - 26
dispatch/carrier_task.h

@@ -17,11 +17,26 @@ public:
 	//指令完成状态, 搬运器答复指令, 返回任务完成的情况
 	enum Respons_status
 	{
-		RESPONS_NORMAL             	= 0,    //正常
+		RESPONS_WORKING             = 0,    //正常
 		RESPONS_OVER               	= 1,    //任务完成
 		RESPONS_MINOR_ERROR			= 100,	//一般故障, 可恢复
 		RESPONS_CRITICAL_ERROR		= 101,	//致命故障,不可恢复
 	};
+	//小跑车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0,    //无动作.
+		E_CLAMP_TIGHT               	= 1,    //夹紧夹杆
+		E_CLAMP_LOOSE					= 2,	//松开夹杆
+	};
+
+	//中跑车和平层轨道的对接
+	enum Joint_motion
+	{
+		E_JOINT_NO_ACTION            	= 0,    //无动作.
+		E_JOINT_HOLD_OUT               	= 1,    //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+		E_JOINT_TAKE_BACK				= 2,	//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+	};
 public:
 	Carrier_task();
 	Carrier_task(const Carrier_task& other)= default;
@@ -29,20 +44,6 @@ public:
 	~Carrier_task();
 public://API functions
 
-	//初始化任务单,必须初始化之后才可以使用,(可选参数)
-	//    input:tast_receiver 接受对象
-	//    input:task_over_time 超时时间
-	Error_manager task_init(void* p_tast_receiver,
-							std::chrono::milliseconds task_over_time,
-							unsigned short parkspace_unit_id,
-							unsigned shortparkspace_floor_id,
-							unsigned shortparkspace_room_id,
-							std::string command_key,
-							unsigned char motion_direction = 0,
-							float car_center_x = 0,
-							float car_center_y = 0,
-							float car_angle = 0
-	);
 public://get or set member variable
 
 protected://member functions
@@ -51,18 +52,38 @@ public://member variable
 
 	std::mutex							m_lock;	//锁
 
-	//搬运器的目标车位
-	unsigned short 						m_parkspace_unit_id;		//车位单元号(楚天项目为1~3)
-	unsigned short 						m_parkspace_floor_id;		//车位楼层号(楚天项目为1~14)
-	unsigned short 						m_parkspace_room_id;		//车位同层的房间号	(楚天项目一楼为1~4, 楼上为1~6)
-	std::string							m_command_key;				//任务唯一码
-	unsigned char						m_motion_direction;			//调度方向, 根据停车取车选择出入口, 	1=入口,0=非入口
-	float 								m_car_center_x;				//汽车的中心坐标x
-	float 								m_car_center_y;				//汽车的中心坐标y
-	float 								m_car_angle;				//汽车的旋转角(角度-90~90)
-
-	//任务执行结果
+//调度下发到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;		//搬运器小跑车的抓车杆前后轮距.
+
+
 
 private:
 

+ 340 - 0
dispatch/catcher.cpp

@@ -0,0 +1,340 @@
+//
+// Created by huli on 2021/3/2.
+//
+
+#include "catcher.h"
+
+Catcher::Catcher()
+{
+	m_request_x = 0;				//机器人坐标x轴,
+	m_request_y = 0;				//机器人坐标y轴,
+	m_request_b = 0;				//机器人坐标b轴, 旋转范围80~280
+	m_request_z = 0;				//机器人坐标z轴,
+	m_request_space_id = 0;			//机器人空间位置的id.
+	m_request_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	m_request_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	m_request_wheelbase = 0;		//机器人抓车杆前后轮距.
+	m_request_clamp_motion = E_CLAMP_NO_ACTION;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+	m_respons_status = RESPONS_WORKING;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+	m_respons_x = 0;				//机器人坐标x轴,
+	m_respons_y = 0;				//机器人坐标y轴,
+	m_respons_b = 0;				//机器人坐标b轴, 旋转范围80~280
+	m_respons_z = 0;				//机器人坐标z轴,
+	m_respons_space_id = 0;			//机器人空间位置的id.
+	m_respons_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	m_respons_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	m_respons_wheelbase = 0;		//机器人抓车杆前后轮距.
+	m_respons_clamp_motion = E_CLAMP_NO_ACTION;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+	m_status_updata_time = std::chrono::system_clock::now();
+	m_last_heartbeat = 0;			//上一次的心跳
+	m_actual_device_status = DEVICE_UNKNOWN;			//机器人的硬件设备状态
+	m_actual_load_status = LOAD_UNKNOWN;				//机器人的负载状态, 小跑车上面是否有车.
+	m_actual_x = 0;					//机器人坐标x轴,
+	m_actual_y = 0;					//机器人坐标y轴,
+	m_actual_b = 0;					//机器人坐标b轴, 旋转范围80~280
+	m_actual_z = 0;					//机器人坐标z轴,
+	m_actual_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	m_actual_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	m_actual_clamp_motion1 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_clamp_motion2 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_clamp_motion3 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	m_actual_clamp_motion4 = E_CLAMP_NO_ACTION;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+
+	memset(m_actual_error_code, 0, 50);	//搬运器设备的报警信息位
+	memset(m_actual_warning_code, 0, 50);	//升降机设备的报警信息位
+}
+
+Catcher::~Catcher()
+{
+
+}
+
+//检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
+Error_manager Catcher::check_task_type(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CATCHER_TASK)
+	{
+		return Error_manager(Error_code::CATCHER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Catcher::check_task_type  get_task_type() != CATCHER_TASK ");
+	}
+
+	return Error_code::SUCCESS;
+}
+
+//获取硬件设备的状态, 必须子类继承
+Catcher::Device_status Catcher::get_actual_device_status()
+{
+	return m_actual_device_status;
+}
+
+
+//把任务单写入到内存中, 子类必须重载
+Error_manager Catcher::write_task_to_memory(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CATCHER_TASK)
+	{
+		return Error_manager(Error_code::CATCHER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Catcher::check_task_type  get_task_type() != CATCHER_TASK ");
+	}
+	else
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+
+		Catcher_task* tp_catcher_task = (Catcher_task*)p_task.get();
+		std::unique_lock<std::mutex> t_lock1(tp_catcher_task->m_lock);
+		m_request_key = tp_catcher_task->m_request_key;
+		m_request_x = tp_catcher_task->m_request_x;
+		m_request_y = tp_catcher_task->m_request_y;
+		m_request_b = tp_catcher_task->m_request_b;
+		m_request_z = tp_catcher_task->m_request_z;
+		m_request_space_id = tp_catcher_task->m_request_space_id;
+		m_request_d1 = tp_catcher_task->m_request_d1;
+		m_request_d2 = tp_catcher_task->m_request_d2;
+		m_request_wheelbase = tp_catcher_task->m_request_wheelbase;
+		m_request_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_catcher_task->m_request_clamp_motion;
+
+		return Error_code::SUCCESS;
+	}
+	return Error_code::SUCCESS;
+}
+//更新设备底层通信数据, 子类必须重载
+Error_manager Catcher::update_device_communication()
+{
+	std::unique_lock<std::mutex> t_lock1(Dispatch_communication::get_instance_references().m_data_lock);
+	std::unique_lock<std::mutex> t_lock(m_lock);
+
+	//请求消息, 调度->plc
+	Dispatch_communication::Catcher_request_from_dispatch_to_plc_for_data * tp_catcher_request_from_dispatch_to_plc_for_data =
+	& Dispatch_communication::get_instance_references().m_catcher_request_from_dispatch_to_plc_for_data[m_device_id];
+	Dispatch_communication::Catcher_request_from_dispatch_to_plc_for_key * tp_catcher_request_from_dispatch_to_plc_for_key =
+	& Dispatch_communication::get_instance_references().m_catcher_request_from_dispatch_to_plc_for_key[m_device_id];
+	memset(tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key, 0, 50);
+	memcpy(tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key, m_request_key.c_str(), m_request_key.size());
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_x = m_request_x;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_y = m_request_y;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_b = m_request_b;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_z = m_request_z;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_clamp_motion = m_request_clamp_motion;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_wheelbase = m_request_wheelbase;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_d1 = m_request_d1;
+	tp_catcher_request_from_dispatch_to_plc_for_data->m_request_d2 = m_request_d2;
+
+
+
+	//答复消息, plc->调度
+	Dispatch_communication::Catcher_response_from_plc_to_dispatch * tp_catcher_response_from_plc_to_dispatch =
+	& Dispatch_communication::get_instance_references().m_catcher_response_from_plc_to_dispatch[m_device_id];
+	m_respons_key = (char*) tp_catcher_response_from_plc_to_dispatch->m_respons_key;
+	m_respons_status = (Dispatch_device_base::Respons_status)tp_catcher_response_from_plc_to_dispatch->m_respons_status;
+	m_respons_x = tp_catcher_response_from_plc_to_dispatch->m_respons_x;
+	m_respons_y = tp_catcher_response_from_plc_to_dispatch->m_respons_y;
+	m_respons_b = tp_catcher_response_from_plc_to_dispatch->m_respons_b;
+	m_respons_z = tp_catcher_response_from_plc_to_dispatch->m_respons_z;
+	m_respons_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_catcher_response_from_plc_to_dispatch->m_respons_clamp_motion;
+	m_respons_wheelbase = tp_catcher_response_from_plc_to_dispatch->m_respons_wheelbase;
+	m_respons_d1 = tp_catcher_response_from_plc_to_dispatch->m_respons_d1;
+	m_respons_d2 = tp_catcher_response_from_plc_to_dispatch->m_respons_d2;
+
+
+	//状态消息, plc->调度
+	Dispatch_communication::Catcher_status_from_plc_to_dispatch *tp_catcher_status_from_plc_to_dispatch =
+	& Dispatch_communication::get_instance_references().m_catcher_status_from_plc_to_dispatch[m_device_id];
+	//通过心跳帧来判断通信是否正常
+	if ( m_last_heartbeat != tp_catcher_status_from_plc_to_dispatch->m_heartbeat )
+	{
+		m_last_heartbeat = tp_catcher_status_from_plc_to_dispatch->m_heartbeat;
+		m_status_updata_time = std::chrono::system_clock::now();
+
+		//设备异常  //注注注注注注注注意了, ==的优先级比&要高.
+		if ( (tp_catcher_status_from_plc_to_dispatch->m_safe_status & 0x02) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_EMERGENCY_STOP;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+		else if ( (tp_catcher_status_from_plc_to_dispatch->m_safe_status & 0x01) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_FAULT;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+		else if ( (tp_catcher_status_from_plc_to_dispatch->m_safe_status & 0x08) == 0 )
+		{
+			m_actual_device_status = Dispatch_device_base::DEVICE_COLLISION;
+			m_dispatch_device_status = Dispatch_device_base::E_FAULT;
+		}
+		//正常状态
+		else
+		{
+			if (tp_catcher_status_from_plc_to_dispatch->m_work_status == 1)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_WORKING;
+			}
+			else if(tp_catcher_status_from_plc_to_dispatch->m_work_status == 2)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_READY;
+			}
+			else if(tp_catcher_status_from_plc_to_dispatch->m_work_status == 0)
+			{
+				m_actual_device_status = Dispatch_device_base::DEVICE_UNKNOWN;
+			}
+
+			//故障恢复之后   E_FAULT  ->>  E_THREE_LEVEL_WORK
+			if ( m_dispatch_device_status == Dispatch_device_base::E_FAULT )
+			{
+				m_dispatch_device_status = Dispatch_device_base::E_THREE_LEVEL_WORK;
+			}
+			//else 流程状态维持不变
+		}
+
+		m_actual_load_status = (Dispatch_device_base::Load_status)tp_catcher_status_from_plc_to_dispatch->m_actual_load_status;
+		m_actual_x = tp_catcher_status_from_plc_to_dispatch->m_actual_x;
+		m_actual_y = tp_catcher_status_from_plc_to_dispatch->m_actual_y;
+		m_actual_b = tp_catcher_status_from_plc_to_dispatch->m_actual_b;
+		m_actual_z = tp_catcher_status_from_plc_to_dispatch->m_actual_z;
+		m_actual_d1 = tp_catcher_status_from_plc_to_dispatch->m_actual_d1;
+		m_actual_d2 = tp_catcher_status_from_plc_to_dispatch->m_actual_d2;
+		m_actual_clamp_motion1 = (Dispatch_device_base::Clamp_motion)tp_catcher_status_from_plc_to_dispatch->m_actual_clamp_motion1;
+		m_actual_clamp_motion2 = (Dispatch_device_base::Clamp_motion)tp_catcher_status_from_plc_to_dispatch->m_actual_clamp_motion2;
+		m_actual_clamp_motion3 = (Dispatch_device_base::Clamp_motion)tp_catcher_status_from_plc_to_dispatch->m_actual_clamp_motion3;
+		m_actual_clamp_motion4 = (Dispatch_device_base::Clamp_motion)tp_catcher_status_from_plc_to_dispatch->m_actual_clamp_motion4;
+		memcpy(m_actual_error_code, tp_catcher_status_from_plc_to_dispatch->m_actual_error_code, 50);
+		memcpy(m_actual_warning_code, tp_catcher_status_from_plc_to_dispatch->m_actual_warning_code, 50);
+		m_actual_error_description = (char*)(tp_catcher_status_from_plc_to_dispatch->m_actual_error_description);
+
+		//重连之后,搬运器状态   E_DISCONNECT  ->>  E_THREE_LEVEL_WORK
+		if ( m_dispatch_device_status == Dispatch_device_base::E_DISCONNECT )
+		{
+			m_dispatch_device_status = Dispatch_device_base::E_THREE_LEVEL_WORK;
+		}
+	}
+	else if(std::chrono::system_clock::now() - m_status_updata_time > std::chrono::milliseconds(COMMUNICATION_OVER_TIME_MS))
+	{
+		m_dispatch_device_status = Dispatch_device_base::E_DISCONNECT;
+	}
+	//else 继续等待,直到消息刷新或者超时.
+
+
+
+//
+//	std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
+//	std::cout << " huli test :::: " << " m_dispatch_device_status = " << m_dispatch_device_status << std::endl;
+//	int heat = m_last_heartbeat;
+//	std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_device_status = " << m_actual_device_status << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_load_status = " << m_actual_load_status << std::endl;
+//
+//	std::cout << " huli test :::: " << " m_actual_x = " << m_actual_x << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_y = " << m_actual_y << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_b = " << m_actual_b << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_z = " << m_actual_z << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_d1 = " << m_actual_d1 << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_d2 = " << m_actual_d2 << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_clamp_motion1 = " << m_actual_clamp_motion1 << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_clamp_motion2 = " << m_actual_clamp_motion2 << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_clamp_motion3 = " << m_actual_clamp_motion3 << std::endl;
+//	std::cout << " huli test :::: " << " m_actual_clamp_motion4 = " << m_actual_clamp_motion4 << std::endl;
+//	unsigned int error32 = m_actual_error_code[3];
+//	error32 = (error32<<8) | m_actual_error_code[2];
+//	error32 = (error32<<8) | m_actual_error_code[1];
+//	error32 = (error32<<8) | m_actual_error_code[0];
+//	std::cout << " huli test :::: " << " m_actual_error_code = " << error32 << std::endl;
+//	for (int i = 0; i < 50; ++i)
+//	{
+//		printf("0x%x ", m_actual_error_code[i]);
+//	}
+//	std::cout <<  std::endl;
+//
+//	unsigned int warn32 = m_actual_warning_code[3];
+//	warn32 = (warn32<<8) | m_actual_warning_code[2];
+//	warn32 = (warn32<<8) | m_actual_warning_code[1];
+//	warn32 = (warn32<<8) | m_actual_warning_code[0];
+//	std::cout << " huli test :::: " << " m_actual_warning_code = " << warn32 << std::endl;
+//	for (int i = 0; i < 50; ++i)
+//	{
+//		printf("0x%x ", m_actual_warning_code[i]);
+//	}
+//	std::cout <<  std::endl;
+//	std::cout << " huli test :::: " << " m_actual_error_description = " << m_actual_error_description << std::endl;
+//
+//	for (int i = 0; i < 256; ++i)
+//	{
+//		printf("0x%x ", m_actual_error_description[i]);
+//	}
+//	std::cout <<  std::endl;
+
+
+	return Error_code::SUCCESS;
+}
+//从内存中读数据到任务单, 子类必须重载
+Error_manager Catcher::check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+	if (p_task->get_task_type() != CATCHER_TASK)
+	{
+		return Error_manager(Error_code::CATCHER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Catcher::check_task_type  get_task_type() != CATCHER_TASK ");
+	}
+	else
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+		if ( m_respons_key == m_request_key && m_respons_status != RESPONS_WORKING )
+		{
+			Catcher_task* tp_catcher_task = (Catcher_task*)p_task.get();
+			std::unique_lock<std::mutex> t_lock1(tp_catcher_task->m_lock);
+
+			tp_catcher_task->m_respons_key = m_respons_key;
+			tp_catcher_task->m_respons_status = (Catcher_task::Respons_status)m_respons_status;
+			tp_catcher_task->m_respons_x = m_respons_x;
+			tp_catcher_task->m_respons_y = m_respons_y;
+			tp_catcher_task->m_respons_b = m_respons_b;
+			tp_catcher_task->m_respons_z = m_respons_z;
+			tp_catcher_task->m_respons_space_id = m_respons_space_id;
+			tp_catcher_task->m_respons_d1 = m_respons_d1;
+			tp_catcher_task->m_respons_d2 = m_respons_d2;
+			tp_catcher_task->m_respons_wheelbase = m_respons_wheelbase;
+			tp_catcher_task->m_respons_clamp_motion = (Catcher_task::Clamp_motion)m_respons_clamp_motion;
+
+			//如果故障,则添加错误码
+			if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
+			{
+				//添加错误码
+				Error_manager t_error(CATCHER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+				tp_catcher_task->set_task_error_manager(t_error);
+			}
+
+			return Error_code::SUCCESS;
+		}
+		//返回没有收到数据
+		else
+		{
+			return Error_code::NODATA;
+		}
+	}
+	return Error_code::SUCCESS;
+}
+
+
+
+//取消下发的指令
+Error_manager Catcher::cancel_command()
+{
+	//以后再写 need programe
+	//目前调度和plc的通信指令做的很简单,没有暂停和急停 复位等操作.
+	//这里先空着,以后再写.
+	//调度模块单方面销毁任务, 不管底层plc的执行情况, 也不去告知plc任务取消.
+
+	return Error_code::SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+

+ 99 - 0
dispatch/catcher.h

@@ -0,0 +1,99 @@
+//
+// Created by huli on 2021/3/2.
+//
+
+#ifndef NNXX_TESTS_CATCHER_BASE_H
+#define NNXX_TESTS_CATCHER_BASE_H
+
+#include "../dispatch/catcher_task.h"
+#include "../dispatch/dispatch_device_base.h"
+
+
+//机器人的基类, 普爱项目就是机器手(长度单位mm)
+class Catcher:public Dispatch_device_base
+{
+public:
+	Catcher();
+	Catcher(const Catcher& other)= default;
+	Catcher& operator =(const Catcher& other)= default;
+	~Catcher();
+public://API functions
+	//检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
+	Error_manager check_task_type(std::shared_ptr<Task_Base> p_task);
+public://get or set member variable
+	//获取硬件设备的状态, 必须子类继承
+	Device_status get_actual_device_status();
+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();
+protected://member variable
+
+
+	//调度下发到plc
+	std::string							m_request_key;				//请求唯一码, 用作识别
+	//请求的目标坐标和动作
+	float 								m_request_x;				//机器人坐标x轴,
+	float 								m_request_y;				//机器人坐标y轴,
+	float 								m_request_b;				//机器人坐标b轴, 旋转范围80~280
+	float 								m_request_z;				//机器人坐标z轴,
+	Clamp_motion						m_request_clamp_motion;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	float 								m_request_wheelbase;		//机器人抓车杆前后轮距.
+	float 								m_request_d1;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	float 								m_request_d2;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	int 								m_request_space_id;			//机器人空间位置的id.
+
+
+	//plc反馈给调度
+	std::string							m_respons_key;				//应答的唯一码, 用作识别
+	Respons_status						m_respons_status;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+	//答复的实际坐标和动作
+	float 								m_respons_x;				//机器人坐标x轴,
+	float 								m_respons_y;				//机器人坐标y轴,
+	float 								m_respons_b;				//机器人坐标b轴, 旋转范围80~280
+	float 								m_respons_z;				//机器人坐标z轴,
+	Clamp_motion						m_respons_clamp_motion;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	float 								m_respons_wheelbase;		//机器人抓车杆前后轮距.
+	float 								m_respons_d1;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	float 								m_respons_d2;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	int 								m_respons_space_id;			//机器人空间位置的id.
+
+
+
+	//硬件状态, 目前只做显示判断
+	std::chrono::system_clock::time_point	m_status_updata_time;	//状态更新时间点
+	unsigned char						m_last_heartbeat;			//上一次的心跳
+	//机器人的设备状态数据,
+	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_b;					//机器人坐标b轴, 旋转范围80~280
+	float 								m_actual_z;					//机器人坐标z轴,
+	float 								m_actual_d1;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	float 								m_actual_d2;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	Clamp_motion						m_actual_clamp_motion1;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	Clamp_motion						m_actual_clamp_motion2;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	Clamp_motion						m_actual_clamp_motion3;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	Clamp_motion						m_actual_clamp_motion4;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+
+	//机器人设备的错误码
+	unsigned char						m_actual_error_code[50];	//机器人设备的故障信息位
+	unsigned char						m_actual_warning_code[50];	//机器人设备的警告信息位
+	std::string							m_actual_error_description;//机器人设备的错误描述
+
+
+
+
+private:
+
+};
+
+
+#endif //NNXX_TESTS_CATCHER_BASE_H

+ 53 - 0
dispatch/catcher_task.cpp

@@ -0,0 +1,53 @@
+//
+// Created by huli on 2021/3/2.
+//
+
+#include "catcher_task.h"
+
+
+Catcher_task::Catcher_task()
+{
+	//构造函数锁定任务类型为 LOCATE_MANGER_TASK,后续不允许更改
+	m_task_type = CATCHER_TASK;
+	m_task_statu = TASK_CREATED;
+	m_task_statu_information.clear();
+	m_task_error_manager.error_manager_clear_all();
+
+	m_request_x = 0;				//机器人坐标x轴,
+	m_request_y = 0;				//机器人坐标y轴,
+	m_request_b = 0;				//机器人坐标b轴, 旋转范围80~280
+	m_request_z = 0;				//机器人坐标z轴,
+	m_request_space_id = 0;			//机器人空间位置的id.
+	m_request_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	m_request_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	m_request_wheelbase = 0;		//机器人抓车杆前后轮距.
+	m_request_clamp_motion = E_CLAMP_NO_ACTION;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+	m_respons_status = RESPONS_WORKING;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+	m_respons_x = 0;				//机器人坐标x轴,
+	m_respons_y = 0;				//机器人坐标y轴,
+	m_respons_b = 0;				//机器人坐标b轴, 旋转范围80~280
+	m_respons_z = 0;				//机器人坐标z轴,
+	m_respons_space_id = 0;			//机器人空间位置的id.
+	m_respons_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	m_respons_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	m_respons_wheelbase = 0;		//机器人抓车杆前后轮距.
+	m_respons_clamp_motion = E_CLAMP_NO_ACTION;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+}
+
+Catcher_task::~Catcher_task()
+{
+
+}
+
+
+
+
+
+
+
+
+
+
+

+ 82 - 0
dispatch/catcher_task.h

@@ -0,0 +1,82 @@
+//
+// Created by huli on 2021/3/2.
+//
+
+#ifndef NNXX_TESTS_CATCHER_TASK_H
+#define NNXX_TESTS_CATCHER_TASK_H
+
+#include "../error_code/error_code.h"
+#include "../task/task_command_manager.h"
+#include "../task/task_base.h"
+#include <mutex>
+
+
+class Catcher_task:public Task_Base
+{
+public:
+	//指令完成状态, 搬运器答复指令, 返回任务完成的情况
+	enum Respons_status
+	{
+		RESPONS_WORKING             = 0,    //正常
+		RESPONS_OVER               	= 1,    //任务完成
+		RESPONS_MINOR_ERROR			= 100,	//一般故障, 可恢复
+		RESPONS_CRITICAL_ERROR		= 101,	//致命故障,不可恢复
+	};
+
+	//抓车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0,    //无动作.
+		E_CLAMP_TIGHT               	= 1,    //夹紧夹杆
+		E_CLAMP_LOOSE					= 2,	//松开夹杆
+	};
+
+public:
+	Catcher_task();
+	Catcher_task(const Catcher_task& other)= default;
+	Catcher_task& operator =(const Catcher_task& other)= default;
+	~Catcher_task();
+public://API functions
+
+public://get or set member variable
+
+protected://member functions
+
+protected://member variable
+
+
+public:
+	std::mutex							m_lock;	//锁
+
+	//调度下发到plc
+	std::string							m_request_key;				//请求唯一码, 用作识别
+	//请求的目标坐标和动作
+	float 								m_request_x;				//机器人坐标x轴,
+	float 								m_request_y;				//机器人坐标y轴,
+	float 								m_request_b;				//机器人坐标b轴, 旋转范围80~280
+	float 								m_request_z;				//机器人坐标z轴,
+	int 								m_request_space_id;			//机器人空间位置的id.
+	float 								m_request_d1;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	float 								m_request_d2;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	float 								m_request_wheelbase;		//机器人抓车杆前后轮距.
+	Clamp_motion						m_request_clamp_motion;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+
+	//plc反馈给调度
+	std::string							m_respons_key;				//应答的唯一码, 用作识别
+	Respons_status						m_respons_status;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+	//答复的实际坐标和动作
+	float 								m_respons_x;				//机器人坐标x轴,
+	float 								m_respons_y;				//机器人坐标y轴,
+	float 								m_respons_b;				//机器人坐标b轴, 旋转范围80~280
+	float 								m_respons_z;				//机器人坐标z轴,
+	int 								m_respons_space_id;			//机器人空间位置的id.
+	float 								m_respons_d1;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	float 								m_respons_d2;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	float 								m_respons_wheelbase;		//机器人抓车杆前后轮距.
+	Clamp_motion						m_respons_clamp_motion;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+};
+
+
+#endif //NNXX_TESTS_Catcher_task_H

+ 124 - 117
dispatch/dispatch_communication.cpp

@@ -26,125 +26,143 @@ Error_manager Dispatch_communication::communication_init()
 	//往map通信缓存里面添加所需要的buf
 	std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
 	std::unique_lock<std::mutex> t_lock2(m_send_buf_lock);
+	Snap7_buf t_snap7_buf;
 
 	t_index = 0;
 	t_variable_information_vector.clear();
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved0", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_command_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_task_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved3_11", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 9 });
-	t_index += sizeof(unsigned char)*9;
-
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_block_id", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
-	t_index += sizeof(unsigned short)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_floor_id", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
-	t_index += sizeof(unsigned short)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_parkspace_id", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
-	t_index += sizeof(unsigned short)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_command_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 256 });
-	t_index += sizeof(unsigned char)*256;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_is_entrance_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved275_289", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 15 });
-	t_index += sizeof(unsigned char)*15;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved257_275", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 19 });
+	t_index += sizeof(unsigned char)*19;
 
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
-	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_x", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_y", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_b", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_z", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_motion", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved293", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved294", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved295", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_wheelbase", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_d1", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_d2", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_voucher_number", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 256 });
-	t_index += sizeof(unsigned char)*256;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plate_number", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 512 });
-	t_index += sizeof(unsigned char)*512;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_phone_number", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 256 });
-	t_index += sizeof(unsigned char)*256;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved1346_1377", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 32 });
-	t_index += sizeof(unsigned char)*32;
-	Snap7_buf t_response(RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER, 0, sizeof(Response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
-	m_receive_buf_map[0] = t_response;
 
-	Snap7_buf t_request(REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER, 0, sizeof(Request_from_dispatch_to_plc), t_variable_information_vector,Snap7_buf::NO_COMMUNICATION);
-	m_send_buf_map[0] = t_request;
+	t_snap7_buf.init(CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1, 50, sizeof(Catcher_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[0] = t_snap7_buf;
+	t_snap7_buf.init(CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2, 50, sizeof(Catcher_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_send_buf_map[1] = t_snap7_buf;
+
 
 
 	t_index = 0;
 	t_variable_information_vector.clear();
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_check_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved2_9", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 8 });
-	t_index += sizeof(unsigned char)*8;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
 
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_year", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
-	t_index += sizeof(unsigned short)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_month", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
-	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_day", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_snap7_buf.init(CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1, 0, sizeof(Catcher_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[2] = t_snap7_buf;
+	t_snap7_buf.init(CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2, 0, sizeof(Catcher_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_send_buf_map[3] = t_snap7_buf;
+
+
+
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_weekday", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved257_275", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 19 });
+	t_index += sizeof(unsigned char)*19;
+
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_x", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_y", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_b", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_z", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_clamp_motion", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_hour", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved293", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_minute", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved294", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_second", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved295", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_nanosecond", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
-	t_index += sizeof(unsigned int)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved22_29", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 8 });
-	t_index += sizeof(unsigned char)*8;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_wheelbase", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_d1", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_d2", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
 
-	Snap7_buf t_dispatch_status(STATUS_FROM_DISPATCH_TO_PLC_DBNUMBER, 0, sizeof(Status_from_dispatch_to_plc), t_variable_information_vector,Snap7_buf::NO_COMMUNICATION);
-	m_send_buf_map[1] = t_dispatch_status;
+	t_snap7_buf.init(CATCHER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_1, 0, sizeof(Catcher_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[0] = t_snap7_buf;
+	t_snap7_buf.init(CATCHER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2, 0, sizeof(Catcher_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_receive_buf_map[1] = t_snap7_buf;
 
 
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_elevator_information", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_safe_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved31", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_work_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_elevator_coordinates", typeid(double).name(), t_index,sizeof(double), 1 });
-	t_index += sizeof(double)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved40_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 34 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_load_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved4_37", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 34 });
 	t_index += sizeof(unsigned char)*34;
 
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_carrier_information", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_x", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_y", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_b", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_z", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_d1", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_d2", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_clamp_motion1", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_clamp_motion2", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_clamp_motion3", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_carrier_coordinates", typeid(double).name(), t_index,sizeof(double), 1 });
-	t_index += sizeof(double)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_carrier_angle", typeid(double).name(), t_index,sizeof(double), 1 });
-	t_index += sizeof(double)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved92_125", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 34 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_clamp_motion4", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved66_99", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 34 });
 	t_index += sizeof(unsigned char)*34;
 
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_carrier_error_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_error_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
 	t_index += sizeof(unsigned char)*50;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_carrier_error_string", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 512 });
-	t_index += sizeof(unsigned char)*512;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_elevator_error_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_warning_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
 	t_index += sizeof(unsigned char)*50;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_elevator_error_string", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 512 });
-	t_index += sizeof(unsigned char)*512;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_error_description", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 256 });
+	t_index += sizeof(unsigned char)*256;
+
+	t_snap7_buf.init(CATCHER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_1, 0, sizeof(Catcher_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[2] = t_snap7_buf;
+	t_snap7_buf.init(CATCHER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_2, 0, sizeof(Catcher_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_receive_buf_map[3] = t_snap7_buf;
 
-	Snap7_buf t_plc_status(STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER, 0, sizeof(Status_from_plc_to_dispatch), t_variable_information_vector,Snap7_buf::LOOP_COMMUNICATION);
-	m_receive_buf_map[1] = t_plc_status;
 
 	return Snap7_communication_base::communication_init();
 }
@@ -155,41 +173,21 @@ Error_manager Dispatch_communication::communication_uninit()
 	return Snap7_communication_base::communication_uninit();
 }
 
-std::mutex * Dispatch_communication::get_data_lock()
-{
-	return &m_data_lock;
-}
-Dispatch_communication::Request_from_dispatch_to_plc * Dispatch_communication::get_request_from_dispatch_to_plc()
-{
-	return &m_request_from_dispatch_to_plc;
-}
-Dispatch_communication::Response_from_plc_to_dispatch * Dispatch_communication::get_response_from_plc_to_dispatch()
-{
-	return &m_response_from_plc_to_dispatch;
-}
-Dispatch_communication::Status_from_dispatch_to_plc * Dispatch_communication::get_status_from_dispatch_to_plc()
-{
-	return &m_status_from_dispatch_to_plc;
-}
-Dispatch_communication::Status_from_plc_to_dispatch * Dispatch_communication::get_status_from_plc_to_dispatch()
-{
-	return &m_status_from_plc_to_dispatch;
-}
-
 
 //更新数据
 Error_manager Dispatch_communication::updata_receive_buf()
 {
+//	return Error_code::SUCCESS;
 	std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
 	std::unique_lock<std::mutex> t_lock2(m_data_lock);
 
-	memcpy(&m_response_from_plc_to_dispatch, m_receive_buf_map[0].mp_buf_obverse, m_receive_buf_map[0].m_size);
-	memcpy(&m_status_from_plc_to_dispatch, m_receive_buf_map[1].mp_buf_obverse, m_receive_buf_map[1].m_size);
+	memcpy(&m_catcher_response_from_plc_to_dispatch[0], m_receive_buf_map[0].mp_buf_obverse, m_receive_buf_map[0].m_size);
+	memcpy(&m_catcher_response_from_plc_to_dispatch[1], m_receive_buf_map[1].mp_buf_obverse, m_receive_buf_map[1].m_size);
+	memcpy(&m_catcher_status_from_plc_to_dispatch[0], m_receive_buf_map[2].mp_buf_obverse, m_receive_buf_map[2].m_size);
+	memcpy(&m_catcher_status_from_plc_to_dispatch[1], m_receive_buf_map[3].mp_buf_obverse, m_receive_buf_map[3].m_size);
 
-//	std::cout << " huli test :::: " << " m_status_from_plc_to_dispatch.m_heartbeat = " << (int)m_status_from_plc_to_dispatch.m_heartbeat << std::endl;
-//	std::cout << " huli test :::: " << " m_response_from_plc_to_dispatch.m_command_key = " << m_response_from_plc_to_dispatch.m_command_key << std::endl;
-//	std::cout << " huli test :::: " << " m_status_from_plc_to_dispatch.m_elevator_coordinates = " << m_status_from_plc_to_dispatch.m_elevator_coordinates << std::endl;
-//	std::cout << " huli test :::: " << " m_status_from_plc_to_dispatch.m_carrier_coordinates = " << m_status_from_plc_to_dispatch.m_carrier_coordinates << std::endl;
+//	int heat = m_catcher_status_from_plc_to_dispatch[1].m_heartbeat;
+//	std::cout << " huli test :::: " << " 999999999 = " << heat << std::endl;
 
 	return Error_code::SUCCESS;
 }
@@ -198,15 +196,24 @@ Error_manager Dispatch_communication::updata_send_buf()
 	std::unique_lock<std::mutex> t_lock1(m_send_buf_lock);
 	std::unique_lock<std::mutex> t_lock2(m_data_lock);
 
-//	memcpy(m_request_from_dispatch_to_plc.m_command_key, "from_dispatch_to_plc_123", 20);
-//	m_status_from_dispatch_to_plc.m_year = (unsigned short)20;
-//	m_status_from_dispatch_to_plc.m_day = 20;
-//	m_status_from_dispatch_to_plc.m_heartbeat = 20;
+	m_catcher_request_from_dispatch_to_plc_for_data[1].m_reserved = 1;
+
+	memcpy(m_send_buf_map[0].mp_buf_obverse, &m_catcher_request_from_dispatch_to_plc_for_data[0], m_send_buf_map[0].m_size);
+	memcpy(m_send_buf_map[1].mp_buf_obverse, &m_catcher_request_from_dispatch_to_plc_for_data[1], m_send_buf_map[1].m_size);
+	memcpy(m_send_buf_map[2].mp_buf_obverse, &m_catcher_request_from_dispatch_to_plc_for_key[0], m_send_buf_map[2].m_size);
+	memcpy(m_send_buf_map[3].mp_buf_obverse, &m_catcher_request_from_dispatch_to_plc_for_key[1], m_send_buf_map[3].m_size);
+
+
+//	Dispatch_communication::Catcher_request_from_dispatch_to_plc_for_key * tp_catcher_request_from_dispatch_to_plc_for_key =
+//	& Dispatch_communication::get_instance_references().m_catcher_request_from_dispatch_to_plc_for_key[1];
+//	int k1 = tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key[0];
+//	std::cout << " huli test :::: " << " k1 = " << k1 << std::endl;
+//	int k2 = tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key[1];
+//	std::cout << " huli test :::: " << " k2 = " << k2 << std::endl;
+//	std::cout << " huli test :::: " << " ***************************** = " << std::endl;
+
+
 
-	memcpy(m_send_buf_map[0].mp_buf_obverse, &m_request_from_dispatch_to_plc, m_send_buf_map[0].m_size);
-	m_send_buf_map[0].set_communication_mode(Snap7_buf::ONCE_COMMUNICATION);
-	memcpy(m_send_buf_map[1].mp_buf_obverse, &m_status_from_dispatch_to_plc, m_send_buf_map[1].m_size);
-	m_send_buf_map[1].set_communication_mode(Snap7_buf::ONCE_COMMUNICATION);
 
 	return Error_code::SUCCESS;
 }

+ 187 - 121
dispatch/dispatch_communication.h

@@ -11,136 +11,196 @@
 class Dispatch_communication:public Singleton<Dispatch_communication>, public Snap7_communication_base
 {
 public:
+	//发送db快的标记位, 保证先发数据再发唯一码
+	enum Send_database_flag
+	{
+		E_SEND_UNKNOW					= 0,
+		E_SEND_DATA_START              	= 1,    //开始发送数据
+		E_SEND_DATA_END              	= 2,    //结束发送数据
+		E_SEND_KEY_START				= 3,	//开始发送唯一码
+		E_SEND_KEY_END					= 4,	//结束发送唯一码
+	};
+
+
 #pragma pack(push, 1)	//struct按照1个byte对齐
-	//调度模块给plc发送请求消息的DB编号
-	#define REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER		100
-	//调度模块给plc发送请求消息的指令结构体
-	struct Request_from_dispatch_to_plc
+
+	//抓车模块给plc发送请求消息的DB编号
+#define CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1		110
+#define CATCHER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2		120
+	//抓车模块给plc发送请求消息的指令结构体
+	struct Catcher_request_from_dispatch_to_plc_for_data
 	{
-	    unsigned char 			m_reserved0 = 0;				//预留
-	    unsigned char			m_command_flag = 0;				//指令标志位, 0bit==1:流程开始, 1bit==1:校验无误
-		unsigned char			m_task_status = 0;				//流程状态, 0=正常,1=可恢复型故障,2=不可恢复故障
-		unsigned char			m_reserved3_11[9] = {0};		//预留
-
-	    //指令信息
-		unsigned short 			m_block_id = 0;					//单位编号(区域编号), 1~3
-		unsigned short 			m_floor_id = 0;					//楼层编号, 1~14
-		unsigned short 			m_parkspace_id = 0;				//同层的车位索引, 一楼为1~4, 楼上为1~6
-		unsigned char			m_command_key[256] = {0};		//指令key(任务唯一码), 作为通信标志位
-		unsigned char			m_is_entrance_flag = 0;			//是否为入口, 1=入口,0=非入口, (如果是入口, 中跑车需要按照汽车的旋转角进行偏移)
-		unsigned char			m_reserved275_289[15] = {0};	//预留
-
-		//汽车定位信息
-		float  					m_center_x = 0;					//整车的中心点x值, 四轮的中心
-		float  					m_center_y = 0;					//整车的中心点y值, 四轮的中心
-		float  					m_car_angle = 0;				//整车的车身旋转角,
-		float  					m_car_length = 0;				//整车的长度, 用于规避碰撞
-		float  					m_car_width = 0;				//整车的宽度, 用于规避碰撞
-		float  					m_car_height = 0;				//整车的高度, 用于规避碰撞
-		float  					m_wheel_base = 0;				//整车的轮距, 前后轮的距离, 用于机器人或agv的抓车
-		float  					m_wheel_width = 0;				//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车
-		unsigned char			m_voucher_number[256] = {0};	//停取凭证号
-		unsigned char			m_plate_number[512] = {0};		//车牌号
-		unsigned char			m_phone_number[256] = {0};		//电话号码
-		unsigned char			m_reserved1346_1377[32] = {0};	//预留
+		//指令信息
+		unsigned char			m_reserved = 0;					//预留
+		unsigned char			m_reserved257_275[19] = {0};	//预留
+		// 请求的目标坐标和动作
+		float 					m_request_x = 0;				//机器人坐标x轴,
+		float 					m_request_y = 0;				//机器人坐标y轴,
+		float 					m_request_b = 0;				//机器人坐标b轴, 旋转范围80~280
+		float 					m_request_z = 0;				//机器人坐标z轴,
+		unsigned char			m_request_clamp_motion = 0;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved293 = 0;				//预留
+		unsigned char			m_reserved294 = 0;				//预留
+		unsigned char			m_reserved295 = 0;				//预留
+		float 					m_request_wheelbase = 0;		//机器人抓车杆前后轮距.
+		float 					m_request_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_request_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
 	};
 
-	//plc给调度模块发送答复消息的DB编号
-	#define RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER		101
-	//plc给调度模块发送答复消息的指令结构体
-	struct Response_from_plc_to_dispatch
+	//抓车模块给plc发送请求消息的指令结构体
+	struct Catcher_request_from_dispatch_to_plc_for_key
 	{
-		unsigned char			m_reserved0 = 0;				//预留
-		unsigned char			m_command_flag = 0;				//指令标志位, 0bit==1:流程结束
-		unsigned char			m_task_status = 0;				//流程状态, 0=正常,1=可恢复型故障,2=不可恢复故障
-		unsigned char			m_reserved3_11[9] = {0};		//预留
+		//指令信息
+		unsigned char			m_request_key[50] = {0};		//指令key(任务唯一码), 作为通信标志位
+	};
 
+	//plc给抓车模块发送答复消息的DB编号
+#define CATCHER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_1		111
+#define CATCHER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2		121
+	//plc给抓车模块发送答复消息的指令结构体
+	struct Catcher_response_from_plc_to_dispatch
+	{
 		//指令信息
-		unsigned short 			m_block_id = 0;					//单位编号(区域编号), 1~3
-		unsigned short 			m_floor_id = 0;					//楼层编号, 1~14
-		unsigned short 			m_parkspace_id = 0;				//同层的车位索引, 一楼为1~4, 楼上为1~6
-		unsigned char			m_command_key[256] = {0};		//指令key(任务唯一码), 作为通信标志位
-		unsigned char			m_is_entrance_flag = 0;			//是否为入口, 1=入口,0=非入口, (如果是入口, 中跑车需要按照汽车的旋转角进行偏移)
-		unsigned char			m_reserved275_289[15] = {0};	//预留
-
-		//汽车定位信息
-		float  					m_center_x = 0;					//整车的中心点x值, 四轮的中心
-		float  					m_center_y = 0;					//整车的中心点y值, 四轮的中心
-		float  					m_car_angle = 0;				//整车的车身旋转角,
-		float  					m_car_length = 0;				//整车的长度, 用于规避碰撞
-		float  					m_car_width = 0;				//整车的宽度, 用于规避碰撞
-		float  					m_car_height = 0;				//整车的高度, 用于规避碰撞
-		float  					m_wheel_base = 0;				//整车的轮距, 前后轮的距离, 用于机器人或agv的抓车
-		float  					m_wheel_width = 0;				//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车
-		unsigned char			m_voucher_number[256] = {0};	//停取凭证号
-		unsigned char			m_plate_number[512] = {0};		//车牌号
-		unsigned char			m_phone_number[256] = {0};		//电话号码
-		unsigned char			m_reserved1346_1377[32] = {0};	//预留
+		unsigned char			m_respons_key[50] = {0};		//指令key(任务唯一码), 作为通信标志位
+		unsigned char			m_respons_status = 0;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+		unsigned char			m_reserved257_275[19] = {0};	//预留
+		//请求的目标坐标和动作
+		float 					m_respons_x = 0;				//机器人坐标x轴,
+		float 					m_respons_y = 0;				//机器人坐标y轴,
+		float 					m_respons_b = 0;				//机器人坐标b轴, 旋转范围80~280
+		float 					m_respons_z = 0;				//机器人坐标z轴,
+		unsigned char			m_respons_clamp_motion = 0;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved293 = 0;				//预留
+		unsigned char			m_reserved294 = 0;				//预留
+		unsigned char			m_reserved295 = 0;				//预留
+		float 					m_respons_wheelbase = 0;		//机器人抓车杆前后轮距.
+		float 					m_respons_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_respons_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
 	};
 
-	//调度模块给plc发送状态消息的DB编号
-	#define STATUS_FROM_DISPATCH_TO_PLC_DBNUMBER		110
-	//调度模块给plc发送状态消息的指令结构体
-	struct Status_from_dispatch_to_plc
+	//plc给抓车模块发送状态消息的DB编号
+#define CATCHER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_1		113
+#define CATCHER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_2		123
+	//plc给抓车模块发送状态消息的指令结构体
+	struct Catcher_status_from_plc_to_dispatch
 	{
 		unsigned char			m_heartbeat = 0;				//心跳位, 0-255循环
-		unsigned char			m_check_flag = 0;				//校验标志位
-		unsigned char			m_reserved2_9[8] = {0};			//预留
-
-		//时钟
-		unsigned short			m_year = 0;						//年
-		unsigned char			m_month = 0;					//月
-		unsigned char			m_day = 0;						//日
-		unsigned char			m_weekday = 0;					//周
-		unsigned char			m_hour = 0;						//时
-		unsigned char			m_minute = 0;					//分
-		unsigned char			m_second = 0;					//秒
-		unsigned int			m_nanosecond = 0;				//纳秒
-		unsigned char			m_reserved22_29[8] = {0};		//预留
 
+		unsigned char			m_safe_status = 0;				//设备的安全状态
+		unsigned char			m_work_status = 0;				//机器人的硬件设备状态
+		unsigned char			m_actual_load_status = 0;				//机器人的负载状态, 小跑车上面是否有车.
+		unsigned char			m_reserved4_37[34] = {0};		//预留
+
+		float 					m_actual_x = 0;					//机器人坐标x轴,
+		float 					m_actual_y = 0;					//机器人坐标y轴,
+		float 					m_actual_b = 0;					//机器人坐标b轴, 旋转范围80~280
+		float 					m_actual_z = 0;					//机器人坐标z轴,
+		float 					m_actual_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_actual_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+		unsigned char			m_actual_clamp_motion1 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion2 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion3 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion4 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved66_99[34] = {0};		//预留
+
+		//故障信息
+		unsigned char			m_actual_error_code[50] = {0};		//搬运器错误码
+		unsigned char			m_actual_warning_code[50] = {0};	//升降机错误码
+		unsigned char			m_actual_error_description[256] = {0};	//升降机错误描述
+	};
+
+
+
+
+
+	//搬运器给plc发送请求消息的DB编号
+#define CARRIER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1		200
+#define CARRIER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2		270
+#define CARRIER_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_3		230
+	//搬运器给plc发送请求消息的指令结构体
+	struct Carrier_request_from_dispatch_to_plc_for_data
+	{
+		//指令信息
+		unsigned char			m_reserved = 0;					//预留
+		unsigned char			m_reserved257_275[19] = {0};	//预留
+		// 请求的目标坐标和动作
+		float 					m_request_x = 0;				//机器人坐标x轴,
+		float 					m_request_y = 0;				//机器人坐标y轴,
+		float 					m_request_b = 0;				//机器人坐标b轴, 旋转范围80~280
+		float 					m_request_z = 0;				//机器人坐标z轴,
+		unsigned char			m_request_clamp_motion = 0;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved293 = 0;				//预留
+		unsigned char			m_reserved294 = 0;				//预留
+		unsigned char			m_reserved295 = 0;				//预留
+		float 					m_request_wheelbase = 0;		//机器人抓车杆前后轮距.
+		float 					m_request_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_request_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
 	};
 
-	//plc给调度模块发送状态消息的DB编号
-	#define STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER		111
-	//plc给调度模块发送状态消息的指令结构体
-	struct Status_from_plc_to_dispatch
+	//搬运器给plc发送请求消息的指令结构体
+	struct Carrier_request_from_dispatch_to_plc_for_key
+	{
+		//指令信息
+		unsigned char			m_request_key[50] = {0};		//指令key(任务唯一码), 作为通信标志位
+	};
+
+	//plc给搬运器发送答复消息的DB编号
+#define CARRIER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_1		201
+#define CARRIER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2		271
+#define CARRIER_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2		231
+	//plc给搬运器发送答复消息的指令结构体
+	struct Carrier_response_from_plc_to_dispatch
+	{
+		//指令信息
+		unsigned char			m_respons_key[50] = {0};		//指令key(任务唯一码), 作为通信标志位
+		unsigned char			m_respons_status = 0;			//指令完成状态, 机器人答复指令, 返回任务完成的情况
+		unsigned char			m_reserved257_275[19] = {0};	//预留
+		//请求的目标坐标和动作
+		float 					m_respons_x = 0;				//机器人坐标x轴,
+		float 					m_respons_y = 0;				//机器人坐标y轴,
+		float 					m_respons_b = 0;				//机器人坐标b轴, 旋转范围80~280
+		float 					m_respons_z = 0;				//机器人坐标z轴,
+		unsigned char			m_respons_clamp_motion = 0;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved293 = 0;				//预留
+		unsigned char			m_reserved294 = 0;				//预留
+		unsigned char			m_reserved295 = 0;				//预留
+		float 					m_respons_wheelbase = 0;		//机器人抓车杆前后轮距.
+		float 					m_respons_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_respons_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	};
+
+	//plc给搬运器发送状态消息的DB编号
+#define CARRIER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_1		113
+#define CARRIER_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_2		123
+	//plc给搬运器发送状态消息的指令结构体
+	struct Carrier_status_from_plc_to_dispatch
 	{
 		unsigned char			m_heartbeat = 0;				//心跳位, 0-255循环
-		unsigned char			m_check_flag = 0;				//校验标志位
-		unsigned char			m_reserved2_9[8] = {0};			//预留
-
-		//时钟
-		unsigned short			m_year = 0;						//年
-		unsigned char			m_month = 0;					//月
-		unsigned char			m_day = 0;						//日
-		unsigned char			m_weekday = 0;					//周
-		unsigned char			m_hour = 0;						//时
-		unsigned char			m_minute = 0;					//分
-		unsigned char			m_second = 0;					//秒
-		unsigned int			m_nanosecond = 0;				//纳秒
-		unsigned char			m_reserved22_29[8] = {0};		//预留
-
-		//升降机状态, (楚天项目代指电梯)
-		//升降机信息, 0bit==1:急停正常, 1bit==1:处于安全位置, 2bit==1:静止状态, 3bit==1:可执行新指令, 4bit==1:存在故障,
-		unsigned char			m_elevator_information = 0;		//升降机信息,
-		unsigned char			m_reserved31 = 0;				//预留
-		double 					m_elevator_coordinates = 0;		//升降机坐标
-		unsigned char			m_reserved40_73[34] = {0};		//预留
-
-		//搬运器状态, (楚天项目代指中跑车)
-		//搬运器信息, 0bit==1:急停正常, 1bit==1:处于安全位置, 2bit==1:静止状态, 3bit==1:可执行新指令, 4bit==1:存在故障,
-		unsigned char			m_carrier_information = 0;		//搬运器信息,
-		unsigned char			m_reserved75 = 0;				//预留
-		double 					m_carrier_coordinates = 0;		//搬运器坐标
-		double 					m_carrier_angle = 0;			//搬运器角度
-		unsigned char			m_reserved92_125[34] = {0};		//预留
+
+		unsigned char			m_safe_status = 0;				//设备的安全状态
+		unsigned char			m_work_status = 0;				//机器人的硬件设备状态
+		unsigned char			m_actual_load_status = 0;				//机器人的负载状态, 小跑车上面是否有车.
+		unsigned char			m_reserved4_37[34] = {0};		//预留
+
+		float 					m_actual_x = 0;					//机器人坐标x轴,
+		float 					m_actual_y = 0;					//机器人坐标y轴,
+		float 					m_actual_b = 0;					//机器人坐标b轴, 旋转范围80~280
+		float 					m_actual_z = 0;					//机器人坐标z轴,
+		float 					m_actual_d1 = 0;				//机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+		float 					m_actual_d2 = 0;				//机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+		unsigned char			m_actual_clamp_motion1 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion2 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion3 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_actual_clamp_motion4 = 0;		//小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+		unsigned char			m_reserved66_99[34] = {0};		//预留
 
 		//故障信息
-		unsigned char			m_carrier_error_code[50] = {0};		//搬运器错误码
-		unsigned char			m_carrier_error_string[512] = {0};	//搬运器错误描述
-		unsigned char			m_elevator_error_code[50] = {0};	//升降机错误码
-		unsigned char			m_elevator_error_string[512] = {0};	//升降机错误描述
+		unsigned char			m_actual_error_code[50] = {0};		//搬运器错误码
+		unsigned char			m_actual_warning_code[50] = {0};	//升降机错误码
+		unsigned char			m_actual_error_description[256] = {0};	//升降机错误描述
 	};
+
+
 #pragma pack(pop)		//取消对齐
 
 // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
@@ -159,23 +219,29 @@ public://API functions
 	//反初始化 通信 模块。
 	virtual Error_manager communication_uninit();
 public://get or set member variable
-	std::mutex * get_data_lock();
-	Request_from_dispatch_to_plc * get_request_from_dispatch_to_plc();
-	Response_from_plc_to_dispatch * get_response_from_plc_to_dispatch();
-	Status_from_dispatch_to_plc * get_status_from_dispatch_to_plc();
-	Status_from_plc_to_dispatch * get_status_from_plc_to_dispatch();
+//	std::mutex * get_data_lock();
+//	Request_from_dispatch_to_plc * get_request_from_dispatch_to_plc();
+//	Response_from_plc_to_dispatch * get_response_from_plc_to_dispatch();
+//	Status_from_dispatch_to_plc * get_status_from_dispatch_to_plc();
+//	Status_from_plc_to_dispatch * get_status_from_plc_to_dispatch();
 protected://member functions
 	//更新数据
 	virtual Error_manager updata_receive_buf();
 	virtual Error_manager updata_send_buf();
 
 protected://member variable
-
+public:
 	std::mutex									m_data_lock;						//数据锁
-	Request_from_dispatch_to_plc				m_request_from_dispatch_to_plc;		//调度模块给plc发送请求消息的指令结构体
-	Response_from_plc_to_dispatch				m_response_from_plc_to_dispatch;	//plc给调度模块发送答复消息的指令结构体
-	Status_from_dispatch_to_plc					m_status_from_dispatch_to_plc;		//调度模块给plc发送状态消息的指令结构体
-	Status_from_plc_to_dispatch					m_status_from_plc_to_dispatch;		//plc给调度模块发送状态消息的指令结构体
+
+	Catcher_request_from_dispatch_to_plc_for_data		m_catcher_request_from_dispatch_to_plc_for_data[2];	//抓车模块给plc发送请求消息的指令结构体
+	Catcher_request_from_dispatch_to_plc_for_key		m_catcher_request_from_dispatch_to_plc_for_key[2];	//抓车模块给plc发送请求消息的指令结构体
+	Catcher_response_from_plc_to_dispatch				m_catcher_response_from_plc_to_dispatch[2];	//plc给抓车模块发送答复消息的指令结构体
+	Catcher_status_from_plc_to_dispatch					m_catcher_status_from_plc_to_dispatch[2];	//plc给抓车模块发送状态消息的指令结构体
+
+	Carrier_request_from_dispatch_to_plc_for_data		m_carrier_request_from_dispatch_to_plc_for_data[2];	//搬运器给plc发送请求消息的指令结构体
+	Carrier_request_from_dispatch_to_plc_for_key		m_carrier_request_from_dispatch_to_plc_for_key[2];	//搬运器给plc发送请求消息的指令结构体
+	Carrier_response_from_plc_to_dispatch				m_carrier_response_from_plc_to_dispatch[2];	//plc给搬运器发送答复消息的指令结构体
+	Carrier_status_from_plc_to_dispatch					m_carrier_status_from_plc_to_dispatch[2];	//plc给搬运器发送状态消息的指令结构体
 
 private:
 

+ 713 - 0
dispatch/dispatch_device_base.cpp

@@ -0,0 +1,713 @@
+//
+// Created by huli on 2021/3/3.
+//
+
+#include "dispatch_device_base.h"
+
+Dispatch_device_base::Dispatch_device_base()
+{
+	m_dispatch_device_status = E_UNKNOW;
+	m_device_id = -1;
+
+	mp_execute_thread = NULL;
+}
+
+Dispatch_device_base::~Dispatch_device_base()
+{
+	dispatch_device_base_uninit();
+}
+
+//设备 初始化
+Error_manager Dispatch_device_base::dispatch_device_base_init(int device_id)
+{
+	m_device_id = device_id;
+	//	线程默认开启
+	m_execute_condition.reset(false, true, false);
+	mp_execute_thread = new std::thread(&Dispatch_device_base::execute_thread_fun, this);
+
+	m_dispatch_device_status = E_READY;
+	return Error_code::SUCCESS;
+}
+//设备 反初始化
+Error_manager Dispatch_device_base::dispatch_device_base_uninit()
+{
+	if (mp_execute_thread)
+	{
+		m_execute_condition.kill_all();
+	}
+	if (mp_execute_thread)
+	{
+		mp_execute_thread->join();
+		delete mp_execute_thread;
+		mp_execute_thread = NULL;
+	}
+
+	m_dispatch_device_status = E_UNKNOW;
+
+	return Error_code::SUCCESS;
+}
+
+//执行任务
+Error_manager Dispatch_device_base::execute_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level)
+{
+	LOG(INFO) << " ---Dispatch_device_base::execute_task ---"<< this;
+
+	Error_manager t_error;
+	Error_manager t_result;
+
+	//检查指针
+	if (p_task.get() == NULL) {
+		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
+							 "Dispatch_device_base::execute_task failed, POINTER_IS_NULL");
+	}
+	//检查任务类型,
+	t_error = check_task_type(p_task);
+	if ( t_error != Error_code::SUCCESS )
+	{
+		return t_error;
+	}
+
+	//检查接收方能否接受任务
+	t_error = check_task_level(dispatch_task_level);
+	if ( t_error != SUCCESS )
+	{
+		t_result.compare_and_cover_error(t_error);
+	}
+	else
+	{
+		//接受任务,并将任务的状态改为TASK_SIGNED已签收
+		t_error = sign_for_task(p_task, dispatch_task_level);
+		if ( t_error != Error_code::SUCCESS )
+		{
+			return t_error;
+		}
+		//这里不用检查任务内容, 直接下发给底层设备
+		//永远启动到三级任务工作状态.
+		// 启动定位管理模块,的核心工作线程
+		m_dispatch_device_status = E_THREE_LEVEL_WORK;
+		m_execute_condition.notify_all(true);
+		//通知 thread_work 子线程启动。
+
+		//只签收,并不一定进入工作状态, 在线程真正的执行的时候,才改为工作中, (执行线程可能会先处理更高优先级的任务单)
+	}
+
+	if ( t_result != Error_code::SUCCESS )
+	{
+		return t_result;
+	}
+
+	return Error_code::SUCCESS;
+}
+
+//检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
+Error_manager Dispatch_device_base::check_task_type(std::shared_ptr<Task_Base> p_task)
+{
+	//检查任务类型,
+//	if (p_task->get_task_type() != CARRIER_TASK)
+//	{
+//		return Error_manager(Error_code::CARRIER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+//							 "Dispatch_device_base::execute_one_level_task  get_task_type() != CARRIER_TASK ");
+//	}
+
+	return Error_code::SUCCESS;
+}
+
+//判断能否执行任务
+Error_manager Dispatch_device_base::check_task_level(Dispatch_task_level dispatch_task_level)
+{
+	std::cout << " huli test :::: " << " m_dispatch_device_status = " << m_dispatch_device_status << std::endl;
+	//加锁
+	std::unique_lock<std::mutex> t_lock(m_lock);
+	//只有当状态 不是正在执行当前等级的任务,并且当前等级的任务为空. 此时返回成功, 才能接受新的任务
+	if ( m_dispatch_device_status >= E_READY && m_dispatch_device_status <= E_THREE_LEVEL_WORK )
+	{
+		switch ( dispatch_task_level )
+		{
+			case E_ONE_LEVEL:
+			{
+				if ( ( m_dispatch_device_status == E_READY ) && mp_device_one_level_task.get() == NULL)
+				{
+				    return Error_code::SUCCESS;
+				}
+				break;
+			}
+			case E_TWO_LEVEL:
+			{
+				if ( ( m_dispatch_device_status == E_READY ||
+					 m_dispatch_device_status == E_ONE_LEVEL_WORK ||
+					 m_dispatch_device_status == E_ONE_LEVEL_OVER ) && mp_device_two_level_task.get() == NULL)
+				{
+					return Error_code::SUCCESS;
+				}
+				break;
+			}
+			case E_THREE_LEVEL:
+			{
+				if ( ( m_dispatch_device_status == E_READY ||
+					 m_dispatch_device_status == E_ONE_LEVEL_OVER ) && mp_device_three_level_task.get() == NULL)
+				{
+					return Error_code::SUCCESS;
+				}
+				break;
+			}
+			default:
+			{
+				return Error_manager(Error_code::PARAMETER_ERROR, Error_level::MINOR_ERROR,
+									 "  Dispatch_device_base::check_task PARAMETER_ERROR ");
+				break;
+			}
+		}
+		return Error_manager(Error_code::DISPATCH_DEVICE_STATUS_BUSY, Error_level::NEGLIGIBLE_ERROR,
+							 " Dispatch_device_base::check_task is busy ");
+	}
+	else
+	{
+	    return Error_manager(Error_code::DISPATCH_DEVICE_STATUS_ERROR, Error_level::MINOR_ERROR,
+	    					" Dispatch_device_base::check_task error ");
+	}
+	return Error_code::SUCCESS;
+}
+
+//签收任务
+Error_manager Dispatch_device_base::sign_for_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level)
+{
+	//加锁
+	std::unique_lock<std::mutex> t_lock(m_lock);
+	switch ( dispatch_task_level )
+	{
+		case E_ONE_LEVEL:
+		{
+			mp_device_one_level_task = p_task;
+			mp_device_one_level_task->set_task_statu(TASK_SIGNED);
+			break;
+		}
+		case E_TWO_LEVEL:
+		{
+			mp_device_two_level_task = p_task;
+			mp_device_two_level_task->set_task_statu(TASK_SIGNED);
+			break;
+		}
+		case E_THREE_LEVEL:
+		{
+			mp_device_three_level_task = p_task;
+			mp_device_three_level_task->set_task_statu(TASK_SIGNED);
+			break;
+		}
+		default:
+		{
+			return Error_manager(Error_code::PARAMETER_ERROR, Error_level::MINOR_ERROR,
+								 "  Dispatch_device_base::check_task PARAMETER_ERROR ");
+			break;
+		}
+	}
+	return Error_code::SUCCESS;
+}
+
+//检查状态,是否正常运行. (工作状态 和 是否能接受对应的任务无关)
+Error_manager Dispatch_device_base::check_status()
+{
+	if ( m_dispatch_device_status == E_READY )
+	{
+		return Error_code::SUCCESS;
+	}
+	else if ( m_dispatch_device_status >= E_BUSY && m_dispatch_device_status <= E_THREE_LEVEL_WORK)
+	{
+		return Error_manager(Error_code::DISPATCH_DEVICE_STATUS_BUSY, Error_level::NEGLIGIBLE_ERROR,
+							 " Dispatch_device_base::check_status is busy ");
+	}
+	else
+	{
+		return Error_manager(Error_code::DISPATCH_DEVICE_STATUS_ERROR, Error_level::MINOR_ERROR,
+							 " Dispatch_device_base::check_status error ");
+	}
+	return Error_code::SUCCESS;
+}
+
+//判断是否为待机,如果已经准备好,则可以执行任务。
+bool Dispatch_device_base::is_ready()
+{
+	return (m_dispatch_device_status == E_READY);
+}
+
+
+//结束任务单,里面会根据任务的故障等级修正 任务单的状态
+Error_manager Dispatch_device_base::end_task(std::shared_ptr<Task_Base> p_task)
+{
+	LOG(INFO) << " ---Dispatch_device_base::end_task ---"<< this;
+	std::unique_lock<std::mutex> t_lock(m_lock);
+	//注:这里只修改任务单的状态, 搬运器的状态不管
+	//在结束任务单时,将雷达任务状态改为 TASK_OVER 已结束
+	//判断任务单的错误等级,
+	if ( p_task->get_task_error_manager().get_error_level() < Error_level::MINOR_ERROR)
+	{
+		//强制改为TASK_OVER,不管它当前在做什么。
+		p_task->set_task_statu(TASK_OVER);
+	}
+	else
+	{
+		//强制改为 TASK_ERROR,不管它当前在做什么。
+		p_task->set_task_statu(TASK_ERROR);
+	}
+	return Error_code::SUCCESS;
+}
+
+//取消任务单,由发送方提前取消任务单
+Error_manager Dispatch_device_base::cancel_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level)
+{
+	//找到对应的任务单
+	switch ( dispatch_task_level )
+	{
+		case E_ONE_LEVEL:
+		{
+			if ( m_dispatch_device_status == E_ONE_LEVEL_WORK || m_dispatch_device_status == E_ONE_LEVEL_OVER )
+			{
+				//如果正在执行一级任务, 那么取消当前指令, 然后降级
+				m_execute_condition.notify_all(false);
+				//确保内部线程已经停下
+				while (m_execute_condition.is_working())
+				{
+
+				}
+				cancel_command();
+				{
+					std::unique_lock<std::mutex> t_lock(m_lock);
+					mp_device_one_level_task.reset();
+					m_dispatch_device_status = E_READY;
+				}
+
+				m_execute_condition.notify_all(true);
+			}
+			else
+			{
+				std::unique_lock<std::mutex> t_lock(m_lock);
+				//否则直接销毁任务单
+				mp_device_one_level_task.reset();
+			}
+			break;
+		}
+		case E_TWO_LEVEL:
+		{
+			if ( m_dispatch_device_status == E_TWO_LEVEL_WORK || m_dispatch_device_status == E_TWO_LEVEL_OVER )
+			{
+				//如果正在执行一级任务, 那么取消当前指令, 然后降级
+				m_execute_condition.notify_all(false);
+				//确保内部线程已经停下
+				while (m_execute_condition.is_working())
+				{
+
+				}
+				cancel_command();
+				{
+					std::unique_lock<std::mutex> t_lock(m_lock);
+					mp_device_two_level_task.reset();
+					m_dispatch_device_status = E_ONE_LEVEL_WORK;
+				}
+				m_execute_condition.notify_all(true);
+			}
+			else
+			{
+				std::unique_lock<std::mutex> t_lock(m_lock);
+				//否则直接销毁任务单
+				mp_device_one_level_task.reset();
+			}
+			break;
+		}
+		case E_THREE_LEVEL:
+		{
+			if ( m_dispatch_device_status == E_THREE_LEVEL_WORK || m_dispatch_device_status == E_THREE_LEVEL_OVER )
+			{
+				//如果正在执行一级任务, 那么取消当前指令, 然后降级
+				m_execute_condition.notify_all(false);
+				//确保内部线程已经停下
+				while (m_execute_condition.is_working())
+				{
+
+				}
+				cancel_command();
+				{
+					std::unique_lock<std::mutex> t_lock(m_lock);
+					mp_device_three_level_task.reset();
+					m_dispatch_device_status = E_TWO_LEVEL_WORK;
+				}
+				m_execute_condition.notify_all(true);
+			}
+			else
+			{
+				std::unique_lock<std::mutex> t_lock(m_lock);
+				//否则直接销毁任务单
+				mp_device_one_level_task.reset();
+			}
+			break;
+		}
+		default:
+		{
+			return Error_manager(Error_code::PARAMETER_ERROR, Error_level::MINOR_ERROR,
+								 "  Dispatch_device_base::cancel_task PARAMETER_ERROR ");
+			break;
+		}
+	}
+	//上级的任务单指针,改为死亡,表示任务已经失效.
+	p_task->set_task_statu(TASK_DEAD);
+	return Error_code::SUCCESS;
+}
+
+Dispatch_device_base::Dispatch_device_status Dispatch_device_base::get_dispatch_device_status()
+{
+	return m_dispatch_device_status;
+}
+
+//获取硬件设备的状态, 必须子类继承
+Dispatch_device_base::Device_status Dispatch_device_base::get_actual_device_status()
+{
+	return DEVICE_UNKNOWN;
+}
+
+//执行外界任务的执行函数
+void Dispatch_device_base::execute_thread_fun()
+{
+	LOG(INFO) << " Dispatch_device_base::execute_thread_fun() start " << this;
+
+	Error_manager t_error;
+
+	while (m_execute_condition.is_alive())
+	{
+		m_execute_condition.wait();
+		if ( m_execute_condition.is_alive() )
+		{
+			std::this_thread::sleep_for(std::chrono::microseconds(1));
+			std::this_thread::sleep_for(std::chrono::seconds(1));
+
+			std::this_thread::yield();
+
+			std::cout << " huli test :::: " << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa m_dispatch_device_status = " << m_dispatch_device_status << std::endl;
+			switch ( (Dispatch_device_status)m_dispatch_device_status )
+			{
+				//核心任务, (三级任务)
+				case E_THREE_LEVEL_WORK:
+				{
+					if ( mp_device_three_level_task.get() != NULL )
+					{
+						mp_device_three_level_task->set_task_statu(TASK_WORKING);
+						//执行三级任务
+						write_task_to_memory(mp_device_three_level_task);
+						//更新通信
+						update_device_communication();
+						//从内存中读数据到任务单
+						t_error = check_and_read_memory_to_task(mp_device_three_level_task);
+
+						if (t_error == NODATA)
+						{
+							//设备正常运行
+							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
+							std::this_thread::sleep_for(std::chrono::milliseconds(1));
+						}
+						else
+						{
+							if (t_error != SUCCESS)
+							{
+								mp_device_three_level_task->set_task_error_manager(t_error);
+							}
+							end_task(mp_device_three_level_task);
+							m_dispatch_device_status = E_THREE_LEVEL_OVER;
+						}
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_TWO_LEVEL_WORK;
+					}
+					break;
+				}
+				case E_THREE_LEVEL_OVER:
+				{
+					//更新通信
+					update_device_communication();
+					if ( mp_device_three_level_task.get() != NULL )
+					{
+						//检查任务状态,
+						//在 E_THREE_LEVEL_WORK 里面, 已经 设为 TASK_OVER 了.
+						//等待发送方的新指令, (发送方会把状态改为回收, 表示这个任务结束)
+						if ( mp_device_three_level_task->get_task_statu() == TASK_WITHDRAW )
+						{
+							//这里会通知任务已经释放, 然后销毁任务单,  并降级
+							mp_device_three_level_task->set_task_statu(TASK_FREE);
+							mp_device_three_level_task.reset();
+							m_dispatch_device_status = E_TWO_LEVEL_WORK;
+						}
+							//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_device_three_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_device_three_level_task->set_task_statu(TASK_SIGNED);
+							m_dispatch_device_status = E_THREE_LEVEL_WORK;
+						}
+						//else //保持不动, 直到发送方给定新的任务,
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_TWO_LEVEL_WORK;
+					}
+					break;
+				}
+				case E_TWO_LEVEL_WORK:
+				{
+					if ( mp_device_two_level_task.get() != NULL )
+					{
+						mp_device_two_level_task->set_task_statu(TASK_WORKING);
+						//执行二级任务
+						write_task_to_memory(mp_device_two_level_task);
+						//更新通信
+						update_device_communication();
+						//从内存中读数据到任务单
+						t_error = check_and_read_memory_to_task(mp_device_two_level_task);
+
+						if (t_error == NODATA)
+						{
+							//设备正常运行
+							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
+							std::this_thread::sleep_for(std::chrono::milliseconds(1));
+						}
+						else
+						{
+							if (t_error != SUCCESS)
+							{
+								mp_device_two_level_task->set_task_error_manager(t_error);
+							}
+							end_task(mp_device_two_level_task);
+							m_dispatch_device_status = E_TWO_LEVEL_OVER;
+						}
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_ONE_LEVEL_WORK;
+					}
+					break;
+				}
+				case E_TWO_LEVEL_OVER:
+				{
+					//更新通信
+					update_device_communication();
+					if ( mp_device_two_level_task.get() != NULL )
+					{
+						//检查任务状态,
+						//在 E_TWO_LEVEL_WORK 里面, 已经 设为 TASK_OVER 了.
+						//等待发送方的新指令, (发送方会把状态改为回收, 表示这个任务结束)
+						if ( mp_device_two_level_task->get_task_statu() == TASK_WITHDRAW )
+						{
+							//这里会通知任务已经释放, 然后销毁任务单,  并降级
+							mp_device_two_level_task->set_task_statu(TASK_FREE);
+							mp_device_two_level_task.reset();
+							m_dispatch_device_status = E_ONE_LEVEL_WORK;
+						}
+							//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_device_two_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_device_two_level_task->set_task_statu(TASK_SIGNED);
+							m_dispatch_device_status = E_TWO_LEVEL_WORK;
+						}
+						//else //保持不动, 直到发送方给定新的任务,
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_ONE_LEVEL_WORK;
+					}
+					break;
+				}
+				case E_ONE_LEVEL_WORK:
+				{
+					if ( mp_device_one_level_task.get() != NULL )
+					{
+						mp_device_one_level_task->set_task_statu(TASK_WORKING);
+						//执行一级任务,
+						write_task_to_memory(mp_device_one_level_task);
+						//更新通信
+						update_device_communication();
+						//从内存中读数据到任务单
+						t_error = check_and_read_memory_to_task(mp_device_one_level_task);
+
+						if ( t_error == NODATA )
+						{
+							//设备正常运行
+							//延时1ms, snap7的通信效率偏慢, 不需要高频率检查
+							std::this_thread::sleep_for(std::chrono::milliseconds(1));
+						}
+						else
+						{
+							if ( t_error != SUCCESS )
+							{
+								mp_device_one_level_task->set_task_error_manager(t_error);
+							}
+							end_task(mp_device_one_level_task);
+							m_dispatch_device_status = E_ONE_LEVEL_OVER;
+						}
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_READY;
+					}
+					break;
+				}
+				case E_ONE_LEVEL_OVER:
+				{
+					//更新通信
+					update_device_communication();
+					if ( mp_device_one_level_task.get() != NULL )
+					{
+						//检查任务状态,
+						//在 E_ONE_LEVEL_WORK 里面, 已经 设为 TASK_OVER 了.
+						//等待发送方的新指令, (发送方会把状态改为回收, 表示这个任务结束)
+						if ( mp_device_one_level_task->get_task_statu() == TASK_WITHDRAW )
+						{
+							//这里会通知任务已经释放, 然后销毁任务单,  并降级
+							mp_device_one_level_task->set_task_statu(TASK_FREE);
+							mp_device_one_level_task.reset();
+							m_dispatch_device_status = E_READY;
+						}
+							//任务单重新创建, 调度创建的新的任务,那么回去继续工作
+						else if (  mp_device_one_level_task->get_task_statu() == TASK_CREATED )
+						{
+							mp_device_one_level_task->set_task_statu(TASK_SIGNED);
+							m_dispatch_device_status = E_ONE_LEVEL_WORK;
+						}
+						//else //保持不动, 直到发送方给定新的任务,
+					}
+					else
+					{
+						//直接降级
+						m_dispatch_device_status = E_READY;
+					}
+					break;
+				}
+				case E_FAULT:
+				{
+					//更新通信
+					update_device_communication();
+
+					//所有任务报错, 并销毁任务.
+					if ( mp_device_one_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_ERROR, MINOR_ERROR, "m_respons_status is error");
+						mp_device_one_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_one_level_task);
+						mp_device_one_level_task.reset();
+					}
+					if ( mp_device_two_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_ERROR, MINOR_ERROR, "m_respons_status is error");
+						mp_device_two_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_two_level_task);
+						mp_device_two_level_task.reset();
+					}
+					if ( mp_device_three_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_ERROR, MINOR_ERROR, "m_respons_status is error");
+						mp_device_three_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_three_level_task);
+						mp_device_three_level_task.reset();
+					}
+
+
+					break;
+				}
+				case E_DISCONNECT:
+				{
+					//更新通信
+					update_device_communication();
+					//所有任务报错, 并销毁任务.
+					if ( mp_device_one_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_DISCONNECT, MINOR_ERROR, "m_respons_status is error");
+						mp_device_one_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_one_level_task);
+						mp_device_one_level_task.reset();
+					}
+					if ( mp_device_two_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_DISCONNECT, MINOR_ERROR, "m_respons_status is error");
+						mp_device_two_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_two_level_task);
+						mp_device_two_level_task.reset();
+					}
+					if ( mp_device_three_level_task.get() != NULL )
+					{
+						//添加错误码
+						Error_manager t_error(DISPATCH_DEVICE_STATUS_DISCONNECT, MINOR_ERROR, "m_respons_status is error");
+						mp_device_three_level_task->set_task_error_manager(t_error);
+						end_task(mp_device_three_level_task);
+						mp_device_three_level_task.reset();
+					}
+
+
+					break;
+				}
+				case E_READY:
+				{
+					//更新通信
+					update_device_communication();
+					break;
+				}
+				default:
+				{
+
+					break;
+				}
+			}
+		}
+	}
+
+	LOG(INFO) << " Dispatch_device_base::execute_thread_fun() end "<< this;
+	return;
+}
+
+//执行线程工作函数, 正在执行任务单.
+Error_manager Dispatch_device_base::execute_thread_working(std::shared_ptr<Task_Base> p_task, Dispatch_device_status & device_status)
+{
+	return Error_code::SUCCESS;
+}
+//执行线程工作函数, 已经完成任务单. 等待新的指令
+Error_manager Dispatch_device_base::execute_thread_over(std::shared_ptr<Task_Base> p_task, Dispatch_device_status & device_status)
+{
+	return Error_code::SUCCESS;
+}
+
+//把任务单写入到内存中, 子类必须重载
+Error_manager Dispatch_device_base::write_task_to_memory(std::shared_ptr<Task_Base> p_task)
+{
+	return Error_code::SUCCESS;
+}
+//更新设备底层通信数据, 子类必须重载
+Error_manager Dispatch_device_base::update_device_communication()
+{
+	return Error_code::SUCCESS;
+}
+//从内存中读数据到任务单, 子类必须重载
+Error_manager Dispatch_device_base::check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task)
+{
+	return Error_code::SUCCESS;
+}
+
+
+
+
+
+//取消下发的指令
+Error_manager Dispatch_device_base::cancel_command()
+{
+	//以后再写 need programe
+	//目前调度和plc的通信指令做的很简单,没有暂停和急停 复位等操作.
+	//这里先空着,以后再写.
+	//调度模块单方面销毁任务, 不管底层plc的执行情况, 也不去告知plc任务取消.
+
+	return Error_code::SUCCESS;
+}
+
+
+

+ 187 - 0
dispatch/dispatch_device_base.h

@@ -0,0 +1,187 @@
+//
+// Created by huli on 2021/3/3.
+//
+
+#ifndef NNXX_TESTS_DISPATCH_DEVICE_BASE_H
+#define NNXX_TESTS_DISPATCH_DEVICE_BASE_H
+
+#include "../error_code/error_code.h"
+#include <glog/logging.h>
+#include <thread>
+#include <mutex>
+#include "../tool/thread_condition.h"
+#include "../task/task_base.h"
+#include "../dispatch/dispatch_communication.h"
+
+//调度设备的基类.
+class Dispatch_device_base
+{
+public:
+	//设备底层通信延时5000ms
+#define	COMMUNICATION_OVER_TIME_MS	5000
+
+	//设备状态,这个类的总状态,这里指工作任务流程
+	enum Dispatch_device_status
+	{
+		E_UNKNOW               	= 0,    //未知
+		E_READY               	= 1,    //准备,待机
+		E_BUSY					= 2, 	//工作正忙
+
+		E_ONE_LEVEL_OVER		= 3, 	//一级工作完成,
+		E_ONE_LEVEL_WORK		= 4,	//一级工作状态, 就是普通的移动任务
+		E_TWO_LEVEL_OVER		= 5, 	//一级工作完成,
+		E_TWO_LEVEL_WORK		= 6,	//二级工作状态, 就是紧急避让, 插队任务(会在执行一级任务的过程中, 插队并优先执行二级任务)
+		E_THREE_LEVEL_OVER		= 7, 	//一级工作完成,
+		E_THREE_LEVEL_WORK		= 8,	//三级工作任务, 就是锁定硬件资源, 不让插队, (除非急停或者取消任务)
+
+		E_FAULT					= 100,	//故障
+		E_DISCONNECT			= 101, 	//通信故障
+	};
+	
+	//调度任务的等级
+	enum Dispatch_task_level
+	{
+//	    E_UNKNOW_LEVEL          = 0,    //无效任务
+		E_ONE_LEVEL             = 1,    //一级任务
+		E_TWO_LEVEL				= 2,	//二级任务
+		E_THREE_LEVEL			= 3,	//三级任务	    
+	};
+
+	//抓车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0,    //无动作.
+		E_CLAMP_TIGHT               	= 1,    //夹紧夹杆
+		E_CLAMP_LOOSE					= 2,	//松开夹杆
+	};
+
+	//中跑车和平层轨道的对接
+	enum Joint_motion
+	{
+		E_JOINT_NO_ACTION            	= 0,    //无动作.
+		E_JOINT_HOLD_OUT               	= 1,    //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+		E_JOINT_TAKE_BACK				= 2,	//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+	};
+
+	//小跑车的位置,是否在中跑车上面
+	enum Small_sports_car_motion
+	{
+		E_SMALL_SPORTS_NO_ACTION		= 0,    //无动作.
+		E_SMALL_SPORTS_CAR_GET_AWAY 	= 1,    //小跑车离开中跑车
+		E_SMALL_SPORTS_CAR_GET_BACK		= 2,	//小跑车返回中跑车
+	};
+
+
+	//指令完成状态, 设备答复指令, 返回任务完成的情况
+	enum Respons_status
+	{
+		RESPONS_WORKING            	= 0,    //任务进行中
+		RESPONS_OVER               	= 1,    //任务完成
+		RESPONS_MINOR_ERROR			= 100,	//一般故障, 可恢复
+		RESPONS_CRITICAL_ERROR		= 101,	//致命故障,不可恢复
+	};
+
+	//设备的硬件设备状态
+	enum Device_status
+	{
+		DEVICE_UNKNOWN              = 0,    //设备未知
+		DEVICE_READY                = 1,    //设备空闲(可以接受新的指令任务)
+		DEVICE_WORKING				= 2,	//设备工作中
+		DEVICE_EMERGENCY_STOP		= 3,	//设备急停
+		DEVICE_UNSAFETY				= 4,	//设备不安全(暂时不考虑是否处于安全位置)
+		DEVICE_COLLISION			= 5,	//设备发生碰撞
+		DEVICE_FAULT				= 6,	//设备故障
+	};
+
+	//设备的负载状态, 小跑车上面是否有车.
+	enum Load_status
+	{
+		LOAD_UNKNOWN				= 0,	//负载未知
+		HAVE_CAR               		= 1,    //有车
+		NO_CAR            			= 2,    //没车
+	};
+public:
+	Dispatch_device_base();
+	Dispatch_device_base(const Dispatch_device_base& other)= default;
+	Dispatch_device_base& operator =(const Dispatch_device_base& other)= default;
+	~Dispatch_device_base();
+public://API functions
+	//设备 初始化
+	virtual Error_manager dispatch_device_base_init(int device_id);
+	//设备 反初始化
+	virtual Error_manager dispatch_device_base_uninit();
+
+	//执行任务//注意了, 调度任务允许同时接受多个任务
+	virtual Error_manager execute_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level);
+	//检查任务类型, 子类必须重载, 用来检查输入的任务是否为子类所需的.
+	virtual Error_manager check_task_type(std::shared_ptr<Task_Base> p_task);
+	//判断能否执行任务
+	virtual Error_manager check_task_level(Dispatch_task_level dispatch_task_level);
+	//签收任务
+	virtual Error_manager sign_for_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level);
+
+	//检查状态,是否正常运行. (工作状态 和 是否能接受对应的任务无关)
+	virtual Error_manager check_status();
+	//判断是否为待机,如果已经准备好,则可以执行任务。
+	virtual bool is_ready();
+
+	//结束任务单,里面会根据任务的故障等级修正 任务单的状态
+	virtual Error_manager end_task(std::shared_ptr<Task_Base> p_task);
+	//取消任务单,由发送方提前取消任务单
+	virtual Error_manager cancel_task(std::shared_ptr<Task_Base> p_task, Dispatch_task_level dispatch_task_level);
+
+
+public://get or set member variable
+	Dispatch_device_status get_dispatch_device_status();
+	//获取硬件设备的状态, 必须子类继承
+	virtual Device_status get_actual_device_status();
+
+protected://member functions
+
+
+	//执行外界任务的执行函数
+	void execute_thread_fun();
+
+	//执行线程工作函数, 正在执行任务单.
+	virtual Error_manager execute_thread_working(std::shared_ptr<Task_Base> p_task, Dispatch_device_status & carrier_status);
+	//执行线程工作函数, 已经完成任务单. 等待新的指令
+	virtual Error_manager execute_thread_over(std::shared_ptr<Task_Base> p_task, Dispatch_device_status & carrier_status);
+
+	//把任务单写入到内存中, 子类必须重载
+	virtual Error_manager write_task_to_memory(std::shared_ptr<Task_Base> p_task);
+	//更新设备底层通信数据, 子类必须重载
+	virtual Error_manager update_device_communication();
+	//从内存中读数据到任务单, 子类必须重载
+	virtual Error_manager check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task);
+
+
+	//取消下发的指令, 子类必须重载, 用来向下发送命令取消任务.
+	virtual Error_manager cancel_command();
+
+
+
+
+protected://member variable
+	std::atomic<Dispatch_device_status>			m_dispatch_device_status;			//设备总状态, 控制任务流程
+	int 								m_device_id;				//设备id,
+	std::mutex							m_lock;	//锁
+
+
+
+
+	//任务执行线程
+	std::thread*        				mp_execute_thread;   			//执行的线程指针,内存由本类管理
+	Thread_condition					m_execute_condition;			//执行的条件变量
+
+	std::shared_ptr<Task_Base>			mp_device_one_level_task;		//设备的普通任务, (一般移动和等待指令, 允许被打断)
+	std::shared_ptr<Task_Base>			mp_device_two_level_task;		//设备的优先任务, (紧急避让和插队指令, 允许打断普通任务)
+	std::shared_ptr<Task_Base>			mp_device_three_level_task;		//设备的核心任务, (锁定位置进行抓车和放车, 最高任务, 不允许打断和被打断)
+
+
+
+private:
+
+};
+
+
+#endif //NNXX_TESTS_DISPATCH_DEVICE_BASE_H

+ 1 - 0
dispatch/dispatch_manager.h

@@ -11,6 +11,7 @@
 #include "../tool/thread_condition.h"
 
 #include "../dispatch/carrier_base.h"
+#include "../dispatch/catcher.h"
 #include <vector>
 #include <glog/logging.h>
 

+ 26 - 1
error_code/error_code.h

@@ -343,7 +343,22 @@ enum Error_code
 	DISPATCH_MANAGER_TASK_TYPE_ERROR,					//调度管理模块,任务类型错误
 	DISPATCH_MANAGER_IS_NOT_READY,						//调度管理模块,不在准备状态
 
-	CARRIER_ERROR_BASE								= 0x13020000,
+	DISPATCH_DEVICE_ERROR_BASE								= 0x13030000,
+	DISPATCH_DEVICE_READ_PROTOBUF_ERROR,				//调度设备模块,读取参数错误
+	DISPATCH_DEVICE_STATUS_BUSY,						//调度设备模块,状态正忙
+	DISPATCH_DEVICE_STATUS_ERROR,						//调度设备模块,状态错误
+	DISPATCH_DEVICE_STATUS_DISCONNECT,					//调度设备模块,状态断连
+	DISPATCH_DEVICE_TASK_TYPE_ERROR,					//调度设备模块,任务类型错误
+	DISPATCH_DEVICE_TASK_OVER_TIME,						//调度设备模块,任务超时
+	DISPATCH_DEVICE_IS_NOT_READY,						//调度设备模块,不在准备状态
+	DISPATCH_DEVICE_RESPONS_ERROR,						//调度设备模块,指令的执行失败
+	DISPATCH_DEVICE_TASK_NOTHINGNESS,					//调度设备模块,任务不存在
+
+
+
+
+
+	CARRIER_ERROR_BASE								= 0x13030000,
 	CARRIER_READ_PROTOBUF_ERROR,				//搬运器模块,读取参数错误
 	CARRIER_STATUS_BUSY,						//搬运器模块,状态正忙
 	CARRIER_STATUS_ERROR,						//搬运器模块,状态错误
@@ -354,6 +369,16 @@ enum Error_code
 	CARRIER_RESPONS_ERROR,						//搬运器模块,指令的执行失败
 	CARRIER_TASK_NOTHINGNESS,					//搬运器模块,任务不存在
 
+	CATCHER_ERROR_BASE								= 0x13030000,
+	CATCHER_READ_PROTOBUF_ERROR,				//抓取器模块,读取参数错误
+	CATCHER_STATUS_BUSY,						//抓取器模块,状态正忙
+	CATCHER_STATUS_ERROR,						//抓取器模块,状态错误
+	CATCHER_STATUS_DISCONNECT,					//抓取器模块,状态断连
+	CATCHER_TASK_TYPE_ERROR,					//抓取器模块,任务类型错误
+	CATCHER_TASK_OVER_TIME,						//抓取器模块,任务超时
+	CATCHER_IS_NOT_READY,						//抓取器模块,不在准备状态
+	CATCHER_RESPONS_ERROR,						//抓取器模块,指令的执行失败
+	CATCHER_TASK_NOTHINGNESS,					//抓取器模块,任务不存在
 
 
 

+ 67 - 22
main.cpp

@@ -51,10 +51,28 @@ void myfunction (int i) {  // function:
 }
 
 
-int main(int argc,char* argv[])
+class AAA
+{
+public:
+	int a;
+};
+
+class BBB:public AAA
 {
+public:
+	int b;
+};
+
+class CCC:public AAA
+{
+public:
+	int c;
+};
+
 
 
+int main(int argc,char* argv[])
+{
 
 	const char* logPath = "./";
 	google::InitGoogleLogging("LidarMeasurement");
@@ -68,49 +86,76 @@ int main(int argc,char* argv[])
 	FLAGS_max_log_size = 1024;            // Set max log file size(GB)
 	FLAGS_stop_logging_if_full_disk = true;
 
-	
+
 	Error_manager t_error;
 
-	std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Request_from_dispatch_to_plc) = " << sizeof(Dispatch_communication::Request_from_dispatch_to_plc) << std::endl;
-	std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Response_from_plc_to_dispatch) = " << sizeof(Dispatch_communication::Response_from_plc_to_dispatch) << std::endl;
-	std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Status_from_dispatch_to_plc) = " << sizeof(Dispatch_communication::Status_from_dispatch_to_plc) << std::endl;
-	std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Status_from_plc_to_dispatch) = " << sizeof(Dispatch_communication::Status_from_plc_to_dispatch) << std::endl;
+	t_error = Dispatch_communication::get_instance_references().communication_init();
 
 
-	t_error = Dispatch_communication::get_instance_references().communication_init();
+	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
+	std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
+	std::this_thread::sleep_for(std::chrono::seconds(2));
 	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
 	std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
 
-	Carrier_base t_carrier_base;
-	t_carrier_base.carrier_base_init();
+	std::cout << " ---------------------------------------------------" << std::endl;
+	std::cout << " ---------------------------------------------------" << std::endl;
 
-	std::shared_ptr<Carrier_task> tp_carrier_task(new Carrier_task);
-	tp_carrier_task->task_init(NULL,std::chrono::milliseconds(15000),
-	1,2,3,"asd",
-	0,10,20,30);
+	Catcher t_catcher;
+	t_error = t_catcher.dispatch_device_base_init(1);
+	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
 
+	std::this_thread::sleep_for(std::chrono::seconds(2));
 
-	std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl;
-	std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
+	std::shared_ptr<Task_Base> tp_task_Base(new Catcher_task);
+	Catcher_task * tp_catcher_task = (Catcher_task *)tp_task_Base.get();
+	tp_catcher_task->task_init(NULL,std::chrono::milliseconds(15000));
+	tp_catcher_task->m_request_key = "ABCDEF";
+	tp_catcher_task->m_request_x = 123;
+	tp_catcher_task->m_request_y = 456;
+	tp_catcher_task->m_request_b = 80;
+	tp_catcher_task->m_request_z = 789;
+	tp_catcher_task->m_request_d1 = 333;
+	tp_catcher_task->m_request_d2 = 444;
+	tp_catcher_task->m_request_wheelbase = 555;
+	tp_catcher_task->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
 
-	std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << t_carrier_base.get_carrier_status() << std::endl;
 
+	t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
+	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
 
 	std::cout << " ---------------------------------------------------" << std::endl;
 
-	t_error = t_carrier_base.execute_one_level_task(tp_carrier_task);
-	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
+
+	char zxczxcxzc ;
+	std::cin >> zxczxcxzc ;
+
 
 	while ( 1 )
 	{
-		std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl;
-		std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
+		std::cout << " huli test :::: " << "  ===================================== "   << std::endl;
+		std::cout << " huli test :::: " << " tp_catcher_task->get_task_statu = " << tp_catcher_task->get_task_statu() << std::endl;
+		std::cout << " huli test :::: " << " tp_catcher_task->m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
+
+
+		std::cout << " huli test :::: " << " m_respons_key = " << tp_catcher_task->m_respons_key << std::endl;
+		std::cout << " huli test :::: " << " m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
+		std::cout << " huli test :::: " << " m_respons_x = " << tp_catcher_task->m_respons_x << std::endl;
+		std::cout << " huli test :::: " << " m_respons_y = " << tp_catcher_task->m_respons_y << std::endl;
+		std::cout << " huli test :::: " << " m_respons_b = " << tp_catcher_task->m_respons_b << std::endl;
+		std::cout << " huli test :::: " << " m_respons_z = " << tp_catcher_task->m_respons_z << std::endl;
+		std::cout << " huli test :::: " << " m_respons_d1 = " << tp_catcher_task->m_respons_d1 << std::endl;
+		std::cout << " huli test :::: " << " m_respons_d2 = " << tp_catcher_task->m_respons_d2 << std::endl;
+		std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_catcher_task->m_respons_wheelbase << std::endl;
+		std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_catcher_task->m_respons_clamp_motion << std::endl;
+
 
-		std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_carrier_base.get_carrier_status() << std::endl;
+		std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_dispatch_device_status() << std::endl;
+		std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_actual_device_status() << std::endl;
 
 
 		std::cout << " ---------------------------------------------------" << std::endl;
-		std::this_thread::sleep_for(std::chrono::milliseconds(100));
+		std::this_thread::sleep_for(std::chrono::milliseconds(1000));
 
 	}
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2619 - 0
message/dispatch_control.pb.cc


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1918 - 0
message/dispatch_control.pb.h


+ 159 - 0
message/dispatch_control.proto

@@ -0,0 +1,159 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+//调度任务的类型
+enum Dispatch_task_type
+{
+    DISPATCH_PLAN_STORE                     = 101;  //总指令, 存车
+    DISPATCH_PLAN_PICKUP                    = 102;  //总指令, 取车
+
+
+    //机器手的动作
+    ROBOT_CATCH_CAR_FROM_INLET              = 1;    //机器手去入口抓车(例如:机器手移动到2号入口上方,然后下降到一楼抓车,最后上升到最上方)
+    ROBOT_PUT_CAR_TO_CARRIER                = 2;    //机器手把车放到中跑车上面(例如:机器手下降到中跑车上放车,最后上升到最上方)(通过目标点 指定放到哪一个中跑车上)
+    ROBOT_CATCH_CAR_FROM_CARRIER            = 3;    //机器手去中跑车上抓车(例如:机器手移动到1号中跑车上方,然后下降到中跑车抓车,最后上升到最上方)
+    ROBOT_PUT_CAR_TO_OUTLET                 = 4;    //机器手去出口放车(例如:机器手移动到3号出口上方,然后下降到一楼放车,最后上升到最上方)
+    ROBOT_MOVE                              = 5;    //机器手的自由移动(例如:机器手移动到6号出入口的上方4楼处,给其他设备避让)(不进行抓车和放车的操作)
+
+    //搬运器的动作(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_RECEIVE_CAR_FROM_ROBOT          = 11;   //搬运器从机器手上接车(例如:搬运器移动到2号入口的上方,然后等待机器手把车放到中跑车上,小跑车保持松夹杆状态)
+    CARRIER_STORE_CAR_TO_PARKINGSPACE       = 12;   //搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至电梯井)
+    CARRIER_STORE_CAR_TO_PARKINGSPACE_EX    = 122;   //搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至56车位外面即可)
+
+    CARRIER_PICKUP_CAR_FROM_PARKINGSPACE    = 13;   //搬运器从停车位上取车(例如:搬运器移动到56号停车位,然后小跑车将车从车位取出,之后搬运器退回至电梯井)
+    CARRIER_DELIVER_CAR_TO_ROBOT            = 14;   //搬运器把车交付给机器手(例如:搬运器移动到3号入口的上方,小跑车松夹杆,然后等待机器手把车从中跑车上取走)
+    CARRIER_MOVE                            = 15;   //搬运器的自由移动(可以提前到2楼来准备接车,或者为了避让就退回至电梯井)(小跑车不进行取车和存车)
+
+    //通道口的动作(1楼出入口的动作)
+    PASSAGEWAY_OPEN_OUTSIDE_DOOR            = 21;   //通道口开外侧大门(0~7号出入口都有)
+    PASSAGEWAY_CLOSE_OUTSIDE_DOOR           = 22;   //通道口关外侧大门(0~7号出入口都有)
+
+    PASSAGEWAY_OPEN_INSIDE_DOOR             = 23;   //通道口开内侧大门(0号和7号出入口特有的指令)
+    PASSAGEWAY_CLOSE_INSIDE_DOOR            = 24;   //通道口关内侧大门(0号和7号出入口特有的指令)
+    PASSAGEWAY_ROTATE_TURNTABLE_TO_CARRIER  = 25;   //通道口旋转转盘到搬运器(对接小跑车)
+    PASSAGEWAY_ROTATE_TURNTABLE_TO_OUTLET   = 26;   //通道口旋转转盘到出口
+
+    //结束指令
+    DISPATCH_FINISH                         = 30;   //整个调度流程完成, 正常完成(之后调度向总控汇报 正常完成任务)
+    DISPATCH_CANCEL                         = 31;   //整个调度流程取消, 异常完成(之后调度向总控汇报 异常完成任务, 并把错误码往上报)
+
+    DISPATCH_PAUSE                          = 40;   //调度暂停, 可以指定某一个设备暂时 停止动作,直接进入空闲状态(之后再次发送上面的正常指令,可以让其执行新的动作)
+
+
+    DISPATCH_RESERVED                       = 50;   //预留
+
+    //存车顺序  1->11->2->12
+    //取车顺序  13->14->3->15->4
+}
+
+//调度设备的类型
+enum Dispatch_device_type
+{
+    ROBOT_1                                 = 101;      //中间的大型机器手   (可以负责1~6号出入口的停车和取车)
+    ROBOT_2                                 = 102;      //一号出口的专用机器手(只能负责1号出口的取车)(目前没有安装,暂时不考虑)
+
+    CARRIER_1                               = 201;      //左侧0号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_2                               = 202;      //右侧7号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_3                               = 203;      //中间3楼的搬运器(中跑车 小跑车 二合一为搬运器)(没有电梯, 只能在3楼活动)
+
+    PASSAGEWAY_0                            = 300;      //0号出口(在左侧电梯井, 只能取车)(暂时不存在)
+    PASSAGEWAY_1                            = 301;      //1号出入口
+    PASSAGEWAY_2                            = 302;      //2号出入口
+    PASSAGEWAY_3                            = 303;      //3号出入口
+    PASSAGEWAY_4                            = 304;      //4号出入口
+    PASSAGEWAY_5                            = 305;      //5号出入口
+    PASSAGEWAY_6                            = 306;      //6号出入口
+    PASSAGEWAY_7                            = 307;      //7号出口(在右侧电梯井, 只能取车)
+}
+
+
+//调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+message Dispatch_plan_request_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional int32                      dispatch_source=4;               //调度的起点,源头(暂时不写)(留给以后使用)
+    optional int32                      dispatch_destination=5;          //调度的终点,目的地(一般必须写, 特殊指令可以不写)
+
+    optional Error_manager              error_manager = 6;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+}
+
+//调度总规划的答复(调度算法->调度管理)
+message Dispatch_plan_response_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional int32                      dispatch_source=4;               //调度的起点,源头(可以不写)
+    optional int32                      dispatch_destination=5;          //调度的终点,目的地(必写,如果不写 任务就不会执行)
+
+    optional Error_manager              error_manager = 6;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+}
+
+//调度控制的任务请求(调度算法->调度管理)
+message Dispatch_control_request_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    required Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional Dispatch_device_type       dispatch_device_type=4;          //调度设备的类型
+    optional int32                      dispatch_source=5;               //调度的起点,源头(暂时不写)(留给以后使用)
+    optional int32                      dispatch_destination=6;          //调度的终点,目的地(一般必须写, 特殊指令可以不写)
+
+    optional Error_manager              error_manager = 7;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+    //发送请求的错误码只有在 DISPATCH_CANCEL 任务异常取消的时候有效, 调度模块会把这个错误反馈给总控..
+}
+
+//调度控制的任务答复(调度管理->调度算法)
+message Dispatch_control_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional Dispatch_device_type       dispatch_device_type=4;          //调度设备
+    optional int32                      dispatch_source=5;               //调度的起点,源头(可以不写)
+    optional int32                      dispatch_destination=6;          //调度的终DISPATCH_FINISH点,目的地(必写,如果不写 任务就不会执行)
+
+    optional Error_manager              error_manager = 7;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+}
+
+
+/*
+        dispatch_source 和 dispatch_destination 的表示含义
+
+        1~165           2楼~12楼的停车位
+
+        1100            0号出口(在一楼)(目前没有)
+        1101~1106       1~6号出入口 (在一楼)
+        1107            7号出口(在一楼)
+        1201~1206       1~6号出入口上方2楼处
+        1301~1306       1~6号出入口上方3楼处
+        1401~1406       1~6号出入口上方4楼处
+
+        2101~2112       左侧电梯井(1楼~12楼)(一号搬运器的待机点)
+        2201~2212       右侧电梯井(1楼~12楼)(二号搬运器的待机点)
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 837 - 199
message/dispatch_message.pb.cc


+ 566 - 145
message/dispatch_message.pb.h

@@ -38,7 +38,7 @@ namespace protobuf_dispatch_5fmessage_2eproto {
 struct TableStruct {
   static const ::google::protobuf::internal::ParseTableField entries[];
   static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[5];
+  static const ::google::protobuf::internal::ParseTable schema[6];
   static const ::google::protobuf::internal::FieldMetadata field_metadata[];
   static const ::google::protobuf::internal::SerializationTable serialization_table[];
   static const ::google::protobuf::uint32 offsets[];
@@ -46,6 +46,8 @@ struct TableStruct {
 void AddDescriptors();
 void InitDefaultsDevice_positionImpl();
 void InitDefaultsDevice_position();
+void InitDefaultsDispatch_manager_data_msgImpl();
+void InitDefaultsDispatch_manager_data_msg();
 void InitDefaultsDispatch_manager_status_msgImpl();
 void InitDefaultsDispatch_manager_status_msg();
 void InitDefaultsDispatch_terminal_status_msgImpl();
@@ -56,6 +58,7 @@ void InitDefaultsDispatch_response_msgImpl();
 void InitDefaultsDispatch_response_msg();
 inline void InitDefaults() {
   InitDefaultsDevice_position();
+  InitDefaultsDispatch_manager_data_msg();
   InitDefaultsDispatch_manager_status_msg();
   InitDefaultsDispatch_terminal_status_msg();
   InitDefaultsDispatch_request_msg();
@@ -66,6 +69,9 @@ namespace message {
 class Device_position;
 class Device_positionDefaultTypeInternal;
 extern Device_positionDefaultTypeInternal _Device_position_default_instance_;
+class Dispatch_manager_data_msg;
+class Dispatch_manager_data_msgDefaultTypeInternal;
+extern Dispatch_manager_data_msgDefaultTypeInternal _Dispatch_manager_data_msg_default_instance_;
 class Dispatch_manager_status_msg;
 class Dispatch_manager_status_msgDefaultTypeInternal;
 extern Dispatch_manager_status_msgDefaultTypeInternal _Dispatch_manager_status_msg_default_instance_;
@@ -252,6 +258,27 @@ inline bool Dispatch_motion_direction_Parse(
   return ::google::protobuf::internal::ParseNamedEnum<Dispatch_motion_direction>(
     Dispatch_motion_direction_descriptor(), name, value);
 }
+enum Dispatch_device_status {
+  DISPATCH_DEVICE_UNKNOW = 0,
+  DISPATCH_DEVICE_READY = 1,
+  DISPATCH_DEVICE_BUSY = 2,
+  DISPATCH_DEVICE_FAULT = 10
+};
+bool Dispatch_device_status_IsValid(int value);
+const Dispatch_device_status Dispatch_device_status_MIN = DISPATCH_DEVICE_UNKNOW;
+const Dispatch_device_status Dispatch_device_status_MAX = DISPATCH_DEVICE_FAULT;
+const int Dispatch_device_status_ARRAYSIZE = Dispatch_device_status_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Dispatch_device_status_descriptor();
+inline const ::std::string& Dispatch_device_status_Name(Dispatch_device_status value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Dispatch_device_status_descriptor(), value);
+}
+inline bool Dispatch_device_status_Parse(
+    const ::std::string& name, Dispatch_device_status* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Dispatch_device_status>(
+    Dispatch_device_status_descriptor(), name, value);
+}
 // ===================================================================
 
 class Device_position : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Device_position) */ {
@@ -387,6 +414,106 @@ class Device_position : public ::google::protobuf::Message /* @@protoc_insertion
 };
 // -------------------------------------------------------------------
 
+class Dispatch_manager_data_msg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Dispatch_manager_data_msg) */ {
+ public:
+  Dispatch_manager_data_msg();
+  virtual ~Dispatch_manager_data_msg();
+
+  Dispatch_manager_data_msg(const Dispatch_manager_data_msg& from);
+
+  inline Dispatch_manager_data_msg& operator=(const Dispatch_manager_data_msg& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Dispatch_manager_data_msg(Dispatch_manager_data_msg&& from) noexcept
+    : Dispatch_manager_data_msg() {
+    *this = ::std::move(from);
+  }
+
+  inline Dispatch_manager_data_msg& operator=(Dispatch_manager_data_msg&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Dispatch_manager_data_msg& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Dispatch_manager_data_msg* internal_default_instance() {
+    return reinterpret_cast<const Dispatch_manager_data_msg*>(
+               &_Dispatch_manager_data_msg_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    1;
+
+  void Swap(Dispatch_manager_data_msg* other);
+  friend void swap(Dispatch_manager_data_msg& a, Dispatch_manager_data_msg& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Dispatch_manager_data_msg* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Dispatch_manager_data_msg* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Dispatch_manager_data_msg& from);
+  void MergeFrom(const Dispatch_manager_data_msg& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Dispatch_manager_data_msg* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // @@protoc_insertion_point(class_scope:message.Dispatch_manager_data_msg)
+ private:
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  friend struct ::protobuf_dispatch_5fmessage_2eproto::TableStruct;
+  friend void ::protobuf_dispatch_5fmessage_2eproto::InitDefaultsDispatch_manager_data_msgImpl();
+};
+// -------------------------------------------------------------------
+
 class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Dispatch_manager_status_msg) */ {
  public:
   Dispatch_manager_status_msg();
@@ -429,7 +556,7 @@ class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@prot
                &_Dispatch_manager_status_msg_default_instance_);
   }
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
-    1;
+    2;
 
   void Swap(Dispatch_manager_status_msg* other);
   friend void swap(Dispatch_manager_status_msg& a, Dispatch_manager_status_msg& b) {
@@ -476,46 +603,6 @@ class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@prot
 
   // accessors -------------------------------------------------------
 
-  // repeated .message.Catcher_status catcher_status = 4;
-  int catcher_status_size() const;
-  void clear_catcher_status();
-  static const int kCatcherStatusFieldNumber = 4;
-  ::message::Catcher_status catcher_status(int index) const;
-  void set_catcher_status(int index, ::message::Catcher_status value);
-  void add_catcher_status(::message::Catcher_status value);
-  const ::google::protobuf::RepeatedField<int>& catcher_status() const;
-  ::google::protobuf::RepeatedField<int>* mutable_catcher_status();
-
-  // repeated .message.Carrier_status carrier_status = 5;
-  int carrier_status_size() const;
-  void clear_carrier_status();
-  static const int kCarrierStatusFieldNumber = 5;
-  ::message::Carrier_status carrier_status(int index) const;
-  void set_carrier_status(int index, ::message::Carrier_status value);
-  void add_carrier_status(::message::Carrier_status value);
-  const ::google::protobuf::RepeatedField<int>& carrier_status() const;
-  ::google::protobuf::RepeatedField<int>* mutable_carrier_status();
-
-  // repeated .message.Elevator_status elevator_status = 6;
-  int elevator_status_size() const;
-  void clear_elevator_status();
-  static const int kElevatorStatusFieldNumber = 6;
-  ::message::Elevator_status elevator_status(int index) const;
-  void set_elevator_status(int index, ::message::Elevator_status value);
-  void add_elevator_status(::message::Elevator_status value);
-  const ::google::protobuf::RepeatedField<int>& elevator_status() const;
-  ::google::protobuf::RepeatedField<int>* mutable_elevator_status();
-
-  // repeated .message.Passageway_status passageway_status = 7;
-  int passageway_status_size() const;
-  void clear_passageway_status();
-  static const int kPassagewayStatusFieldNumber = 7;
-  ::message::Passageway_status passageway_status(int index) const;
-  void set_passageway_status(int index, ::message::Passageway_status value);
-  void add_passageway_status(::message::Passageway_status value);
-  const ::google::protobuf::RepeatedField<int>& passageway_status() const;
-  ::google::protobuf::RepeatedField<int>* mutable_passageway_status();
-
   // required .message.Base_info base_info = 1;
   bool has_base_info() const;
   void clear_base_info();
@@ -539,6 +626,97 @@ class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@prot
   ::message::Dispatch_manager_status dispatch_manager_status() const;
   void set_dispatch_manager_status(::message::Dispatch_manager_status value);
 
+  // optional .message.Dispatch_device_status robot_1_status = 4;
+  bool has_robot_1_status() const;
+  void clear_robot_1_status();
+  static const int kRobot1StatusFieldNumber = 4;
+  ::message::Dispatch_device_status robot_1_status() const;
+  void set_robot_1_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status robot_2_status = 5;
+  bool has_robot_2_status() const;
+  void clear_robot_2_status();
+  static const int kRobot2StatusFieldNumber = 5;
+  ::message::Dispatch_device_status robot_2_status() const;
+  void set_robot_2_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status carrier_1_status = 6;
+  bool has_carrier_1_status() const;
+  void clear_carrier_1_status();
+  static const int kCarrier1StatusFieldNumber = 6;
+  ::message::Dispatch_device_status carrier_1_status() const;
+  void set_carrier_1_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status carrier_2_status = 7;
+  bool has_carrier_2_status() const;
+  void clear_carrier_2_status();
+  static const int kCarrier2StatusFieldNumber = 7;
+  ::message::Dispatch_device_status carrier_2_status() const;
+  void set_carrier_2_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status carrier_3_status = 8;
+  bool has_carrier_3_status() const;
+  void clear_carrier_3_status();
+  static const int kCarrier3StatusFieldNumber = 8;
+  ::message::Dispatch_device_status carrier_3_status() const;
+  void set_carrier_3_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_0_status = 9;
+  bool has_passageway_0_status() const;
+  void clear_passageway_0_status();
+  static const int kPassageway0StatusFieldNumber = 9;
+  ::message::Dispatch_device_status passageway_0_status() const;
+  void set_passageway_0_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_1_status = 10;
+  bool has_passageway_1_status() const;
+  void clear_passageway_1_status();
+  static const int kPassageway1StatusFieldNumber = 10;
+  ::message::Dispatch_device_status passageway_1_status() const;
+  void set_passageway_1_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_2_status = 11;
+  bool has_passageway_2_status() const;
+  void clear_passageway_2_status();
+  static const int kPassageway2StatusFieldNumber = 11;
+  ::message::Dispatch_device_status passageway_2_status() const;
+  void set_passageway_2_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_3_status = 12;
+  bool has_passageway_3_status() const;
+  void clear_passageway_3_status();
+  static const int kPassageway3StatusFieldNumber = 12;
+  ::message::Dispatch_device_status passageway_3_status() const;
+  void set_passageway_3_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_4_status = 13;
+  bool has_passageway_4_status() const;
+  void clear_passageway_4_status();
+  static const int kPassageway4StatusFieldNumber = 13;
+  ::message::Dispatch_device_status passageway_4_status() const;
+  void set_passageway_4_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_5_status = 14;
+  bool has_passageway_5_status() const;
+  void clear_passageway_5_status();
+  static const int kPassageway5StatusFieldNumber = 14;
+  ::message::Dispatch_device_status passageway_5_status() const;
+  void set_passageway_5_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_6_status = 15;
+  bool has_passageway_6_status() const;
+  void clear_passageway_6_status();
+  static const int kPassageway6StatusFieldNumber = 15;
+  ::message::Dispatch_device_status passageway_6_status() const;
+  void set_passageway_6_status(::message::Dispatch_device_status value);
+
+  // optional .message.Dispatch_device_status passageway_7_status = 16;
+  bool has_passageway_7_status() const;
+  void clear_passageway_7_status();
+  static const int kPassageway7StatusFieldNumber = 16;
+  ::message::Dispatch_device_status passageway_7_status() const;
+  void set_passageway_7_status(::message::Dispatch_device_status value);
+
   // @@protoc_insertion_point(class_scope:message.Dispatch_manager_status_msg)
  private:
   void set_has_base_info();
@@ -547,6 +725,32 @@ class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@prot
   void clear_has_dispatch_id();
   void set_has_dispatch_manager_status();
   void clear_has_dispatch_manager_status();
+  void set_has_robot_1_status();
+  void clear_has_robot_1_status();
+  void set_has_robot_2_status();
+  void clear_has_robot_2_status();
+  void set_has_carrier_1_status();
+  void clear_has_carrier_1_status();
+  void set_has_carrier_2_status();
+  void clear_has_carrier_2_status();
+  void set_has_carrier_3_status();
+  void clear_has_carrier_3_status();
+  void set_has_passageway_0_status();
+  void clear_has_passageway_0_status();
+  void set_has_passageway_1_status();
+  void clear_has_passageway_1_status();
+  void set_has_passageway_2_status();
+  void clear_has_passageway_2_status();
+  void set_has_passageway_3_status();
+  void clear_has_passageway_3_status();
+  void set_has_passageway_4_status();
+  void clear_has_passageway_4_status();
+  void set_has_passageway_5_status();
+  void clear_has_passageway_5_status();
+  void set_has_passageway_6_status();
+  void clear_has_passageway_6_status();
+  void set_has_passageway_7_status();
+  void clear_has_passageway_7_status();
 
   // helper for ByteSizeLong()
   size_t RequiredFieldsByteSizeFallback() const;
@@ -554,13 +758,22 @@ class Dispatch_manager_status_msg : public ::google::protobuf::Message /* @@prot
   ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
   ::google::protobuf::internal::HasBits<1> _has_bits_;
   mutable int _cached_size_;
-  ::google::protobuf::RepeatedField<int> catcher_status_;
-  ::google::protobuf::RepeatedField<int> carrier_status_;
-  ::google::protobuf::RepeatedField<int> elevator_status_;
-  ::google::protobuf::RepeatedField<int> passageway_status_;
   ::message::Base_info* base_info_;
   ::google::protobuf::int32 dispatch_id_;
   int dispatch_manager_status_;
+  int robot_1_status_;
+  int robot_2_status_;
+  int carrier_1_status_;
+  int carrier_2_status_;
+  int carrier_3_status_;
+  int passageway_0_status_;
+  int passageway_1_status_;
+  int passageway_2_status_;
+  int passageway_3_status_;
+  int passageway_4_status_;
+  int passageway_5_status_;
+  int passageway_6_status_;
+  int passageway_7_status_;
   friend struct ::protobuf_dispatch_5fmessage_2eproto::TableStruct;
   friend void ::protobuf_dispatch_5fmessage_2eproto::InitDefaultsDispatch_manager_status_msgImpl();
 };
@@ -608,7 +821,7 @@ class Dispatch_terminal_status_msg : public ::google::protobuf::Message /* @@pro
                &_Dispatch_terminal_status_msg_default_instance_);
   }
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
-    2;
+    3;
 
   void Swap(Dispatch_terminal_status_msg* other);
   friend void swap(Dispatch_terminal_status_msg& a, Dispatch_terminal_status_msg& b) {
@@ -753,7 +966,7 @@ class Dispatch_request_msg : public ::google::protobuf::Message /* @@protoc_inse
                &_Dispatch_request_msg_default_instance_);
   }
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
-    3;
+    4;
 
   void Swap(Dispatch_request_msg* other);
   friend void swap(Dispatch_request_msg& a, Dispatch_request_msg& b) {
@@ -930,7 +1143,7 @@ class Dispatch_response_msg : public ::google::protobuf::Message /* @@protoc_ins
                &_Dispatch_response_msg_default_instance_);
   }
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
-    4;
+    5;
 
   void Swap(Dispatch_response_msg* other);
   friend void swap(Dispatch_response_msg& a, Dispatch_response_msg& b) {
@@ -1116,6 +1329,10 @@ inline void Device_position::set_z(float value) {
 
 // -------------------------------------------------------------------
 
+// Dispatch_manager_data_msg
+
+// -------------------------------------------------------------------
+
 // Dispatch_manager_status_msg
 
 // required .message.Base_info base_info = 1;
@@ -1217,132 +1434,329 @@ inline void Dispatch_manager_status_msg::set_dispatch_manager_status(::message::
   // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.dispatch_manager_status)
 }
 
-// repeated .message.Catcher_status catcher_status = 4;
-inline int Dispatch_manager_status_msg::catcher_status_size() const {
-  return catcher_status_.size();
+// optional .message.Dispatch_device_status robot_1_status = 4;
+inline bool Dispatch_manager_status_msg::has_robot_1_status() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_robot_1_status() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void Dispatch_manager_status_msg::clear_has_robot_1_status() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void Dispatch_manager_status_msg::clear_robot_1_status() {
+  robot_1_status_ = 0;
+  clear_has_robot_1_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::robot_1_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.robot_1_status)
+  return static_cast< ::message::Dispatch_device_status >(robot_1_status_);
+}
+inline void Dispatch_manager_status_msg::set_robot_1_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_robot_1_status();
+  robot_1_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.robot_1_status)
+}
+
+// optional .message.Dispatch_device_status robot_2_status = 5;
+inline bool Dispatch_manager_status_msg::has_robot_2_status() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_robot_2_status() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void Dispatch_manager_status_msg::clear_has_robot_2_status() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void Dispatch_manager_status_msg::clear_robot_2_status() {
+  robot_2_status_ = 0;
+  clear_has_robot_2_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::robot_2_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.robot_2_status)
+  return static_cast< ::message::Dispatch_device_status >(robot_2_status_);
+}
+inline void Dispatch_manager_status_msg::set_robot_2_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_robot_2_status();
+  robot_2_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.robot_2_status)
+}
+
+// optional .message.Dispatch_device_status carrier_1_status = 6;
+inline bool Dispatch_manager_status_msg::has_carrier_1_status() const {
+  return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_carrier_1_status() {
+  _has_bits_[0] |= 0x00000020u;
+}
+inline void Dispatch_manager_status_msg::clear_has_carrier_1_status() {
+  _has_bits_[0] &= ~0x00000020u;
+}
+inline void Dispatch_manager_status_msg::clear_carrier_1_status() {
+  carrier_1_status_ = 0;
+  clear_has_carrier_1_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::carrier_1_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.carrier_1_status)
+  return static_cast< ::message::Dispatch_device_status >(carrier_1_status_);
+}
+inline void Dispatch_manager_status_msg::set_carrier_1_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_carrier_1_status();
+  carrier_1_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.carrier_1_status)
+}
+
+// optional .message.Dispatch_device_status carrier_2_status = 7;
+inline bool Dispatch_manager_status_msg::has_carrier_2_status() const {
+  return (_has_bits_[0] & 0x00000040u) != 0;
 }
-inline void Dispatch_manager_status_msg::clear_catcher_status() {
-  catcher_status_.Clear();
+inline void Dispatch_manager_status_msg::set_has_carrier_2_status() {
+  _has_bits_[0] |= 0x00000040u;
 }
-inline ::message::Catcher_status Dispatch_manager_status_msg::catcher_status(int index) const {
-  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.catcher_status)
-  return static_cast< ::message::Catcher_status >(catcher_status_.Get(index));
+inline void Dispatch_manager_status_msg::clear_has_carrier_2_status() {
+  _has_bits_[0] &= ~0x00000040u;
 }
-inline void Dispatch_manager_status_msg::set_catcher_status(int index, ::message::Catcher_status value) {
-  assert(::message::Catcher_status_IsValid(value));
-  catcher_status_.Set(index, value);
-  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.catcher_status)
+inline void Dispatch_manager_status_msg::clear_carrier_2_status() {
+  carrier_2_status_ = 0;
+  clear_has_carrier_2_status();
 }
-inline void Dispatch_manager_status_msg::add_catcher_status(::message::Catcher_status value) {
-  assert(::message::Catcher_status_IsValid(value));
-  catcher_status_.Add(value);
-  // @@protoc_insertion_point(field_add:message.Dispatch_manager_status_msg.catcher_status)
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::carrier_2_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.carrier_2_status)
+  return static_cast< ::message::Dispatch_device_status >(carrier_2_status_);
 }
-inline const ::google::protobuf::RepeatedField<int>&
-Dispatch_manager_status_msg::catcher_status() const {
-  // @@protoc_insertion_point(field_list:message.Dispatch_manager_status_msg.catcher_status)
-  return catcher_status_;
+inline void Dispatch_manager_status_msg::set_carrier_2_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_carrier_2_status();
+  carrier_2_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.carrier_2_status)
 }
-inline ::google::protobuf::RepeatedField<int>*
-Dispatch_manager_status_msg::mutable_catcher_status() {
-  // @@protoc_insertion_point(field_mutable_list:message.Dispatch_manager_status_msg.catcher_status)
-  return &catcher_status_;
+
+// optional .message.Dispatch_device_status carrier_3_status = 8;
+inline bool Dispatch_manager_status_msg::has_carrier_3_status() const {
+  return (_has_bits_[0] & 0x00000080u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_carrier_3_status() {
+  _has_bits_[0] |= 0x00000080u;
+}
+inline void Dispatch_manager_status_msg::clear_has_carrier_3_status() {
+  _has_bits_[0] &= ~0x00000080u;
+}
+inline void Dispatch_manager_status_msg::clear_carrier_3_status() {
+  carrier_3_status_ = 0;
+  clear_has_carrier_3_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::carrier_3_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.carrier_3_status)
+  return static_cast< ::message::Dispatch_device_status >(carrier_3_status_);
+}
+inline void Dispatch_manager_status_msg::set_carrier_3_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_carrier_3_status();
+  carrier_3_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.carrier_3_status)
 }
 
-// repeated .message.Carrier_status carrier_status = 5;
-inline int Dispatch_manager_status_msg::carrier_status_size() const {
-  return carrier_status_.size();
+// optional .message.Dispatch_device_status passageway_0_status = 9;
+inline bool Dispatch_manager_status_msg::has_passageway_0_status() const {
+  return (_has_bits_[0] & 0x00000100u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_0_status() {
+  _has_bits_[0] |= 0x00000100u;
+}
+inline void Dispatch_manager_status_msg::clear_has_passageway_0_status() {
+  _has_bits_[0] &= ~0x00000100u;
+}
+inline void Dispatch_manager_status_msg::clear_passageway_0_status() {
+  passageway_0_status_ = 0;
+  clear_has_passageway_0_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_0_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_0_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_0_status_);
+}
+inline void Dispatch_manager_status_msg::set_passageway_0_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_0_status();
+  passageway_0_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_0_status)
+}
+
+// optional .message.Dispatch_device_status passageway_1_status = 10;
+inline bool Dispatch_manager_status_msg::has_passageway_1_status() const {
+  return (_has_bits_[0] & 0x00000200u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_1_status() {
+  _has_bits_[0] |= 0x00000200u;
+}
+inline void Dispatch_manager_status_msg::clear_has_passageway_1_status() {
+  _has_bits_[0] &= ~0x00000200u;
+}
+inline void Dispatch_manager_status_msg::clear_passageway_1_status() {
+  passageway_1_status_ = 0;
+  clear_has_passageway_1_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_1_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_1_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_1_status_);
+}
+inline void Dispatch_manager_status_msg::set_passageway_1_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_1_status();
+  passageway_1_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_1_status)
+}
+
+// optional .message.Dispatch_device_status passageway_2_status = 11;
+inline bool Dispatch_manager_status_msg::has_passageway_2_status() const {
+  return (_has_bits_[0] & 0x00000400u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_2_status() {
+  _has_bits_[0] |= 0x00000400u;
 }
-inline void Dispatch_manager_status_msg::clear_carrier_status() {
-  carrier_status_.Clear();
+inline void Dispatch_manager_status_msg::clear_has_passageway_2_status() {
+  _has_bits_[0] &= ~0x00000400u;
 }
-inline ::message::Carrier_status Dispatch_manager_status_msg::carrier_status(int index) const {
-  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.carrier_status)
-  return static_cast< ::message::Carrier_status >(carrier_status_.Get(index));
+inline void Dispatch_manager_status_msg::clear_passageway_2_status() {
+  passageway_2_status_ = 0;
+  clear_has_passageway_2_status();
 }
-inline void Dispatch_manager_status_msg::set_carrier_status(int index, ::message::Carrier_status value) {
-  assert(::message::Carrier_status_IsValid(value));
-  carrier_status_.Set(index, value);
-  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.carrier_status)
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_2_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_2_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_2_status_);
 }
-inline void Dispatch_manager_status_msg::add_carrier_status(::message::Carrier_status value) {
-  assert(::message::Carrier_status_IsValid(value));
-  carrier_status_.Add(value);
-  // @@protoc_insertion_point(field_add:message.Dispatch_manager_status_msg.carrier_status)
+inline void Dispatch_manager_status_msg::set_passageway_2_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_2_status();
+  passageway_2_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_2_status)
 }
-inline const ::google::protobuf::RepeatedField<int>&
-Dispatch_manager_status_msg::carrier_status() const {
-  // @@protoc_insertion_point(field_list:message.Dispatch_manager_status_msg.carrier_status)
-  return carrier_status_;
+
+// optional .message.Dispatch_device_status passageway_3_status = 12;
+inline bool Dispatch_manager_status_msg::has_passageway_3_status() const {
+  return (_has_bits_[0] & 0x00000800u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_3_status() {
+  _has_bits_[0] |= 0x00000800u;
+}
+inline void Dispatch_manager_status_msg::clear_has_passageway_3_status() {
+  _has_bits_[0] &= ~0x00000800u;
 }
-inline ::google::protobuf::RepeatedField<int>*
-Dispatch_manager_status_msg::mutable_carrier_status() {
-  // @@protoc_insertion_point(field_mutable_list:message.Dispatch_manager_status_msg.carrier_status)
-  return &carrier_status_;
+inline void Dispatch_manager_status_msg::clear_passageway_3_status() {
+  passageway_3_status_ = 0;
+  clear_has_passageway_3_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_3_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_3_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_3_status_);
+}
+inline void Dispatch_manager_status_msg::set_passageway_3_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_3_status();
+  passageway_3_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_3_status)
 }
 
-// repeated .message.Elevator_status elevator_status = 6;
-inline int Dispatch_manager_status_msg::elevator_status_size() const {
-  return elevator_status_.size();
+// optional .message.Dispatch_device_status passageway_4_status = 13;
+inline bool Dispatch_manager_status_msg::has_passageway_4_status() const {
+  return (_has_bits_[0] & 0x00001000u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_4_status() {
+  _has_bits_[0] |= 0x00001000u;
 }
-inline void Dispatch_manager_status_msg::clear_elevator_status() {
-  elevator_status_.Clear();
+inline void Dispatch_manager_status_msg::clear_has_passageway_4_status() {
+  _has_bits_[0] &= ~0x00001000u;
+}
+inline void Dispatch_manager_status_msg::clear_passageway_4_status() {
+  passageway_4_status_ = 0;
+  clear_has_passageway_4_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_4_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_4_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_4_status_);
+}
+inline void Dispatch_manager_status_msg::set_passageway_4_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_4_status();
+  passageway_4_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_4_status)
+}
+
+// optional .message.Dispatch_device_status passageway_5_status = 14;
+inline bool Dispatch_manager_status_msg::has_passageway_5_status() const {
+  return (_has_bits_[0] & 0x00002000u) != 0;
 }
-inline ::message::Elevator_status Dispatch_manager_status_msg::elevator_status(int index) const {
-  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.elevator_status)
-  return static_cast< ::message::Elevator_status >(elevator_status_.Get(index));
+inline void Dispatch_manager_status_msg::set_has_passageway_5_status() {
+  _has_bits_[0] |= 0x00002000u;
 }
-inline void Dispatch_manager_status_msg::set_elevator_status(int index, ::message::Elevator_status value) {
-  assert(::message::Elevator_status_IsValid(value));
-  elevator_status_.Set(index, value);
-  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.elevator_status)
+inline void Dispatch_manager_status_msg::clear_has_passageway_5_status() {
+  _has_bits_[0] &= ~0x00002000u;
 }
-inline void Dispatch_manager_status_msg::add_elevator_status(::message::Elevator_status value) {
-  assert(::message::Elevator_status_IsValid(value));
-  elevator_status_.Add(value);
-  // @@protoc_insertion_point(field_add:message.Dispatch_manager_status_msg.elevator_status)
+inline void Dispatch_manager_status_msg::clear_passageway_5_status() {
+  passageway_5_status_ = 0;
+  clear_has_passageway_5_status();
 }
-inline const ::google::protobuf::RepeatedField<int>&
-Dispatch_manager_status_msg::elevator_status() const {
-  // @@protoc_insertion_point(field_list:message.Dispatch_manager_status_msg.elevator_status)
-  return elevator_status_;
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_5_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_5_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_5_status_);
 }
-inline ::google::protobuf::RepeatedField<int>*
-Dispatch_manager_status_msg::mutable_elevator_status() {
-  // @@protoc_insertion_point(field_mutable_list:message.Dispatch_manager_status_msg.elevator_status)
-  return &elevator_status_;
+inline void Dispatch_manager_status_msg::set_passageway_5_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_5_status();
+  passageway_5_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_5_status)
 }
 
-// repeated .message.Passageway_status passageway_status = 7;
-inline int Dispatch_manager_status_msg::passageway_status_size() const {
-  return passageway_status_.size();
+// optional .message.Dispatch_device_status passageway_6_status = 15;
+inline bool Dispatch_manager_status_msg::has_passageway_6_status() const {
+  return (_has_bits_[0] & 0x00004000u) != 0;
 }
-inline void Dispatch_manager_status_msg::clear_passageway_status() {
-  passageway_status_.Clear();
+inline void Dispatch_manager_status_msg::set_has_passageway_6_status() {
+  _has_bits_[0] |= 0x00004000u;
 }
-inline ::message::Passageway_status Dispatch_manager_status_msg::passageway_status(int index) const {
-  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_status)
-  return static_cast< ::message::Passageway_status >(passageway_status_.Get(index));
+inline void Dispatch_manager_status_msg::clear_has_passageway_6_status() {
+  _has_bits_[0] &= ~0x00004000u;
 }
-inline void Dispatch_manager_status_msg::set_passageway_status(int index, ::message::Passageway_status value) {
-  assert(::message::Passageway_status_IsValid(value));
-  passageway_status_.Set(index, value);
-  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_status)
+inline void Dispatch_manager_status_msg::clear_passageway_6_status() {
+  passageway_6_status_ = 0;
+  clear_has_passageway_6_status();
 }
-inline void Dispatch_manager_status_msg::add_passageway_status(::message::Passageway_status value) {
-  assert(::message::Passageway_status_IsValid(value));
-  passageway_status_.Add(value);
-  // @@protoc_insertion_point(field_add:message.Dispatch_manager_status_msg.passageway_status)
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_6_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_6_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_6_status_);
 }
-inline const ::google::protobuf::RepeatedField<int>&
-Dispatch_manager_status_msg::passageway_status() const {
-  // @@protoc_insertion_point(field_list:message.Dispatch_manager_status_msg.passageway_status)
-  return passageway_status_;
+inline void Dispatch_manager_status_msg::set_passageway_6_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_6_status();
+  passageway_6_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_6_status)
 }
-inline ::google::protobuf::RepeatedField<int>*
-Dispatch_manager_status_msg::mutable_passageway_status() {
-  // @@protoc_insertion_point(field_mutable_list:message.Dispatch_manager_status_msg.passageway_status)
-  return &passageway_status_;
+
+// optional .message.Dispatch_device_status passageway_7_status = 16;
+inline bool Dispatch_manager_status_msg::has_passageway_7_status() const {
+  return (_has_bits_[0] & 0x00008000u) != 0;
+}
+inline void Dispatch_manager_status_msg::set_has_passageway_7_status() {
+  _has_bits_[0] |= 0x00008000u;
+}
+inline void Dispatch_manager_status_msg::clear_has_passageway_7_status() {
+  _has_bits_[0] &= ~0x00008000u;
+}
+inline void Dispatch_manager_status_msg::clear_passageway_7_status() {
+  passageway_7_status_ = 0;
+  clear_has_passageway_7_status();
+}
+inline ::message::Dispatch_device_status Dispatch_manager_status_msg::passageway_7_status() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_manager_status_msg.passageway_7_status)
+  return static_cast< ::message::Dispatch_device_status >(passageway_7_status_);
+}
+inline void Dispatch_manager_status_msg::set_passageway_7_status(::message::Dispatch_device_status value) {
+  assert(::message::Dispatch_device_status_IsValid(value));
+  set_has_passageway_7_status();
+  passageway_7_status_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_manager_status_msg.passageway_7_status)
 }
 
 // -------------------------------------------------------------------
@@ -1917,6 +2331,8 @@ inline void Dispatch_response_msg::set_allocated_error_manager(::message::Error_
 
 // -------------------------------------------------------------------
 
+// -------------------------------------------------------------------
+
 
 // @@protoc_insertion_point(namespace_scope)
 
@@ -1965,6 +2381,11 @@ template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Dispatch_motion_direction>() {
   return ::message::Dispatch_motion_direction_descriptor();
 }
+template <> struct is_proto_enum< ::message::Dispatch_device_status> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Dispatch_device_status>() {
+  return ::message::Dispatch_device_status_descriptor();
+}
 
 }  // namespace protobuf
 }  // namespace google

+ 41 - 4
message/dispatch_message.proto

@@ -91,17 +91,54 @@ enum Dispatch_motion_direction
     E_PICKUP_CAR            =1;         //取车, 停车位 -> 出入口
 }
 
+
+
+
+
+
+//调度设备的类型
+enum Dispatch_device_status
+{
+    DISPATCH_DEVICE_UNKNOW              = 0;           //调度设备 未知(没有初始化的默认状态)
+    DISPATCH_DEVICE_READY               = 1;           //调度设备 空闲(待机准备状态)
+    DISPATCH_DEVICE_BUSY                = 2;           //调度设备 正忙(工作中)
+
+    DISPATCH_DEVICE_FAULT               = 10;          //调度设备 故障
+}
+
+
+//调度管理的设备详细的数据信息
+message Dispatch_manager_data_msg
+{
+    //后续再加
+}
+
+
+
 //调度管理总管理的状态
 message Dispatch_manager_status_msg
 {
     required Base_info                  base_info=1;                    //消息类型
     required int32                      dispatch_id=2;                  //调度管理模块 id
+
     required Dispatch_manager_status    dispatch_manager_status = 3;    //调度管理模块 状态
 
-    repeated Catcher_status             catcher_status = 4;             //抓车器状态, 楚天项目就是AGV系统
-    repeated Carrier_status             carrier_status = 5;             //搬运器状态, 楚天项目就是中跑车
-    repeated Elevator_status            elevator_status = 6;            //升降机状态, 楚天项目就是电梯
-    repeated Passageway_status          passageway_status = 7;          //通道口状态, 楚天项目就是一楼的出入口
+    optional Dispatch_device_status              robot_1_status=4;         //中间的大型机器手   (可以负责1~6号出入口的停车和取车)
+    optional Dispatch_device_status              robot_2_status=5;         //一号出口的专用机器手(只能负责1号出口的取车)(目前没有安装,暂时不考虑)
+
+    optional Dispatch_device_status              carrier_1_status=6;       //左侧0号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    optional Dispatch_device_status              carrier_2_status=7;       //右侧7号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    optional Dispatch_device_status              carrier_3_status=8;       //中间3楼的搬运器(中跑车 小跑车 二合一为搬运器)(没有电梯, 只能在3楼活动)
+
+    optional Dispatch_device_status              passageway_0_status=9;         //0号出口(在左侧电梯井, 只能取车)(暂时不存在)
+    optional Dispatch_device_status              passageway_1_status=10;         //1号出入口
+    optional Dispatch_device_status              passageway_2_status=11;         //2号出入口
+    optional Dispatch_device_status              passageway_3_status=12;         //3号出入口
+    optional Dispatch_device_status              passageway_4_status=13;         //4号出入口
+    optional Dispatch_device_status              passageway_5_status=14;         //5号出入口
+    optional Dispatch_device_status              passageway_6_status=15;         //6号出入口
+    optional Dispatch_device_status              passageway_7_status=16;         //7号出口(在右侧电梯井, 只能取车)
+
 }
 
 //调度模块终端出入口的状态

+ 245 - 66
message/message_base.pb.cc

@@ -181,7 +181,7 @@ void InitDefaultsParkspace_info() {
 }
 
 ::google::protobuf::Metadata file_level_metadata[6];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[8];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[10];
 
 const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Base_info, _has_bits_),
@@ -270,9 +270,12 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, entry_time_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, leave_time_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, block_id_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, parkspace_path_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, path_estimate_time_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Parkspace_info, parkspace_status_target_),
   3,
   4,
-  11,
+  13,
   5,
   6,
   7,
@@ -282,6 +285,9 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
   0,
   1,
   10,
+  14,
+  11,
+  12,
 };
 static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   { 0, 9, sizeof(::message::Base_info)},
@@ -289,7 +295,7 @@ static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROT
   { 20, 28, sizeof(::message::Error_manager)},
   { 31, 46, sizeof(::message::Locate_information)},
   { 56, 65, sizeof(::message::Car_info)},
-  { 69, 86, sizeof(::message::Parkspace_info)},
+  { 69, 89, sizeof(::message::Parkspace_info)},
 };
 
 static ::google::protobuf::Message const * const file_default_instances[] = {
@@ -340,64 +346,77 @@ void AddDescriptorsImpl() {
       "rect\030\t \001(\010\022\032\n\022locate_front_theta\030\n \001(\002\"V"
       "\n\010Car_info\022\022\n\ncar_length\030\001 \001(\002\022\021\n\tcar_wi"
       "dth\030\002 \001(\002\022\022\n\ncar_height\030\003 \001(\002\022\017\n\007license"
-      "\030\004 \001(\t\"\256\002\n\016Parkspace_info\022\024\n\014parkspace_i"
+      "\030\004 \001(\t\"\267\003\n\016Parkspace_info\022\024\n\014parkspace_i"
       "d\030\001 \001(\005\022\r\n\005index\030\002 \001(\005\022%\n\tdirection\030\003 \001("
       "\0162\022.message.Direction\022\r\n\005floor\030\004 \001(\005\022\016\n\006"
       "length\030\005 \001(\002\022\r\n\005width\030\006 \001(\002\022\016\n\006height\030\007 "
       "\001(\002\0223\n\020parkspace_status\030\010 \001(\0162\031.message."
       "Parkspace_status\022#\n\010car_info\030\t \001(\0132\021.mes"
       "sage.Car_info\022\022\n\nentry_time\030\n \001(\t\022\022\n\nlea"
-      "ve_time\030\013 \001(\t\022\020\n\010block_id\030\014 \001(\005*\350\007\n\014Mess"
-      "age_type\022\r\n\teBase_msg\020\000\022\020\n\014eCommand_msg\020"
-      "\001\022\026\n\022eLocate_status_msg\020\021\022\027\n\023eLocate_req"
-      "uest_msg\020\022\022\030\n\024eLocate_response_msg\020\023\022\034\n\030"
-      "eLocate_sift_request_msg\020\024\022\035\n\031eLocate_si"
-      "ft_response_msg\020\025\022\030\n\024eDispatch_status_ms"
-      "g\020!\022\031\n\025eDispatch_request_msg\020\"\022\032\n\026eDispa"
-      "tch_response_msg\020#\022$\n eParkspace_allocat"
-      "ion_status_msg\0201\022%\n!eParkspace_allocatio"
-      "n_request_msg\0202\022&\n\"eParkspace_allocation"
-      "_response_msg\0203\022!\n\035eParkspace_search_req"
-      "uest_msg\0204\022\"\n\036eParkspace_search_response"
-      "_msg\0205\022\"\n\036eParkspace_release_request_msg"
-      "\0206\022#\n\037eParkspace_release_response_msg\0207\022"
-      "\'\n#eParkspace_force_update_request_msg\0208"
-      "\022(\n$eParkspace_force_update_response_msg"
-      "\0209\022(\n$eParkspace_confirm_alloc_request_m"
-      "sg\020:\022)\n%eParkspace_confirm_alloc_respons"
-      "e_msg\020;\022\036\n\032eStore_command_request_msg\020A\022"
-      "\037\n\033eStore_command_response_msg\020B\022\037\n\033ePic"
-      "kup_command_request_msg\020C\022 \n\034ePickup_com"
-      "mand_response_msg\020D\022\037\n\032eStoring_process_"
-      "statu_msg\020\220\001\022\037\n\032ePicking_process_statu_m"
-      "sg\020\221\001\022\"\n\035eCentral_controller_statu_msg\020\240"
-      "\001\022#\n\036eEntrance_manual_operation_msg\020\260\001\022\""
-      "\n\035eProcess_manual_operation_msg\020\261\001*\202\001\n\014C"
-      "ommunicator\022\n\n\006eEmpty\020\000\022\t\n\005eMain\020\001\022\016\n\teT"
-      "erminor\020\200\002\022\017\n\neParkspace\020\200\004\022\016\n\teMeasurer"
-      "\020\200\006\022\032\n\025eMeasurer_sift_server\020\201\006\022\016\n\teDisp"
-      "atch\020\200\010**\n\014Process_type\022\014\n\010eStoring\020\001\022\014\n"
-      "\010ePicking\020\002*e\n\013Error_level\022\n\n\006NORMAL\020\000\022\024"
-      "\n\020NEGLIGIBLE_ERROR\020\001\022\017\n\013MINOR_ERROR\020\002\022\017\n"
-      "\013MAJOR_ERROR\020\003\022\022\n\016CRITICAL_ERROR\020\004*q\n\020Pa"
-      "rkspace_status\022\024\n\020eParkspace_empty\020\000\022\027\n\023"
-      "eParkspace_occupied\020\001\022\030\n\024eParkspace_rese"
-      "rverd\020\002\022\024\n\020eParkspace_error\020\003*(\n\tDirecti"
-      "on\022\014\n\010eForward\020\001\022\r\n\teBackward\020\002*\335\002\n\tStep"
-      "_type\022\017\n\013eAlloc_step\020\000\022\021\n\reMeasure_step\020"
-      "\001\022\021\n\reCompare_step\020\002\022\022\n\016eDispatch_step\020\003"
-      "\022\021\n\reConfirm_step\020\004\022\020\n\014eSearch_step\020\005\022\016\n"
-      "\neWait_step\020\006\022\021\n\reRelease_step\020\007\022\r\n\teCom"
-      "plete\020\010\022\025\n\021eBackConfirm_step\020\t\022\026\n\022eBack_"
-      "compare_step\020\n\022\025\n\021eBackMeasure_step\020\013\022\023\n"
-      "\017eBackAlloc_step\020\014\022\022\n\016eBackWait_step\020\r\022\026"
-      "\n\022eBackDispatch_step\020\016\022\024\n\020eBackSearch_st"
-      "ep\020\017\022\021\n\reBackComplete\020\020*C\n\nStep_statu\022\014\n"
-      "\010eWaiting\020\000\022\014\n\010eWorking\020\001\022\n\n\006eError\020\002\022\r\n"
-      "\teFinished\020\003"
+      "ve_time\030\013 \001(\t\022\020\n\010block_id\030\014 \001(\005\022/\n\016parks"
+      "pace_path\030\r \001(\0162\027.message.Parkspace_path"
+      "\022\032\n\022path_estimate_time\030\016 \001(\002\022:\n\027parkspac"
+      "e_status_target\030\017 \001(\0162\031.message.Parkspac"
+      "e_status*\270\t\n\014Message_type\022\r\n\teBase_msg\020\000"
+      "\022\020\n\014eCommand_msg\020\001\022\026\n\022eLocate_status_msg"
+      "\020\021\022\027\n\023eLocate_request_msg\020\022\022\030\n\024eLocate_r"
+      "esponse_msg\020\023\022\034\n\030eLocate_sift_request_ms"
+      "g\020\024\022\035\n\031eLocate_sift_response_msg\020\025\022\030\n\024eD"
+      "ispatch_status_msg\020!\022\031\n\025eDispatch_reques"
+      "t_msg\020\"\022\032\n\026eDispatch_response_msg\020#\022$\n e"
+      "Parkspace_allocation_status_msg\0201\022%\n!ePa"
+      "rkspace_allocation_request_msg\0202\022&\n\"ePar"
+      "kspace_allocation_response_msg\0203\022!\n\035ePar"
+      "kspace_search_request_msg\0204\022\"\n\036eParkspac"
+      "e_search_response_msg\0205\022\"\n\036eParkspace_re"
+      "lease_request_msg\0206\022#\n\037eParkspace_releas"
+      "e_response_msg\0207\022\'\n#eParkspace_force_upd"
+      "ate_request_msg\0208\022(\n$eParkspace_force_up"
+      "date_response_msg\0209\022(\n$eParkspace_confir"
+      "m_alloc_request_msg\020:\022)\n%eParkspace_conf"
+      "irm_alloc_response_msg\020;\022\036\n\032eStore_comma"
+      "nd_request_msg\020A\022\037\n\033eStore_command_respo"
+      "nse_msg\020B\022\037\n\033ePickup_command_request_msg"
+      "\020C\022 \n\034ePickup_command_response_msg\020D\022\037\n\032"
+      "eStoring_process_statu_msg\020\220\001\022\037\n\032ePickin"
+      "g_process_statu_msg\020\221\001\022\"\n\035eCentral_contr"
+      "oller_statu_msg\020\240\001\022#\n\036eEntrance_manual_o"
+      "peration_msg\020\260\001\022\"\n\035eProcess_manual_opera"
+      "tion_msg\020\261\001\022\037\n\032eDispatch_plan_request_ms"
+      "g\020\340\001\022 \n\033eDispatch_plan_response_msg\020\341\001\022\""
+      "\n\035eDispatch_control_request_msg\020\342\001\022#\n\036eD"
+      "ispatch_control_response_msg\020\343\001\022!\n\034eDisp"
+      "atch_manager_status_msg\020\352\001\022\037\n\032eDispatch_"
+      "manager_data_msg\020\353\001*\202\001\n\014Communicator\022\n\n\006"
+      "eEmpty\020\000\022\t\n\005eMain\020\001\022\016\n\teTerminor\020\200\002\022\017\n\ne"
+      "Parkspace\020\200\004\022\016\n\teMeasurer\020\200\006\022\032\n\025eMeasure"
+      "r_sift_server\020\201\006\022\016\n\teDispatch\020\200\010**\n\014Proc"
+      "ess_type\022\014\n\010eStoring\020\001\022\014\n\010ePicking\020\002*e\n\013"
+      "Error_level\022\n\n\006NORMAL\020\000\022\024\n\020NEGLIGIBLE_ER"
+      "ROR\020\001\022\017\n\013MINOR_ERROR\020\002\022\017\n\013MAJOR_ERROR\020\003\022"
+      "\022\n\016CRITICAL_ERROR\020\004*\207\001\n\020Parkspace_status"
+      "\022\024\n\020eParkspace_empty\020\000\022\027\n\023eParkspace_occ"
+      "upied\020\001\022\027\n\023eParkspace_reserved\020\002\022\025\n\021ePar"
+      "kspace_locked\020\003\022\024\n\020eParkspace_error\020\004*(\n"
+      "\tDirection\022\014\n\010eForward\020\001\022\r\n\teBackward\020\002*"
+      "[\n\016Parkspace_path\022\020\n\014OPTIMAL_PATH\020\001\022\r\n\tL"
+      "EFT_PATH\020\002\022\016\n\nRIGHT_PATH\020\003\022\030\n\024TEMPORARY_"
+      "CACHE_PATH\020\004*R\n\016Parkspace_type\022\024\n\020MIN_PA"
+      "RKINGSPACE\020\001\022\024\n\020MID_PARKINGSPACE\020\002\022\024\n\020BI"
+      "G_PARKINGSPACE\020\003*\335\002\n\tStep_type\022\017\n\013eAlloc"
+      "_step\020\000\022\021\n\reMeasure_step\020\001\022\021\n\reCompare_s"
+      "tep\020\002\022\022\n\016eDispatch_step\020\003\022\021\n\reConfirm_st"
+      "ep\020\004\022\020\n\014eSearch_step\020\005\022\016\n\neWait_step\020\006\022\021"
+      "\n\reRelease_step\020\007\022\r\n\teComplete\020\010\022\025\n\021eBac"
+      "kConfirm_step\020\t\022\026\n\022eBack_compare_step\020\n\022"
+      "\025\n\021eBackMeasure_step\020\013\022\023\n\017eBackAlloc_ste"
+      "p\020\014\022\022\n\016eBackWait_step\020\r\022\026\n\022eBackDispatch"
+      "_step\020\016\022\024\n\020eBackSearch_step\020\017\022\021\n\reBackCo"
+      "mplete\020\020*C\n\nStep_statu\022\014\n\010eWaiting\020\000\022\014\n\010"
+      "eWorking\020\001\022\n\n\006eError\020\002\022\r\n\teFinished\020\003"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 2852);
+      descriptor, 3397);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "message_base.proto", &protobuf_RegisterTypes);
 }
@@ -450,6 +469,12 @@ bool Message_type_IsValid(int value) {
     case 160:
     case 176:
     case 177:
+    case 224:
+    case 225:
+    case 226:
+    case 227:
+    case 234:
+    case 235:
       return true;
     default:
       return false;
@@ -516,6 +541,7 @@ bool Parkspace_status_IsValid(int value) {
     case 1:
     case 2:
     case 3:
+    case 4:
       return true;
     default:
       return false;
@@ -536,10 +562,41 @@ bool Direction_IsValid(int value) {
   }
 }
 
-const ::google::protobuf::EnumDescriptor* Step_type_descriptor() {
+const ::google::protobuf::EnumDescriptor* Parkspace_path_descriptor() {
   protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
   return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[6];
 }
+bool Parkspace_path_IsValid(int value) {
+  switch (value) {
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* Parkspace_type_descriptor() {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[7];
+}
+bool Parkspace_type_IsValid(int value) {
+  switch (value) {
+    case 1:
+    case 2:
+    case 3:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* Step_type_descriptor() {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[8];
+}
 bool Step_type_IsValid(int value) {
   switch (value) {
     case 0:
@@ -567,7 +624,7 @@ bool Step_type_IsValid(int value) {
 
 const ::google::protobuf::EnumDescriptor* Step_statu_descriptor() {
   protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
-  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[7];
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[9];
 }
 bool Step_statu_IsValid(int value) {
   switch (value) {
@@ -2582,6 +2639,9 @@ const int Parkspace_info::kCarInfoFieldNumber;
 const int Parkspace_info::kEntryTimeFieldNumber;
 const int Parkspace_info::kLeaveTimeFieldNumber;
 const int Parkspace_info::kBlockIdFieldNumber;
+const int Parkspace_info::kParkspacePathFieldNumber;
+const int Parkspace_info::kPathEstimateTimeFieldNumber;
+const int Parkspace_info::kParkspaceStatusTargetFieldNumber;
 #endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
 
 Parkspace_info::Parkspace_info()
@@ -2612,8 +2672,8 @@ Parkspace_info::Parkspace_info(const Parkspace_info& from)
     car_info_ = NULL;
   }
   ::memcpy(&parkspace_id_, &from.parkspace_id_,
-    static_cast<size_t>(reinterpret_cast<char*>(&direction_) -
-    reinterpret_cast<char*>(&parkspace_id_)) + sizeof(direction_));
+    static_cast<size_t>(reinterpret_cast<char*>(&parkspace_path_) -
+    reinterpret_cast<char*>(&parkspace_id_)) + sizeof(parkspace_path_));
   // @@protoc_insertion_point(copy_constructor:message.Parkspace_info)
 }
 
@@ -2622,9 +2682,10 @@ void Parkspace_info::SharedCtor() {
   entry_time_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   leave_time_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   ::memset(&car_info_, 0, static_cast<size_t>(
-      reinterpret_cast<char*>(&block_id_) -
-      reinterpret_cast<char*>(&car_info_)) + sizeof(block_id_));
+      reinterpret_cast<char*>(&parkspace_status_target_) -
+      reinterpret_cast<char*>(&car_info_)) + sizeof(parkspace_status_target_));
   direction_ = 1;
+  parkspace_path_ = 1;
 }
 
 Parkspace_info::~Parkspace_info() {
@@ -2687,11 +2748,12 @@ void Parkspace_info::Clear() {
         reinterpret_cast<char*>(&width_) -
         reinterpret_cast<char*>(&parkspace_id_)) + sizeof(width_));
   }
-  if (cached_has_bits & 3840u) {
+  if (cached_has_bits & 32512u) {
     ::memset(&height_, 0, static_cast<size_t>(
-        reinterpret_cast<char*>(&block_id_) -
-        reinterpret_cast<char*>(&height_)) + sizeof(block_id_));
+        reinterpret_cast<char*>(&parkspace_status_target_) -
+        reinterpret_cast<char*>(&height_)) + sizeof(parkspace_status_target_));
     direction_ = 1;
+    parkspace_path_ = 1;
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -2889,6 +2951,60 @@ bool Parkspace_info::MergePartialFromCodedStream(
         break;
       }
 
+      // optional .message.Parkspace_path parkspace_path = 13;
+      case 13: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(104u /* 104 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Parkspace_path_IsValid(value)) {
+            set_parkspace_path(static_cast< ::message::Parkspace_path >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                13, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // optional float path_estimate_time = 14;
+      case 14: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(117u /* 117 & 0xFF */)) {
+          set_has_path_estimate_time();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
+                 input, &path_estimate_time_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // optional .message.Parkspace_status parkspace_status_target = 15;
+      case 15: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(120u /* 120 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Parkspace_status_IsValid(value)) {
+            set_parkspace_status_target(static_cast< ::message::Parkspace_status >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                15, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
       default: {
       handle_unusual:
         if (tag == 0) {
@@ -2927,7 +3043,7 @@ void Parkspace_info::SerializeWithCachedSizes(
   }
 
   // optional .message.Direction direction = 3;
-  if (cached_has_bits & 0x00000800u) {
+  if (cached_has_bits & 0x00002000u) {
     ::google::protobuf::internal::WireFormatLite::WriteEnum(
       3, this->direction(), output);
   }
@@ -2989,6 +3105,23 @@ void Parkspace_info::SerializeWithCachedSizes(
     ::google::protobuf::internal::WireFormatLite::WriteInt32(12, this->block_id(), output);
   }
 
+  // optional .message.Parkspace_path parkspace_path = 13;
+  if (cached_has_bits & 0x00004000u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      13, this->parkspace_path(), output);
+  }
+
+  // optional float path_estimate_time = 14;
+  if (cached_has_bits & 0x00000800u) {
+    ::google::protobuf::internal::WireFormatLite::WriteFloat(14, this->path_estimate_time(), output);
+  }
+
+  // optional .message.Parkspace_status parkspace_status_target = 15;
+  if (cached_has_bits & 0x00001000u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      15, this->parkspace_status_target(), output);
+  }
+
   if (_internal_metadata_.have_unknown_fields()) {
     ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
         _internal_metadata_.unknown_fields(), output);
@@ -3015,7 +3148,7 @@ void Parkspace_info::SerializeWithCachedSizes(
   }
 
   // optional .message.Direction direction = 3;
-  if (cached_has_bits & 0x00000800u) {
+  if (cached_has_bits & 0x00002000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
       3, this->direction(), target);
   }
@@ -3080,6 +3213,23 @@ void Parkspace_info::SerializeWithCachedSizes(
     target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(12, this->block_id(), target);
   }
 
+  // optional .message.Parkspace_path parkspace_path = 13;
+  if (cached_has_bits & 0x00004000u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      13, this->parkspace_path(), target);
+  }
+
+  // optional float path_estimate_time = 14;
+  if (cached_has_bits & 0x00000800u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(14, this->path_estimate_time(), target);
+  }
+
+  // optional .message.Parkspace_status parkspace_status_target = 15;
+  if (cached_has_bits & 0x00001000u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      15, this->parkspace_status_target(), target);
+  }
+
   if (_internal_metadata_.have_unknown_fields()) {
     target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
         _internal_metadata_.unknown_fields(), target);
@@ -3151,7 +3301,7 @@ size_t Parkspace_info::ByteSizeLong() const {
     }
 
   }
-  if (_has_bits_[8 / 32] & 3840u) {
+  if (_has_bits_[8 / 32] & 32512u) {
     // optional float height = 7;
     if (has_height()) {
       total_size += 1 + 4;
@@ -3170,12 +3320,29 @@ size_t Parkspace_info::ByteSizeLong() const {
           this->block_id());
     }
 
+    // optional float path_estimate_time = 14;
+    if (has_path_estimate_time()) {
+      total_size += 1 + 4;
+    }
+
+    // optional .message.Parkspace_status parkspace_status_target = 15;
+    if (has_parkspace_status_target()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->parkspace_status_target());
+    }
+
     // optional .message.Direction direction = 3;
     if (has_direction()) {
       total_size += 1 +
         ::google::protobuf::internal::WireFormatLite::EnumSize(this->direction());
     }
 
+    // optional .message.Parkspace_path parkspace_path = 13;
+    if (has_parkspace_path()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->parkspace_path());
+    }
+
   }
   int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
   GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -3236,7 +3403,7 @@ void Parkspace_info::MergeFrom(const Parkspace_info& from) {
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  if (cached_has_bits & 3840u) {
+  if (cached_has_bits & 32512u) {
     if (cached_has_bits & 0x00000100u) {
       height_ = from.height_;
     }
@@ -3247,8 +3414,17 @@ void Parkspace_info::MergeFrom(const Parkspace_info& from) {
       block_id_ = from.block_id_;
     }
     if (cached_has_bits & 0x00000800u) {
+      path_estimate_time_ = from.path_estimate_time_;
+    }
+    if (cached_has_bits & 0x00001000u) {
+      parkspace_status_target_ = from.parkspace_status_target_;
+    }
+    if (cached_has_bits & 0x00002000u) {
       direction_ = from.direction_;
     }
+    if (cached_has_bits & 0x00004000u) {
+      parkspace_path_ = from.parkspace_path_;
+    }
     _has_bits_[0] |= cached_has_bits;
   }
 }
@@ -3288,7 +3464,10 @@ void Parkspace_info::InternalSwap(Parkspace_info* other) {
   swap(height_, other->height_);
   swap(parkspace_status_, other->parkspace_status_);
   swap(block_id_, other->block_id_);
+  swap(path_estimate_time_, other->path_estimate_time_);
+  swap(parkspace_status_target_, other->parkspace_status_target_);
   swap(direction_, other->direction_);
+  swap(parkspace_path_, other->parkspace_path_);
   swap(_has_bits_[0], other->_has_bits_[0]);
   _internal_metadata_.Swap(&other->_internal_metadata_);
   swap(_cached_size_, other->_cached_size_);

+ 169 - 7
message/message_base.pb.h

@@ -116,11 +116,17 @@ enum Message_type {
   ePicking_process_statu_msg = 145,
   eCentral_controller_statu_msg = 160,
   eEntrance_manual_operation_msg = 176,
-  eProcess_manual_operation_msg = 177
+  eProcess_manual_operation_msg = 177,
+  eDispatch_plan_request_msg = 224,
+  eDispatch_plan_response_msg = 225,
+  eDispatch_control_request_msg = 226,
+  eDispatch_control_response_msg = 227,
+  eDispatch_manager_status_msg = 234,
+  eDispatch_manager_data_msg = 235
 };
 bool Message_type_IsValid(int value);
 const Message_type Message_type_MIN = eBase_msg;
-const Message_type Message_type_MAX = eProcess_manual_operation_msg;
+const Message_type Message_type_MAX = eDispatch_manager_data_msg;
 const int Message_type_ARRAYSIZE = Message_type_MAX + 1;
 
 const ::google::protobuf::EnumDescriptor* Message_type_descriptor();
@@ -201,8 +207,9 @@ inline bool Error_level_Parse(
 enum Parkspace_status {
   eParkspace_empty = 0,
   eParkspace_occupied = 1,
-  eParkspace_reserverd = 2,
-  eParkspace_error = 3
+  eParkspace_reserved = 2,
+  eParkspace_locked = 3,
+  eParkspace_error = 4
 };
 bool Parkspace_status_IsValid(int value);
 const Parkspace_status Parkspace_status_MIN = eParkspace_empty;
@@ -238,6 +245,47 @@ inline bool Direction_Parse(
   return ::google::protobuf::internal::ParseNamedEnum<Direction>(
     Direction_descriptor(), name, value);
 }
+enum Parkspace_path {
+  OPTIMAL_PATH = 1,
+  LEFT_PATH = 2,
+  RIGHT_PATH = 3,
+  TEMPORARY_CACHE_PATH = 4
+};
+bool Parkspace_path_IsValid(int value);
+const Parkspace_path Parkspace_path_MIN = OPTIMAL_PATH;
+const Parkspace_path Parkspace_path_MAX = TEMPORARY_CACHE_PATH;
+const int Parkspace_path_ARRAYSIZE = Parkspace_path_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Parkspace_path_descriptor();
+inline const ::std::string& Parkspace_path_Name(Parkspace_path value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Parkspace_path_descriptor(), value);
+}
+inline bool Parkspace_path_Parse(
+    const ::std::string& name, Parkspace_path* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Parkspace_path>(
+    Parkspace_path_descriptor(), name, value);
+}
+enum Parkspace_type {
+  MIN_PARKINGSPACE = 1,
+  MID_PARKINGSPACE = 2,
+  BIG_PARKINGSPACE = 3
+};
+bool Parkspace_type_IsValid(int value);
+const Parkspace_type Parkspace_type_MIN = MIN_PARKINGSPACE;
+const Parkspace_type Parkspace_type_MAX = BIG_PARKINGSPACE;
+const int Parkspace_type_ARRAYSIZE = Parkspace_type_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Parkspace_type_descriptor();
+inline const ::std::string& Parkspace_type_Name(Parkspace_type value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Parkspace_type_descriptor(), value);
+}
+inline bool Parkspace_type_Parse(
+    const ::std::string& name, Parkspace_type* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Parkspace_type>(
+    Parkspace_type_descriptor(), name, value);
+}
 enum Step_type {
   eAlloc_step = 0,
   eMeasure_step = 1,
@@ -1220,6 +1268,20 @@ class Parkspace_info : public ::google::protobuf::Message /* @@protoc_insertion_
   ::google::protobuf::int32 block_id() const;
   void set_block_id(::google::protobuf::int32 value);
 
+  // optional float path_estimate_time = 14;
+  bool has_path_estimate_time() const;
+  void clear_path_estimate_time();
+  static const int kPathEstimateTimeFieldNumber = 14;
+  float path_estimate_time() const;
+  void set_path_estimate_time(float value);
+
+  // optional .message.Parkspace_status parkspace_status_target = 15;
+  bool has_parkspace_status_target() const;
+  void clear_parkspace_status_target();
+  static const int kParkspaceStatusTargetFieldNumber = 15;
+  ::message::Parkspace_status parkspace_status_target() const;
+  void set_parkspace_status_target(::message::Parkspace_status value);
+
   // optional .message.Direction direction = 3;
   bool has_direction() const;
   void clear_direction();
@@ -1227,6 +1289,13 @@ class Parkspace_info : public ::google::protobuf::Message /* @@protoc_insertion_
   ::message::Direction direction() const;
   void set_direction(::message::Direction value);
 
+  // optional .message.Parkspace_path parkspace_path = 13;
+  bool has_parkspace_path() const;
+  void clear_parkspace_path();
+  static const int kParkspacePathFieldNumber = 13;
+  ::message::Parkspace_path parkspace_path() const;
+  void set_parkspace_path(::message::Parkspace_path value);
+
   // @@protoc_insertion_point(class_scope:message.Parkspace_info)
  private:
   void set_has_parkspace_id();
@@ -1253,6 +1322,12 @@ class Parkspace_info : public ::google::protobuf::Message /* @@protoc_insertion_
   void clear_has_leave_time();
   void set_has_block_id();
   void clear_has_block_id();
+  void set_has_parkspace_path();
+  void clear_has_parkspace_path();
+  void set_has_path_estimate_time();
+  void clear_has_path_estimate_time();
+  void set_has_parkspace_status_target();
+  void clear_has_parkspace_status_target();
 
   ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
   ::google::protobuf::internal::HasBits<1> _has_bits_;
@@ -1268,7 +1343,10 @@ class Parkspace_info : public ::google::protobuf::Message /* @@protoc_insertion_
   float height_;
   int parkspace_status_;
   ::google::protobuf::int32 block_id_;
+  float path_estimate_time_;
+  int parkspace_status_target_;
   int direction_;
+  int parkspace_path_;
   friend struct ::protobuf_message_5fbase_2eproto::TableStruct;
   friend void ::protobuf_message_5fbase_2eproto::InitDefaultsParkspace_infoImpl();
 };
@@ -1993,13 +2071,13 @@ inline void Parkspace_info::set_index(::google::protobuf::int32 value) {
 
 // optional .message.Direction direction = 3;
 inline bool Parkspace_info::has_direction() const {
-  return (_has_bits_[0] & 0x00000800u) != 0;
+  return (_has_bits_[0] & 0x00002000u) != 0;
 }
 inline void Parkspace_info::set_has_direction() {
-  _has_bits_[0] |= 0x00000800u;
+  _has_bits_[0] |= 0x00002000u;
 }
 inline void Parkspace_info::clear_has_direction() {
-  _has_bits_[0] &= ~0x00000800u;
+  _has_bits_[0] &= ~0x00002000u;
 }
 inline void Parkspace_info::clear_direction() {
   direction_ = 1;
@@ -2341,6 +2419,80 @@ inline void Parkspace_info::set_block_id(::google::protobuf::int32 value) {
   // @@protoc_insertion_point(field_set:message.Parkspace_info.block_id)
 }
 
+// optional .message.Parkspace_path parkspace_path = 13;
+inline bool Parkspace_info::has_parkspace_path() const {
+  return (_has_bits_[0] & 0x00004000u) != 0;
+}
+inline void Parkspace_info::set_has_parkspace_path() {
+  _has_bits_[0] |= 0x00004000u;
+}
+inline void Parkspace_info::clear_has_parkspace_path() {
+  _has_bits_[0] &= ~0x00004000u;
+}
+inline void Parkspace_info::clear_parkspace_path() {
+  parkspace_path_ = 1;
+  clear_has_parkspace_path();
+}
+inline ::message::Parkspace_path Parkspace_info::parkspace_path() const {
+  // @@protoc_insertion_point(field_get:message.Parkspace_info.parkspace_path)
+  return static_cast< ::message::Parkspace_path >(parkspace_path_);
+}
+inline void Parkspace_info::set_parkspace_path(::message::Parkspace_path value) {
+  assert(::message::Parkspace_path_IsValid(value));
+  set_has_parkspace_path();
+  parkspace_path_ = value;
+  // @@protoc_insertion_point(field_set:message.Parkspace_info.parkspace_path)
+}
+
+// optional float path_estimate_time = 14;
+inline bool Parkspace_info::has_path_estimate_time() const {
+  return (_has_bits_[0] & 0x00000800u) != 0;
+}
+inline void Parkspace_info::set_has_path_estimate_time() {
+  _has_bits_[0] |= 0x00000800u;
+}
+inline void Parkspace_info::clear_has_path_estimate_time() {
+  _has_bits_[0] &= ~0x00000800u;
+}
+inline void Parkspace_info::clear_path_estimate_time() {
+  path_estimate_time_ = 0;
+  clear_has_path_estimate_time();
+}
+inline float Parkspace_info::path_estimate_time() const {
+  // @@protoc_insertion_point(field_get:message.Parkspace_info.path_estimate_time)
+  return path_estimate_time_;
+}
+inline void Parkspace_info::set_path_estimate_time(float value) {
+  set_has_path_estimate_time();
+  path_estimate_time_ = value;
+  // @@protoc_insertion_point(field_set:message.Parkspace_info.path_estimate_time)
+}
+
+// optional .message.Parkspace_status parkspace_status_target = 15;
+inline bool Parkspace_info::has_parkspace_status_target() const {
+  return (_has_bits_[0] & 0x00001000u) != 0;
+}
+inline void Parkspace_info::set_has_parkspace_status_target() {
+  _has_bits_[0] |= 0x00001000u;
+}
+inline void Parkspace_info::clear_has_parkspace_status_target() {
+  _has_bits_[0] &= ~0x00001000u;
+}
+inline void Parkspace_info::clear_parkspace_status_target() {
+  parkspace_status_target_ = 0;
+  clear_has_parkspace_status_target();
+}
+inline ::message::Parkspace_status Parkspace_info::parkspace_status_target() const {
+  // @@protoc_insertion_point(field_get:message.Parkspace_info.parkspace_status_target)
+  return static_cast< ::message::Parkspace_status >(parkspace_status_target_);
+}
+inline void Parkspace_info::set_parkspace_status_target(::message::Parkspace_status value) {
+  assert(::message::Parkspace_status_IsValid(value));
+  set_has_parkspace_status_target();
+  parkspace_status_target_ = value;
+  // @@protoc_insertion_point(field_set:message.Parkspace_info.parkspace_status_target)
+}
+
 #ifdef __GNUC__
   #pragma GCC diagnostic pop
 #endif  // __GNUC__
@@ -2392,6 +2544,16 @@ template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Direction>() {
   return ::message::Direction_descriptor();
 }
+template <> struct is_proto_enum< ::message::Parkspace_path> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Parkspace_path>() {
+  return ::message::Parkspace_path_descriptor();
+}
+template <> struct is_proto_enum< ::message::Parkspace_type> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Parkspace_type>() {
+  return ::message::Parkspace_type_descriptor();
+}
 template <> struct is_proto_enum< ::message::Step_type> : ::google::protobuf::internal::true_type {};
 template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Step_type>() {

+ 30 - 2
message/message_base.proto

@@ -49,6 +49,12 @@ enum Message_type
     eEntrance_manual_operation_msg=0xb0;            //针对出入口状态操作的手动消息
     eProcess_manual_operation_msg=0xb1;             //针对流程的手动消息
 
+    eDispatch_plan_request_msg          = 0xe0;     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+    eDispatch_plan_response_msg         = 0xe1;     //调度总规划的答复(调度算法->调度管理)
+    eDispatch_control_request_msg       = 0xe2;     //调度控制的任务请求(调度算法->调度管理)
+    eDispatch_control_response_msg      = 0xe3;     //调度控制的任务答复(调度管理->调度算法)
+    eDispatch_manager_status_msg        = 0xea;     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+    eDispatch_manager_data_msg          = 0xeb;     //调度管理的设备详细的数据信息
 
 }
 
@@ -145,8 +151,9 @@ enum Parkspace_status
 {
     eParkspace_empty            = 0;         //空闲,可分配
     eParkspace_occupied         = 1;         //被占用,不可分配
-    eParkspace_reserverd        = 2;         //被预约,预约车辆可分配
-    eParkspace_error            = 3;         //车位机械结构或硬件故障
+    eParkspace_reserved         = 2;         //被预约,预约车辆可分配
+    eParkspace_locked           = 3;         //临时锁定,不可分配
+    eParkspace_error            = 4;         //车位机械结构或硬件故障
 }
 
 enum Direction
@@ -155,6 +162,23 @@ enum Direction
     eBackward = 2;
 }
 
+//车位分配路线(根据中跑车的路线来定)
+enum Parkspace_path
+{
+    OPTIMAL_PATH = 1;
+    LEFT_PATH = 2;
+    RIGHT_PATH = 3;
+    TEMPORARY_CACHE_PATH = 4;
+
+}
+//车位类型
+enum Parkspace_type
+{
+    MIN_PARKINGSPACE = 1;//小车位
+    MID_PARKINGSPACE = 2;//中车位
+    BIG_PARKINGSPACE = 3;//大车位
+}
+
 //单个车位基本信息与状态信息,车位信息以及车位上的车辆信息
 message Parkspace_info
 {
@@ -170,6 +194,10 @@ message Parkspace_info
     optional string             entry_time=10;          //入场时间
     optional string             leave_time=11;          //离场时间
     optional int32              block_id=12;            //区块编号
+
+    optional Parkspace_path     parkspace_path = 13;            // 车位分配路线
+    optional float              path_estimate_time = 14;        //车位分配路线 time(s)
+    optional Parkspace_status   parkspace_status_target=15;     //车位目标状态
 }
 
 /*

+ 2 - 0
proto.sh

@@ -6,6 +6,8 @@ protoc -I=./message dispatch_message.proto --cpp_out=./message
 protoc -I=./snap7_communication snap7_communication.proto --cpp_out=./snap7_communication
 
 
+protoc -I=./message dispatch_control.proto --cpp_out=./message
+
 
 
 

+ 2 - 1
setting/snap7_communication.prototxt

@@ -4,7 +4,8 @@ snap7_communication_parameters
   #  ip_string:"192.168.0.1"
  #   ip_string:"192.168.2.134"
 
- ip_string:"192.168.0.6"
+ #ip_string:"192.168.0.6"
 
+ ip_string:"192.168.2.6"
 }
 

+ 78 - 4
snap7_communication/snap7_buf.cpp

@@ -28,6 +28,7 @@ Snap7_buf::Snap7_buf(const Snap7_buf& other)
 		mp_buf_reverse = (void*)malloc(other.m_size);
 		memcpy(mp_buf_reverse, other.mp_buf_reverse, other.m_size);
 		m_size = other.m_size;
+		m_variable_information_vector=other.m_variable_information_vector;
 	}
 }
 Snap7_buf& Snap7_buf::operator =(const Snap7_buf& other)
@@ -43,6 +44,7 @@ Snap7_buf& Snap7_buf::operator =(const Snap7_buf& other)
 		mp_buf_reverse = (void*)malloc(other.m_size);
 		memcpy(mp_buf_reverse, other.mp_buf_reverse, other.m_size);
 		m_size = other.m_size;
+		m_variable_information_vector=other.m_variable_information_vector;
 	}
 }
 Snap7_buf::~Snap7_buf()
@@ -93,7 +95,63 @@ Snap7_buf::Snap7_buf(int id, int start_index, int size, void* p_buf_obverse, voi
 		m_variable_information_vector=variable_information_vector;
 	}
 }
+void Snap7_buf::init(int id, int start_index, int size,
+		  std::vector<Snap7_buf::Variable_information>& variable_information_vector,Communication_mode communication_mode)
+{
+	m_id = id;
+	m_start_index = start_index;
+	m_communication_mode = communication_mode;
+
+	if ( mp_buf_obverse )
+	{
+		free(mp_buf_obverse);
+		mp_buf_obverse = NULL;
+	}
+	if ( mp_buf_reverse )
+	{
+		free(mp_buf_reverse);
+		mp_buf_reverse = NULL;
+	}
+
+	if ( size > 0)
+	{
+		mp_buf_obverse = (void*)malloc(size);
+		memset(mp_buf_obverse, 0, size);
+		mp_buf_reverse = (void*)malloc(size);
+		memset(mp_buf_reverse, 0, size);
+		m_size = size;
+		m_variable_information_vector=variable_information_vector;
+	}
+}
+
+void Snap7_buf::init(int id, int start_index, int size, void* p_buf_obverse, void* p_buf_reverse,
+		  std::vector<Snap7_buf::Variable_information>& variable_information_vector, Communication_mode communication_mode)
+{
+	m_id = id;
+	m_start_index = start_index;
+	m_communication_mode = communication_mode;
 
+	if ( mp_buf_obverse )
+	{
+		free(mp_buf_obverse);
+		mp_buf_obverse = NULL;
+	}
+	if ( mp_buf_reverse )
+	{
+		free(mp_buf_reverse);
+		mp_buf_reverse = NULL;
+	}
+
+	if ( size > 0 && p_buf_obverse != nullptr && p_buf_reverse != nullptr)
+	{
+		mp_buf_obverse = (void*)malloc(size);
+		memcpy(mp_buf_obverse, p_buf_obverse, size);
+		mp_buf_reverse = (void*)malloc(size);
+		memcpy(mp_buf_reverse, p_buf_reverse, size);
+		m_size = size;
+		m_variable_information_vector=variable_information_vector;
+	}
+}
 //正序数据 转为 倒序数据
 void Snap7_buf::obverse_to_reverse()
 {
@@ -104,11 +162,18 @@ void Snap7_buf::obverse_to_reverse()
 	{
 		for (int i = 0; i < iter.m_variable_count; ++i)
 		{
-			for (int j = iter.m_variable_index*i; j < iter.m_variable_index*i+iter.m_variable_size ; ++j)
+			for (int j = 0; j < iter.m_variable_size; ++j)
 			{
-				p_out[j] = p_in[iter.m_variable_index*i+iter.m_variable_size - j -1];
+				p_out[iter.m_variable_index+iter.m_variable_size*i+j] = p_in[iter.m_variable_index+iter.m_variable_size*(i+1)-j-1];
 			}
 		}
+//		for (int i = 0; i < iter.m_variable_count; ++i)
+//		{
+//			for (int j = iter.m_variable_index*i; j < iter.m_variable_index*i+iter.m_variable_size ; ++j)
+//			{
+//				p_out[j] = p_in[iter.m_variable_index*i+iter.m_variable_size - j -1];
+//			}
+//		}
 	}
 }
 
@@ -118,15 +183,24 @@ void Snap7_buf::reverse_to_obverse()
 	char *p_in=(char*)mp_buf_reverse;
 	char *p_out=(char*)mp_buf_obverse;
 
+
 	for ( auto &iter:m_variable_information_vector)
 	{
 		for (int i = 0; i < iter.m_variable_count; ++i)
 		{
-			for (int j = iter.m_variable_index*i; j < iter.m_variable_index*i+iter.m_variable_size ; ++j)
+			for (int j = 0; j < iter.m_variable_size; ++j)
 			{
-				p_out[j] = p_in[iter.m_variable_index*i+iter.m_variable_size - j -1];
+				p_out[iter.m_variable_index+iter.m_variable_size*i+j] = p_in[iter.m_variable_index+iter.m_variable_size*(i+1)-j-1];
 			}
 		}
+
+//		for (int i = 0; i < iter.m_variable_count; ++i)
+//		{
+//			for (int j = iter.m_variable_index*i; j < iter.m_variable_index*i+iter.m_variable_size ; ++j)
+//			{
+//				p_out[j] = p_in[iter.m_variable_index*i+iter.m_variable_size - j -1];
+//			}
+//		}
 	}
 }
 

+ 6 - 0
snap7_communication/snap7_buf.h

@@ -41,6 +41,12 @@ public://API functions
 	Snap7_buf(int id, int start_index, int size, void* p_buf_obverse, void* p_buf_reverse,
 			  std::vector<Snap7_buf::Variable_information>& variable_information_vector, Communication_mode communication_mode = NO_COMMUNICATION);
 
+	void init(int id, int start_index, int size,
+			  std::vector<Snap7_buf::Variable_information>& variable_information_vector,Communication_mode communication_mode = NO_COMMUNICATION);
+	void init(int id, int start_index, int size, void* p_buf_obverse, void* p_buf_reverse,
+		 std::vector<Snap7_buf::Variable_information>& variable_information_vector, Communication_mode communication_mode = NO_COMMUNICATION);
+
+
 	//正序数据 转为 倒序数据
 	void obverse_to_reverse();
 	//倒序数据 转为 正序数据

+ 23 - 5
snap7_communication/snap7_communication_base.cpp

@@ -36,7 +36,7 @@ Error_manager Snap7_communication_base::communication_init_from_protobuf(std::st
 //初始化 通信 模块。从protobuf读取
 Error_manager Snap7_communication_base::communication_init_from_protobuf(Snap7_communication_proto::Snap7_communication_parameter_all& snap7_communication_parameter_all)
 {
-	LOG(INFO) << " ---Communication_socket_base::communication_init() --- "<< this;
+	LOG(INFO) << " ---Snap7_communication_base::communication_init() --- "<< this;
 	Error_manager t_error;
 //	snap7_communication_parameter_all.DebugString();
 
@@ -162,7 +162,8 @@ Error_manager t_error;
 			    {
 					{
 						std::unique_lock<std::mutex> t_lock(m_receive_buf_lock);
-						for (auto iter = m_receive_buf_map.begin(); iter != m_receive_buf_map.end(); ++iter)
+						auto iter = m_receive_buf_map.begin();
+						for (; iter != m_receive_buf_map.end(); ++iter)
 						{
 							//接受数据, 读取DB块,
 							t_error = read_data_buf(iter->second);
@@ -173,6 +174,10 @@ Error_manager t_error;
 								break;
 							}
 						}
+						if ( iter != m_receive_buf_map.end() )
+						{
+							break;
+						}
 					}
 					//注:数据更新放在锁的外面, 防止重复加锁....
 					updata_receive_buf();
@@ -185,7 +190,8 @@ Error_manager t_error;
 					updata_send_buf();
 					{
 						std::unique_lock<std::mutex> t_lock(m_send_buf_lock);
-						for (auto iter = m_send_buf_map.begin(); iter != m_send_buf_map.end(); ++iter)
+						auto iter = m_send_buf_map.begin();
+						for (; iter != m_send_buf_map.end(); ++iter)
 						{
 							//发送数据, 写入DB块,
 							t_error = write_data_buf(iter->second);
@@ -196,6 +202,10 @@ Error_manager t_error;
 								break;
 							}
 						}
+						if ( iter != m_send_buf_map.end() )
+						{
+							break;
+						}
 					}
 					m_communication_status = E_RECEIVE;
 			        break;
@@ -203,7 +213,7 @@ Error_manager t_error;
 				case E_DISCONNECT:
 				{
 					//重连
-					LOG(WARNING) << "find plc connection error, trying to reconnect.";
+					LOG(INFO) << "find plc connection error, trying to reconnect.";
 					communication_disconnect();
 					std::this_thread::sleep_for(std::chrono::milliseconds(m_communication_delay_time_ms));
 					t_error = communication_connect(m_ip_string);
@@ -244,8 +254,13 @@ Error_manager Snap7_communication_base::read_data_buf(Snap7_buf& snap7_buf)
 			snap7_buf.m_communication_mode = Snap7_buf::NO_COMMUNICATION;
 		}
 
+
+
+
 		std::unique_lock<std::mutex> lck(m_communication_lock);
 		int result = m_snap7_client.AsDBRead(snap7_buf.m_id, snap7_buf.m_start_index, snap7_buf.m_size, snap7_buf.mp_buf_reverse);
+
+//		std::this_thread::sleep_for(std::chrono::milliseconds(10));
 		if ( result == 0 )
 		{
 			m_snap7_client.WaitAsCompletion(100);
@@ -254,6 +269,7 @@ Error_manager Snap7_communication_base::read_data_buf(Snap7_buf& snap7_buf)
 		}
 		else
 		{
+			std::cout << " huli test :::: " << " result = " << result << std::endl;
 			return Error_manager(Error_code::SNAP7_READ_ERROR, Error_level::MINOR_ERROR,
 								 " Snap7_communication_base::read_data_buf error ");
 		}
@@ -267,7 +283,7 @@ Error_manager Snap7_communication_base::write_data_buf(Snap7_buf& snap7_buf)
 	Error_manager t_error;
 	if ( snap7_buf.m_communication_mode != Snap7_buf::NO_COMMUNICATION)
 	{
-		if ( snap7_buf.m_communication_mode != Snap7_buf::ONCE_COMMUNICATION )
+		if ( snap7_buf.m_communication_mode == Snap7_buf::ONCE_COMMUNICATION )
 		{
 			snap7_buf.m_communication_mode = Snap7_buf::NO_COMMUNICATION;
 		}
@@ -278,6 +294,8 @@ Error_manager Snap7_communication_base::write_data_buf(Snap7_buf& snap7_buf)
 		std::unique_lock<std::mutex> lck(m_communication_lock);
 		int result = m_snap7_client.AsDBWrite(snap7_buf.m_id, snap7_buf.m_start_index, snap7_buf.m_size,
 											  snap7_buf.mp_buf_reverse);
+
+//		std::this_thread::sleep_for(std::chrono::milliseconds(10));
 		if ( result == 0 )
 		{
 			m_snap7_client.WaitAsCompletion(100);

+ 1 - 6
system/system_executor.cpp

@@ -3,12 +3,7 @@
 //
 
 #include "system_executor.h"
-#include "../message/measure_message.pb.h"
-//#include "../laser/laser_manager.h"
-//#include "../locate/locate_manager.h"
-#include "../system/system_communication.h"
-#include "../message/dispatch_message.pb.h"
-#include "../dispatch/dispatch_manager.h"
+
 
 System_executor::System_executor()
 {

+ 7 - 0
system/system_executor.h

@@ -13,6 +13,13 @@
 //#include "../locate/locate_manager.h"
 //#include "../locate/locate_manager_task.h"
 
+#include "../message/measure_message.pb.h"
+//#include "../laser/laser_manager.h"
+//#include "../locate/locate_manager.h"
+#include "../system/system_communication.h"
+#include "../message/dispatch_message.pb.h"
+#include "../dispatch/dispatch_manager.h"
+
 class System_executor:public Singleton<System_executor>
 {
 // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。

+ 29 - 0
task/task_base.cpp

@@ -23,6 +23,21 @@ Task_Base::~Task_Base()
 	mp_tast_receiver = NULL;
 }
 
+
+//初始化任务单,必须初始化之后才可以使用,
+//    input:tast_receiver 接受对象
+//    input:task_over_time 超时时间
+Error_manager Task_Base::task_init(void* p_tast_receiver,
+						std::chrono::milliseconds task_over_time)
+{
+	m_task_statu = TASK_CREATED;
+	m_task_statu_information = "";
+	mp_tast_receiver = p_tast_receiver;
+	m_task_over_time = task_over_time;
+	m_task_error_manager.error_manager_clear_all();
+	return Error_code::SUCCESS;
+}
+
 //初始化任务单,必须初始化之后才可以使用,
 //    input:task_statu 任务状态
 //    input:task_statu_information 状态说明
@@ -41,6 +56,20 @@ Error_manager Task_Base::task_init(Task_statu task_statu,
 	return Error_code::SUCCESS;
 }
 
+//任务单重置, 相当于重新创建, 会重置时间和错误码.
+Error_manager Task_Base::task_reset()
+{
+	//m_task_id不变	//m_task_type不变 //因为这个是创建的时候就定好的
+	m_task_statu = TASK_CREATED;
+	m_task_statu_information.clear();
+	mp_tast_receiver = NULL;
+
+	m_task_start_time = std::chrono::system_clock::now();	//获取当前时间
+	m_task_over_time = std::chrono::milliseconds(TASK_OVER_TIME_DEFAULT); //默认10秒
+
+	m_task_error_manager.error_manager_clear_all();
+}
+
 //更新任务单
 //task_statu: 任务状态
 //statu_information:状态说明

+ 11 - 1
task/task_base.h

@@ -29,7 +29,8 @@ enum Task_type
 
 	DISPATCH_MANAGER_TASK,					//调度管理任务
 	CARRIER_TASK,							//搬运器任务
-    
+	CATCHER_TASK,							//抓取器任务
+
 };
 //任务状态,如果任务故障,任务状态改为TASK_OVER,然后在m_task_error_manager 补充错误码。
 enum Task_statu
@@ -61,6 +62,12 @@ protected:
 public:
     ~Task_Base();
 
+	//初始化任务单,必须初始化之后才可以使用,
+	//    input:tast_receiver 接受对象
+	//    input:task_over_time 超时时间
+	Error_manager task_init(void* p_tast_receiver,
+							std::chrono::milliseconds task_over_time);
+
 	//初始化任务单,必须初始化之后才可以使用,
 	//    input:task_statu 任务状态
 	//    input:task_statu_information 状态说明
@@ -71,6 +78,9 @@ public:
 					   void* p_tast_receiver,
 					   std::chrono::milliseconds task_over_time);
 
+	//任务单重置, 相当于重新创建, 会重置时间和错误码.
+	Error_manager task_reset();
+
 	//更新任务单
     //task_statu: 任务状态
     //statu_information:状态说明