diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index 6385972..3012b2f 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -9,33 +9,6 @@ #include "CommunicationManager.h" -<<<<<<< HEAD -uint16_t* u64_cvt_u16(uint64_t u64){ - uint16_t* out = new uint16_t[4]; - uint32_t int32_1 = u64 & 0xFFFFFFFF; - uint32_t int32_2 = (u64 & 0xFFFFFFFF00000000 ) >> 32; - out[0] = int32_1 & 0xFFFF; - out[1] = (int32_1 & (0xFFFF0000) ) >> 16; - out[2] = int32_2 & 0xFFFF; - out[3] = (int32_2 & (0xFFFF0000) ) >> 16; - //cout << " values " <>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 namespace Mist { @@ -47,11 +20,7 @@ namespace Xbee //***************************************************************************** CommunicationManager::CommunicationManager(): START_DLIMITER(static_cast(0x7E)), -<<<<<<< HEAD - LOOP_RATE(50) /* 10 fps */ -======= LOOP_RATE(10) /* 10 fps */ ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 { } @@ -68,10 +37,6 @@ bool CommunicationManager::Init( { if (serial_device_.Init(device, baud_rate)) { -<<<<<<< HEAD - in_messages_ = serial_device_.Get_In_Messages_Pointer(); - return true; -======= serial_device_.Set_In_Messages_Pointers(&in_std_messages_, &in_fragments_, &in_Acks_and_Pings_, &command_responses_); @@ -96,18 +61,14 @@ bool CommunicationManager::Init( if (!device_ID_loaded) return false; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } else { Display_Init_Communication_Failure(); return false; } -<<<<<<< HEAD -======= return true; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } @@ -116,11 +77,7 @@ bool CommunicationManager::Init( void CommunicationManager::Run(DRONE_TYPE drone_type, RUNNING_MODE running_mode) { -<<<<<<< HEAD - std::thread thread_service(&SerialDevice::Run_Service, &serial_device_); -======= std::thread thread_packets_handler(&PacketsHandler::Run, &packets_handler_); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 Display_Drone_Type_and_Running_Mode(drone_type, running_mode); @@ -130,14 +87,10 @@ void CommunicationManager::Run(DRONE_TYPE drone_type, Run_In_Solo_Mode(drone_type); serial_device_.Stop_Service(); -<<<<<<< HEAD - thread_service.join(); -======= serial_device_.Close_Serial_Port(); packets_handler_.Quit(); service_thread_->join(); thread_packets_handler.join(); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } @@ -151,11 +104,7 @@ void CommunicationManager::Run_In_Solo_Mode(DRONE_TYPE drone_type) { if (node_handle_.getParam("Xbee_In_From_Controller", service_name)) { -<<<<<<< HEAD - mav_dji_server_ = node_handle_.advertiseService(service_name.c_str(), &CommunicationManager::Serve_Flight_Controller, this); -======= mav_dji_server_ = node_handle_.advertiseService(service_name.c_str(), &CommunicationManager::Serve_Flight_Controller, this); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 success = true; } else @@ -213,25 +162,6 @@ void CommunicationManager::Run_In_Swarm_Mode() else std::cout << "Failed to Get Topic Name: param 'Xbee_Out_To_Buzz' Not Found." << std::endl; -<<<<<<< HEAD - /*Get no of devices*/ - node_handle_.getParam("No_of_dev", no_of_dev); - /*Get device Id feom host name*/ - device_id=get_deviceid(); - std::cout << "Device Id" <>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } } } @@ -255,20 +184,12 @@ void CommunicationManager::Run_In_Swarm_Mode() inline bool CommunicationManager::Serve_Flight_Controller(mavros_msgs::CommandInt:: Request& request, mavros_msgs::CommandInt::Response& response) { -<<<<<<< HEAD - const std::size_t MAX_BUFFER_SIZE = 255; -======= const std::size_t MAX_BUFFER_SIZE = 256; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 unsigned int command = 0; char temporary_buffer[MAX_BUFFER_SIZE]; std::string frame; -<<<<<<< HEAD - switch(request.command) -======= /*switch(request.command) ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 { case mavros_msgs::CommandCode::NAV_TAKEOFF: { @@ -312,15 +233,9 @@ inline bool CommunicationManager::Serve_Flight_Controller(mavros_msgs::CommandIn if (command != 0) { -<<<<<<< HEAD - //Generate_Transmit_Request_Frame(temporary_buffer, &frame); - serial_device_.Send_Frame(frame); - } -======= Generate_Transmit_Request_Frame(temporary_buffer, &frame); serial_device_.Send_Frame(frame); }*/ ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 return true; } @@ -341,16 +256,9 @@ void CommunicationManager::Display_Init_Communication_Failure() //***************************************************************************** -<<<<<<< HEAD -inline void CommunicationManager::Generate_Transmit_Request_Frame( - const char* const message, - std::string * frame, - int tot, -======= /*inline void CommunicationManager::Generate_Transmit_Request_Frame( const char* const message, std::string * frame, ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 const unsigned char frame_ID, const std::string& destination_adssress, const std::string& short_destination_adress, @@ -358,11 +266,7 @@ inline void CommunicationManager::Generate_Transmit_Request_Frame( const std::string& options) { const unsigned char FAME_TYPE = static_cast(0x10); /* Transmit Request Frame */ -<<<<<<< HEAD - std::string frame_parameters; -======= /*std::string frame_parameters; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 std::string bytes_frame_parameters; frame_parameters.append(destination_adssress); @@ -375,17 +279,6 @@ inline void CommunicationManager::Generate_Transmit_Request_Frame( frame->push_back(FAME_TYPE); frame->push_back(frame_ID); frame->append(bytes_frame_parameters); -<<<<<<< HEAD - frame->append(message, tot); - - Calculate_and_Append_Checksum(frame); - Add_Length_and_Start_Delimiter(frame); -} - - -//***************************************************************************** -inline void CommunicationManager::Convert_HEX_To_Bytes( -======= frame->append(message, std::strlen(message)); Calculate_and_Append_Checksum(frame); @@ -395,7 +288,6 @@ inline void CommunicationManager::Convert_HEX_To_Bytes( //***************************************************************************** /*inline void CommunicationManager::Convert_HEX_To_Bytes( ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 const std::string& HEX_data, std::string* converted_data) { const unsigned short TWO_BYTES = 2; @@ -411,19 +303,11 @@ inline void CommunicationManager::Convert_HEX_To_Bytes( temporary_char = static_cast(temporary_HEX); converted_data->push_back(temporary_char); } -<<<<<<< HEAD -} - - -//***************************************************************************** -inline void CommunicationManager::Calculate_and_Append_Checksum( -======= }*/ //***************************************************************************** /*inline void CommunicationManager::Calculate_and_Append_Checksum( ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 std::string* frame) { unsigned short bytes_sum = 0; @@ -438,35 +322,11 @@ inline void CommunicationManager::Calculate_and_Append_Checksum( checksum = 0xFF - lowest_8_bits; checksum_byte = static_cast(checksum); frame->push_back(checksum_byte); -<<<<<<< HEAD -} - -unsigned short CommunicationManager::Caculate_Checksum(std::string* frame) -{ - - unsigned short bytes_sum = 0; - unsigned lowest_8_bits = 0; - unsigned short checksum = 0; - //unsigned char checksum_byte; - - for (unsigned short i = 0; i < frame->size(); i++) - bytes_sum += static_cast(frame->at(i)); - - lowest_8_bits = bytes_sum & 0xFF; - checksum = 0xFF - lowest_8_bits; - -return checksum; -} - -//***************************************************************************** -inline void CommunicationManager::Add_Length_and_Start_Delimiter( -======= }*/ //***************************************************************************** /*inline void CommunicationManager::Add_Length_and_Start_Delimiter( ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 std::string* frame) { const unsigned short FIVE_BYTES = 5; @@ -477,11 +337,7 @@ inline void CommunicationManager::Add_Length_and_Start_Delimiter( std::string header; int frame_length = frame->size() - 1; /* frame_length = frame_size - checksum byte */ -<<<<<<< HEAD - header.push_back(START_DLIMITER); -======= /*header.push_back(START_DLIMITER); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 sprintf(temporary_buffer, "%04X", frame_length); sscanf(temporary_buffer, "%02X%02X", &Hex_frame_length_1, &Hex_frame_length_2); @@ -490,30 +346,6 @@ inline void CommunicationManager::Add_Length_and_Start_Delimiter( temporary_char = static_cast(Hex_frame_length_2); header.push_back(temporary_char); frame->insert(0, header); -<<<<<<< HEAD -} - - -//***************************************************************************** -inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() -{ - std::size_t size_in_messages = in_messages_->Get_Size(); - uint16_t* header; - if (size_in_messages > 0) - { - /*if(!multi_msgs_receive.empty()) steps++; - if(steps>500){ - steps=0; - multi_msgs_receive.clear(); - receiver_cur_checksum=0; - }*/ - /*T0 overcome mesages after the stop transmission of multi packet*/ - if(counter!=0){ - multi_msgs_receive.clear(); - counter--; - } - uint64_t current_int64 = 0; -======= }*/ @@ -526,188 +358,11 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() { uint64_t current_int64 = 0; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 for (std::size_t j = 0; j < size_in_messages; j++) { std::shared_ptr in_message = in_messages_->Pop_Front(); mavros_msgs::Mavlink mavlink_msg; -<<<<<<< HEAD - int tot = 0; - //uint64_t header=0; - /*Copy the header*/ - memcpy(¤t_int64,in_message->c_str(),sizeof(uint64_t)); - tot+=sizeof(uint64_t); - /*sscanf(in_message->c_str(), "%" PRIu64 " ", - ¤t_int64);*/ - //std::cout<1 && header[2]==1){ - /*copy msg size*/ - uint16_t tmp_size=0; - memcpy(&tmp_size,in_message->c_str()+tot,sizeof(uint16_t)); - tot+=sizeof(uint16_t); - //std::cout<<"received size in bytes: "<c_str()+tot,tmp_size*sizeof(uint64_t)); - tot+=tmp_size*sizeof(uint64_t); - //std::cout<<"tot size : "<at(i) || 0 == i) - { - sscanf(in_message->c_str() + i, "%" PRIu64 " ", - ¤t_int64); - mavlink_msg.payload64.push_back(current_int64); - }*/ - - } - //std::cout << "Single packet message received size"<1 && header[1]>1){ - - /*multimsg received send ack msg*/ - char temporary_buffer[20]; - std::string frame; - std::cout << "Multi msg Received header " < >::iterator it = multi_msgs_receive.find(header[2]); - if(it!=multi_msgs_receive.end()){ - multi_msgs_receive.erase(it); - multi_msgs_receive.insert(make_pair(header[2], in_message)); - } - else{ - multi_msgs_receive.insert(make_pair(header[2], in_message)); - //counter++; - } - std::cout << "multi msg counter " <second->c_str()+tot,sizeof(uint16_t)); - tot+=sizeof(uint16_t); - //std::cout<<"multi publisher received size in bytes: "<second->c_str()+tot,tmp_size*sizeof(uint64_t)); - tot+=tmp_size*sizeof(uint64_t); - //std::cout<<"tot size : "<first << "Size of current map" <second->size()<< std::endl; - //std::cout << "received Frame:"<<(void *) it->second->c_str() << std::endl; - //std::cout<<"Size of map : "<< multi_msgs.size()<< std::endl; - /* for (std::size_t j = 1; j < it->second->size()-1; j++) - { - - - if (' ' == it->second->at(j) || 0 == j) - {*/ - //current_int64=0 - //sscanf(it->second->c_str() + j, "%" PRIu64 " ", - // ¤t_int64); - /*Copy obt msg*/ - - //memcpy(current_int64, it->second->c_str()+tot, tmp_size*sizeof(uint64_t)); - //std::cout << "received Frame:" << current_int64 << std::endl; - //if(previous_int64 != current_int64){ - //mavlink_msg.payload64.push_back(current_int64); - //previous_int64=current_int64; - //} - /* } - - } */ - } - - std::cout << "one multi message published in topic with size :" <::iterator it = ack_received_dict.find(header[3]); - if(it!=ack_received_dict.end()){ - ack_received_dict.erase(it); - ack_received_dict.insert(std::make_pair((uint16_t)header[3], (uint16_t)ACK_MESSAGE_CONSTANT)); - } - else{ - ack_received_dict.insert( std::make_pair( (uint16_t)header[3], (uint16_t)ACK_MESSAGE_CONSTANT ) ); - } - - } - //std::cout << "ACK added and size of ack map " << ack_received_dict.size()<< std::endl; - - } - delete[] header; - - } - - } -} - - -//***************************************************************************** -inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Server() -{ - std::size_t size_in_messages = in_messages_->Get_Size(); - - if (size_in_messages > 0) -======= for (std::size_t i = 0; i < in_message->size(); i++) { @@ -733,7 +388,6 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Server() // //std::size_t size_in_messages = in_messages_->Get_Size(); /*if (size_in_messages > 0) ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 { for (std::size_t j = 0; j < size_in_messages; j++) { @@ -765,11 +419,7 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Server() // ROS_INFO("XBeeMav: Faild to Tranfer Command."); } -<<<<<<< HEAD - } -======= }*/ ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } @@ -777,229 +427,10 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Server() // inline void CommunicationManager::Send_Mavlink_Message_Callback( const mavros_msgs::Mavlink::ConstPtr& mavlink_msg) { -<<<<<<< HEAD - const unsigned short MAX_BUFFER_SIZE = 211; /* 20 (length(uint64_t)) * 10 (max int number) + 10 (spaces) + 1 */ - const unsigned short MAX_NBR_OF_INT64 = 24; - char temporary_buffer[MAX_BUFFER_SIZE]; - std::string frame; - int converted_bytes = 0; - if((uint64_t)mavlink_msg->payload64.at(0)==(uint64_t)XBEE_STOP_TRANSMISSION && mavlink_msg->payload64.size() == 1){ - std::cout << "clearing multi msg queue after request from buzz"<< std::endl; - multi_msgs_send_dict.clear(); - ack_received_dict.clear(); - sending_chunk_no=0; - /*Multi message packets stoped tell rosbuzz this*/ - mavros_msgs::Mavlink mavlink_msg; - mavlink_msg.payload64.push_back(XBEE_MESSAGE_CONSTANT); - mavlink_publisher_.publish(mavlink_msg); - } - else if(mavlink_msg->payload64.size() > MAX_NBR_OF_INT64 && !( multi_msgs_send_dict.empty() ) ){ - std::cout << "Sending previous multi message not complete yet, so dropping message"<payload64.size(); i++) - { - converted_bytes += sprintf( - temporary_buffer_check + converted_bytes, "%" PRIu64 " ", - (uint64_t)mavlink_msg->payload64.at(i)); - - } - - frame.append(temporary_buffer_check, std::strlen(temporary_buffer_check)); - uint16_t check_sum = (uint16_t)Caculate_Checksum(&frame); - uint16_t number=1; - uint16_t total =ceil((double)((double)mavlink_msg->payload64.size()/(double)MAX_NBR_OF_INT64)); - //std::cout <<"Payload size" <payload64.size() << std::endl; - /*Create a header for the msgs*/ - uint64_t header = (uint64_t)MESSAGE_CONSTANT | ((uint64_t)check_sum << 16) | ((uint64_t)number << 32) |((uint64_t) total << 48) ; - frame=""; - memset(temporary_buffer, 0, MAX_BUFFER_SIZE); - uint16_t* header_16 = u64_cvt_u16(header); - /*buffer byte counter*/ - int tot=0; - std::cout << "Sent header" <payload64.size() <= MAX_NBR_OF_INT64){ - - uint64_t message_obt[mavlink_msg->payload64.size()]; - uint8_t* cpy_buff = (uint8_t*)malloc( sizeof(uint64_t)+sizeof(uint16_t) + ( sizeof(uint64_t)*mavlink_msg->payload64.size() ) ); - memset(cpy_buff, 0,sizeof(uint64_t) + ( sizeof(uint64_t)*mavlink_msg->payload64.size() )); - - for (std::size_t i =0; ipayload64.size(); i++) - { - message_obt[i] =(uint64_t)mavlink_msg->payload64[i]; - - } - /*Copy the header*/ - memcpy(cpy_buff,&header,sizeof(uint64_t)); - tot+=sizeof(uint64_t); - /*copy msg size*/ - uint16_t tmp_size=(uint16_t)mavlink_msg->payload64.size(); - memcpy(cpy_buff+tot,&tmp_size,sizeof(uint64_t)); - tot+=sizeof(uint16_t); - std::cout<<"tmp size in sender"<payload64.size()<<" Tot size: "<< tot<< std::endl; - Generate_Transmit_Request_Frame(temporary_buffer, &frame,tot); - serial_device_.Send_Frame(frame); - - } - else{ - /*clear all the related parameter and get ready to send multi msg*/ - sending_chunk_no=0; - Sender_cur_checksum = check_sum; - ack_received_dict.clear(); - multi_msgs_send_dict.clear(); - /*Copy the msgs into a 64bit array*/ - uint64_t message_obt[mavlink_msg->payload64.size()]; - /*buffer for easy handel operation*/ - uint8_t* cpy_buff = (uint8_t*)malloc( sizeof(uint64_t)+sizeof(uint16_t) + ( sizeof(uint64_t)*MAX_NBR_OF_INT64 ) ); - memset(cpy_buff, 0,sizeof(uint64_t)+sizeof(uint16_t) + ( sizeof(uint64_t)*MAX_NBR_OF_INT64 )); - for (std::size_t i =0; ipayload64.size(); i++) - { - message_obt[i] =(uint64_t)mavlink_msg->payload64[i]; - - } - //std::cout << "put header in dict" <payload64.at(i)); - */ - //std::cout << "Sent Frame in (uint64):"<payload64.at(i) << std::endl; - //std::cout << "Sent Frame in string"<payload64.size()){ - tmp_size=mavlink_msg->payload64.size() - uint64_counter; - /*Copy the header*/ - memcpy(cpy_buff,&header,sizeof(uint64_t)); - tot+=sizeof(uint64_t); - memcpy(cpy_buff+tot,&tmp_size,sizeof(uint64_t)); - tot+=sizeof(uint16_t); - /*Copy obt msg*/ - memcpy(cpy_buff+tot, message_obt+uint64_counter, ( sizeof(uint64_t) )*tmp_size); - uint64_counter+=tmp_size; - tot+=( sizeof(uint64_t) )*tmp_size; - /*Copy the data to char buff*/ - memcpy((void*)temporary_buffer,(void*)cpy_buff,tot); - Generate_Transmit_Request_Frame(temporary_buffer, &frame,tot); - multi_msgs_send_dict.push_back(frame); - } - delete[] cpy_buff; - //std::cout << " Received size: " <payload64.size() << std::endl; - //std::cout << "total size of multi msg dict mavlink size:" <>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 //***************************************************************************** void CommunicationManager::Display_Drone_Type_and_Running_Mode( @@ -1017,14 +448,6 @@ void CommunicationManager::Display_Drone_Type_and_Running_Mode( } -<<<<<<< HEAD -} - - -} - - -======= //***************************************************************************** void CommunicationManager::Process_In_Standard_Messages() { @@ -1123,4 +546,3 @@ void CommunicationManager::Process_Command_Responses() } ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 diff --git a/src/SerialDevice.cpp b/src/SerialDevice.cpp index 4735352..5b00d0e 100644 --- a/src/SerialDevice.cpp +++ b/src/SerialDevice.cpp @@ -39,10 +39,6 @@ bool SerialDevice::Init( { Set_Port_Options(baud_rate); Init_Frame_Type_Keys(); -<<<<<<< HEAD - Read_Frame_Header(); -======= ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 return true; } else @@ -85,10 +81,7 @@ void SerialDevice::Send_Frame(const std::string& frame) //***************************************************************************** void SerialDevice::Run_Service() { -<<<<<<< HEAD -======= Read_Frame_Header(); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 io_service_.run(); } @@ -97,25 +90,17 @@ void SerialDevice::Run_Service() void SerialDevice::Stop_Service() { io_service_.post([this]() {io_service_.stop(); }); -<<<<<<< HEAD -======= } //***************************************************************************** void SerialDevice::Close_Serial_Port() { ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 io_service_.post([this]() {serial_port_.close(); }); } //***************************************************************************** -<<<<<<< HEAD -Thread_Safe_Deque * SerialDevice::Get_In_Messages_Pointer() -{ - return &in_messages_; -======= void SerialDevice::Set_In_Messages_Pointers(Thread_Safe_Deque* in_std_messages, Thread_Safe_Deque* in_fragments, Thread_Safe_Deque* in_Acks_and_Pings, @@ -125,7 +110,6 @@ void SerialDevice::Set_In_Messages_Pointers(Thread_Safe_Deque* in_std_messages, in_fragments_ = in_fragments; in_Acks_and_Pings_ = in_Acks_and_Pings; command_responses_ = command_responses; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } @@ -184,15 +168,10 @@ void SerialDevice::Read_Frame_Header() Read_Frame_Body(); } else -<<<<<<< HEAD - /* The header is totally corrupted, read another header. */ - Read_Frame_Header(); -======= { /* The header is totally corrupted, read another header. */ Read_Frame_Header(); } ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } else { @@ -218,17 +197,6 @@ void SerialDevice::Read_Frame_Body() if (current_frame_.Get_Frame_Type() == FRAME_TYPE_KEYS[RECEIVE_PACKET]) { -<<<<<<< HEAD - const unsigned short ELEVEN_BYTES = 11; - const unsigned short TWELVE_BYTES = 12; - - std::shared_ptr in_message = - std::make_shared(); - in_message->append(current_frame_.Get_Frame_Body() - + ELEVEN_BYTES, - current_frame_.Get_Frame_Body_Length() - TWELVE_BYTES); - in_messages_.Push_Pack(in_message); -======= char msg_type = current_frame_.Get_Message_Type(); std::shared_ptr in_message = std::make_shared(); @@ -265,7 +233,6 @@ void SerialDevice::Read_Frame_Body() current_frame_.Get_Frame_Body_Length() - 2); command_responses_->Push_Back(in_message); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } Read_Frame_Header(); @@ -300,8 +267,6 @@ void SerialDevice::Write_Frame() } -<<<<<<< HEAD -======= //***************************************************************************** bool SerialDevice::Is_IO_Service_Stopped() { @@ -316,7 +281,6 @@ void SerialDevice::Reset_IO_Service() } ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } diff --git a/src/TestBuzz.cpp b/src/TestBuzz.cpp index b39c9a8..5341620 100644 --- a/src/TestBuzz.cpp +++ b/src/TestBuzz.cpp @@ -47,34 +47,15 @@ void Init_Random_Seed() //***************************************************************************** int main(int argc, char **argv) { -<<<<<<< HEAD - const unsigned int MIN_PAYLOAD_SIZE = 1; - const unsigned int MAX_PAYLOAD_SIZE = 10; - - ros::init(argc, argv, "flight_controller"); -======= const unsigned int MIN_PAYLOAD_SIZE = 750; const unsigned int MAX_PAYLOAD_SIZE = 752; ros::init(argc, argv, "test_buzz"); ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 ros::NodeHandle node_handle; ros::Publisher mavlink_pub = node_handle.advertise("outMavlink", 1000); ros::Subscriber mavlink_sub = node_handle.subscribe("inMavlink", 1000, Receive_Payload_Callback); -<<<<<<< HEAD - ros::Rate loop_rate(0.2); - - Init_Random_Seed(); - - int count = 0; - - - while (ros::ok()) - { - mavros_msgs::Mavlink mavlink_msg_; -======= Init_Random_Seed(); int count = 0; @@ -88,7 +69,6 @@ int main(int argc, char **argv) mavros_msgs::Mavlink mavlink_msg_; mavlink_msg_.sysid = 2; mavlink_msg_.msgid = 1; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 unsigned int payload_size = Get_Random_Size(MIN_PAYLOAD_SIZE, MAX_PAYLOAD_SIZE); @@ -110,14 +90,8 @@ int main(int argc, char **argv) ros::spinOnce(); -<<<<<<< HEAD - loop_rate.sleep(); - - count++; -======= count++; std::cout << "Press Enter to Send New Mavlink Message..." << std::endl; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } return 0; diff --git a/src/XBeeFrame.cpp b/src/XBeeFrame.cpp index 91761a5..1a99176 100644 --- a/src/XBeeFrame.cpp +++ b/src/XBeeFrame.cpp @@ -141,8 +141,6 @@ void Frame::Rearrange_Corrupted_Header() } -<<<<<<< HEAD -======= //***************************************************************************** char Frame::Get_Message_Type() { @@ -150,7 +148,6 @@ char Frame::Get_Message_Type() } ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 } diff --git a/src/XMLConfigParser.cpp b/src/XMLConfigParser.cpp index 56a1760..525e75e 100644 --- a/src/XMLConfigParser.cpp +++ b/src/XMLConfigParser.cpp @@ -23,11 +23,7 @@ XMLConfigParser::~XMLConfigParser() //***************************************************************************** bool XMLConfigParser::Load_Config() { -<<<<<<< HEAD - const std::string FILE_NAME = "/home/ubuntu/ROS_WS/src/xbeemav/Resources/XBee_Config.xml"; -======= const std::string FILE_NAME = "/home/mistlab/catkin_ws/src/xbee_ros_node/Resources/XBee_Config.xml"; ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 if (Check_Config_File_Exists(FILE_NAME)) { diff --git a/src/Xbee.cpp b/src/Xbee.cpp index c7a375a..496d531 100644 --- a/src/Xbee.cpp +++ b/src/Xbee.cpp @@ -17,11 +17,7 @@ int main(int argc, char* argv[]) Mist::Xbee::CommunicationManager communication_manager; const std::string& device = "/dev/ttyUSB0"; // TO DO can be introduced as command. -<<<<<<< HEAD - const std::size_t baud_rate = 115200; // TO DO Can be introduced as command. -======= const std::size_t baud_rate = 230400; // TO DO Can be introduced as command. ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 Mist::Xbee::CommunicationManager::DRONE_TYPE drone_type = Mist::Xbee::CommunicationManager::DRONE_TYPE::SLAVE; Mist::Xbee::CommunicationManager::RUNNING_MODE running_mode = @@ -38,12 +34,7 @@ int main(int argc, char* argv[]) running_mode = Mist::Xbee::CommunicationManager::RUNNING_MODE::SWARM; } } -<<<<<<< HEAD - - -======= ->>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1 if (communication_manager.Init(device, baud_rate)) communication_manager.Run(drone_type, running_mode); }