|
@@ -36,7 +36,7 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
//调度指令
|
|
//调度指令
|
|
t_index = 0;
|
|
t_index = 0;
|
|
t_variable_information_vector.clear();
|
|
t_variable_information_vector.clear();
|
|
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved50", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
|
|
|
|
+ t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved51_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 23 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved51_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 23 });
|
|
t_index += sizeof(unsigned char)*23;
|
|
t_index += sizeof(unsigned char)*23;
|
|
@@ -229,12 +229,25 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
t_index += sizeof(float)*1;
|
|
t_index += sizeof(float)*1;
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_locate_correct", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_locate_correct", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_index += sizeof(unsigned char)*1;
|
|
|
|
+ t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved37_40", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
|
|
|
|
+ t_index += sizeof(unsigned char)*3;
|
|
|
|
+ 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_communication_mode", 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_refresh_command", 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_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
|
|
+ t_index += sizeof(unsigned char)*1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
m_send_buf_map[3] = t_snap7_buf;
|
|
m_send_buf_map[3] = t_snap7_buf;
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 4, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
m_send_buf_map[4] = t_snap7_buf;
|
|
m_send_buf_map[4] = t_snap7_buf;
|
|
|
|
|
|
|
|
+
|
|
t_index = 0;
|
|
t_index = 0;
|
|
t_variable_information_vector.clear();
|
|
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_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
@@ -246,9 +259,9 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_index += sizeof(unsigned char)*1;
|
|
|
|
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
|
|
m_send_buf_map[5] = t_snap7_buf;
|
|
m_send_buf_map[5] = t_snap7_buf;
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
|
|
m_send_buf_map[6] = t_snap7_buf;
|
|
m_send_buf_map[6] = t_snap7_buf;
|
|
|
|
|
|
t_index = 0;
|
|
t_index = 0;
|
|
@@ -281,7 +294,7 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_angle", typeid(float).name(), t_index,sizeof(float), 1 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_angle", typeid(float).name(), t_index,sizeof(float), 1 });
|
|
t_index += sizeof(float)*1;
|
|
t_index += sizeof(float)*1;
|
|
|
|
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
m_send_buf_map[7] = t_snap7_buf;
|
|
m_send_buf_map[7] = t_snap7_buf;
|
|
|
|
|
|
t_index = 0;
|
|
t_index = 0;
|
|
@@ -295,7 +308,7 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_index += sizeof(unsigned char)*1;
|
|
|
|
|
|
- t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
|
|
m_send_buf_map[8] = t_snap7_buf;
|
|
m_send_buf_map[8] = t_snap7_buf;
|
|
|
|
|
|
|
|
|
|
@@ -310,7 +323,7 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
|
|
t_index += sizeof(unsigned char)*1;
|
|
t_index += sizeof(unsigned char)*1;
|
|
|
|
|
|
- t_snap7_buf.init(GROUND_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
|
|
|
|
|
|
+ t_snap7_buf.init(ANTICOLLISION_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
|
|
m_receive_buf_map[4] = t_snap7_buf;
|
|
m_receive_buf_map[4] = t_snap7_buf;
|
|
|
|
|
|
return Snap7_communication_base::communication_init();
|
|
return Snap7_communication_base::communication_init();
|
|
@@ -347,8 +360,6 @@ Error_manager Dispatch_communication::updata_send_buf()
|
|
std::unique_lock<std::mutex> t_lock1(m_send_buf_lock);
|
|
std::unique_lock<std::mutex> t_lock1(m_send_buf_lock);
|
|
std::unique_lock<std::mutex> t_lock2(m_data_lock);
|
|
std::unique_lock<std::mutex> t_lock2(m_data_lock);
|
|
|
|
|
|
- m_dispatch_request_from_manager_to_plc_for_data.m_reserved50 = 1;
|
|
|
|
-
|
|
|
|
memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data, m_send_buf_map[0].m_size);
|
|
memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data, m_send_buf_map[0].m_size);
|
|
memcpy(m_send_buf_map[1].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_key, m_send_buf_map[1].m_size);
|
|
memcpy(m_send_buf_map[1].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_key, m_send_buf_map[1].m_size);
|
|
memcpy(m_send_buf_map[2].mp_buf_obverse, &m_dispatch_plc_status_from_manager_to_plc, m_send_buf_map[2].m_size);
|
|
memcpy(m_send_buf_map[2].mp_buf_obverse, &m_dispatch_plc_status_from_manager_to_plc, m_send_buf_map[2].m_size);
|