TDOA 之 基站逻辑代码实现
Posted tuzhuke
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TDOA 之 基站逻辑代码实现相关的知识,希望对你有一定的参考价值。
在前一篇博文里描述了基站的逻辑部分,这里贴出来具体代码实现。https://www.cnblogs.com/tuzhuke/p/11689881.html
1 Sync 信息部分
case ‘S‘: //save seq bphero_sync_message[bphero_sync_count].seq_num = msg_f->seqNum; //save rx timestamp bphero_sync_message[bphero_sync_count].rx_timestamp = get_rx_timestamp_u64(); //save delayed tx timestamp //bphero_sync_message[bphero_sync_count].rx_timestamp = final_msg_get_ts(); //save shortaddr bphero_sync_message[bphero_sync_count].shortaddr = msg_f->sourceAddr[1]<<8|msg_f->sourceAddr[0]; bphero_sync_count++; if(bphero_sync_count == 2) { //判断连续两次Sync信号是否连续 if(bphero_sync_message[1].seq_num = bphero_sync_message[0].seq_num + 1)//uint8,255+1 = 0 { //判断两个sync信号之间知否有Tag信号 if(bphero_tag_num>0) { //将收到的SYNC 信号和TAG 信号全部通过串口送出去 } } //只要接收到两个SYNC信号,就要清除目前所有信息 bphero_tag_num = 0; bphero_sync_count=0;
2 TAG信息部分
case ‘T‘: //save seq bphero_tag_message[bphero_tag_num].seq_num = msg_f->seqNum; //save rx timestamp bphero_tag_message[bphero_tag_num].rx_timestamp = get_rx_timestamp_u64(); //save delayed tx timestamp // bphero_tag_message[bphero_tag_num].rx_timestamp = final_msg_get_ts(); //save shortaddr bphero_tag_message[bphero_tag_num].shortaddr = msg_f->sourceAddr[1]<<8|msg_f->sourceAddr[0]; bphero_tag_num++; if(bphero_tag_num == MAX_TAG_NODE ) { bphero_tag_num = 0; } break;
以上是关于TDOA 之 基站逻辑代码实现的主要内容,如果未能解决你的问题,请参考以下文章
定位问题基于matlab TDOA+taylor算法移动基站无源定位含Matlab源码 2098期