51uwb.cn
标题:
一个标签2个基站如何测距?
[打印本页]
作者:
lk396784054
时间:
2019-11-30 10:55
标题:
一个标签2个基站如何测距?
刚刚接触,不太懂,请问如何基站直接串口输出标签到本基站的距离,有参考代码吗,谢谢
作者:
tuzhuke
时间:
2019-11-30 11:53
在工程中有如下代码,是基站将距离信息(distance)打包发送出去的部分。
你可以将distance 这个距离信息通过串口打印出来
distance = distance - dwt_getrangebias(config.chan,(float)distance, config.prf);//距离减去矫正系数
//将计算结果发送给TAG
int temp = (int)(distance*100);
distance_msg[10] = temp/100;
// a=x; //自动类型转换,取整数部分
distance_msg[11] = temp%100; //乘100后对100取余,得到2位小数点后数字
distance_msg[12] = anthor_index;
distance_msg[ALL_MSG_SN_IDX] = frame_seq_nb;
distance_msg[ALL_MSG_TAG_IDX] = tag_index;
dwt_writetxdata(sizeof(distance_msg), distance_msg, 0);
dwt_writetxfctrl(sizeof(distance_msg), 0);
/* Start transmission, indicating that a response is expected so that reception is enabled automatically after the frame is sent and the delay
* set by dwt_setrxaftertxdelay() has elapsed. */
dwt_starttx(DWT_START_TX_IMMEDIATE );
复制代码
欢迎光临 51uwb.cn (http://51uwb.cn/)
Powered by Discuz! X3.3