changes in sending and lots of untested stuff

This commit is contained in:
vivek-shankar 2017-01-25 23:33:04 -05:00
parent 249fbd7f1d
commit 24494cee0a
2 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,8 @@
<launch>
<!-- xmee_mav Drone type and Commununication Mode -->
<!-- node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="master solo" output="screen" -->
<!-- node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="master swarm" output="screen" -->
<node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="slave solo" output="screen" />
<node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="master swarm" output="screen" />
<!-- node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="slave solo" output="screen" -->
<!--node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="slave swarm" output="screen" -->
<!-- xmee_mav Topics and Services Names -->
<param name="Xbee_In_From_Buzz" type="str" value="outMavlink" />

View File

@ -530,15 +530,18 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback(
uint16_t check_sum = (uint16_t)Caculate_Checksum(&frame);
uint16_t cnt=0;
uint16_t number=1;
uint16_t total =ceil((double)(mavlink_msg->payload64.size()/20));
uint16_t total =ceil((double)((double)mavlink_msg->payload64.size()/(double)20));
std::cout <<"Payload size" <<mavlink_msg->payload64.size() << std::endl;
uint64_t header = 0 | ((uint64_t)check_sum << 16) | ((uint64_t)number << 32) |((uint64_t) total << 48) ;
std::cout << "Total chunks:" <<total << std::endl;
//temporary_buffer[MAX_BUFFER_SIZE]="";
frame="";
converted_bytes= sprintf(
temporary_buffer, "%" PRIu64 " ",
(uint64_t)header);
(uint64_t)header);
for (int i =0; i<mavlink_msg->payload64.size(); i++)
{
if(cnt<20){
converted_bytes += sprintf(
temporary_buffer+converted_bytes, "%" PRIu64 " ",
@ -557,10 +560,15 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback(
converted_bytes = sprintf(
temporary_buffer, "%" PRIu64 " ",
(uint64_t)header);
}
}
if(total==1){
std::cout << "Single frame" << std::endl;
Generate_Transmit_Request_Frame(temporary_buffer, &frame);
serial_device_.Send_Frame(frame);
}
//}
}