From 127bcc70c9d3e0871a0fd80ff8e21190c80a8229 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期三, 22 九月 2021 17:59:03 +0800 Subject: [PATCH] V1.56 固定参数版本 --- 源码/核心板/Src/application/dw_app.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" index 32db799..9412bb3 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" @@ -115,6 +115,7 @@ } } } +extern u16 g_commap_antdelay; void Dw1000_Init(void) { /* Reset and initialise DW1000. @@ -131,7 +132,7 @@ /* Apply default antenna delay value. See NOTE 1 below. */ dwt_setrxantennadelay(RX_ANT_DLY); //设置接收天线延迟 - dwt_settxantennadelay(TX_ANT_DLY); //设置发射天线延迟 + dwt_settxantennadelay(g_commap_antdelay); //设置发射天线延迟 /* Set expected response's delay and timeout. See NOTE 4 and 5 below. * As this example only handles one incoming frame with always the same delay and timeout, those values can be set here once for all. */ @@ -836,8 +837,11 @@ dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR); } } +u16 smallcar_idlist[10]={0x4052,0x4032,0x4055,0x4034,0x4016,0x4010,0x4036,0x4027,0x4024,0x4047}; extern u16 dist_threshold; u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,getrange_success=0; +int32_t filter_dist,filter_speed; +u8 newmeasure; u8 Anchor_RecNearPoll(u8 ancrec_nearbasepos) //0 mainbase 1 first near_base { u8 motorstate; @@ -913,6 +917,7 @@ uint32_t poll_rx_ts_32, resp_tx_ts_32, final_rx_ts_32; double Ra, Rb, Da, Db; int64_t tof_dtu; + u8 si; resp_tx_ts = get_tx_timestamp_u64();//获得response发送时间T3 final_rx_ts = get_rx_timestamp_u64();//获得final接收时间T6 final_msg_get_ts(&rx_buffer[FINAL_MSG_POLL_TX_TS_IDX], &poll_tx_ts);//从接收数据中读取T1,T4,T5 @@ -938,24 +943,34 @@ LED0_BLINK; //每成功一次通讯则闪烁一次 dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10; + for(si=0;si<10;si++) + { + if(smallcar_idlist[si]==tag_id_recv) + { + hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10-(int16_t)g_com_map[NOMOVESLEEP_TIME]*10; + } + } g_flag_Taggetdist[taglist_pos]=0; + if(hex_dist>-1000&&hex_dist<2000000) { if(abs(hex_dist-his_dist[taglist_pos])<dist_threshold||misdist_num[taglist_pos]>3) { - int32_t filter_dist; + g_Resttimer=0; IWDG_Feed(); #ifdef TDFILTER NewTrackingDiffUpdate(taglist_pos, (float)hex_dist); - filter_dist=pos_predict[taglist_pos]/10; + filter_dist = pos_predict[taglist_pos]/10; + filter_speed = vel_predict[taglist_pos]/10; + newmeasure = 1; #else filter_dist=hex_dist/10; #endif misdist_num[taglist_pos]=0; tagdist_list[taglist_pos] = filter_dist; his_dist[taglist_pos]=hex_dist; - g_Tagdist[taglist_pos]=filter_dist; + g_Tagdist[taglist_pos]=hex_dist/10; #ifdef USART_SINGLE_OUTPUT usart_send[2] = 1;//正常模式 usart_send[3] = 17;//数据段长度 -- Gitblit v1.9.3