diff --git a/include/CommunicationManager.h b/include/CommunicationManager.h index 6763a14..126b94a 100644 --- a/include/CommunicationManager.h +++ b/include/CommunicationManager.h @@ -89,7 +89,7 @@ private: ros::ServiceClient mav_dji_client_; ros::ServiceServer mav_dji_server_; /*Vector msgs*/ - std::map< int, std::shared_ptr > multi_msgs; + std::map< std::size_t, std::shared_ptr > multi_msgs; std::vector multi_msgs_available; uint16_t cur_checksum; uint16_t counter; diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index e84ab82..6adeb20 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -399,7 +399,7 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() counter=1; } else if (header[1]==cur_checksum) { - std::map< int, std::shared_ptr >::iterator it = multi_msgs.find(header[2]); + std::map< std::size_t, std::shared_ptr >::iterator it = multi_msgs.find(header[2]); if(it!=multi_msgs.end()){ multi_msgs.erase(it); multi_msgs.insert(make_pair(header[2], in_message)); @@ -412,10 +412,11 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() /*If the total size of msg reached transfer to topic*/ if(counter==header[3]){ - for(int i =1; i<=header[3];i++){ + for(uint16_t i =1; i<=header[3]+1;i++){ it = multi_msgs.find(i); - std::cout<<"Transfering to topic chunk no. :"<second->size(); - for (int j = 1; j < it->second->size(); j++) + std::cout<<"Transfering to topic chunk no. :"<first << "Size of current map" <second->size()<< std::endl; + std::cout<<"Size of map : "<< multi_msgs.size()<< std::endl; + for (std::size_t j = 1; j < it->second->size(); j++) { @@ -513,7 +514,7 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( else {*/ char temporary_buffer_check[6000]; - for(int i=0; ipayload64.size(); i++) + for(std::size_t i=0; ipayload64.size(); i++) { converted_bytes += sprintf( temporary_buffer_check + converted_bytes, "%" PRIu64 " ", @@ -536,7 +537,7 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( temporary_buffer, "%" PRIu64 " ", (uint64_t)header); delete[] header_16; - for (int i =0; ipayload64.size(); i++) + for (std::size_t i =0; ipayload64.size(); i++) { if(cnt<10){