Open AhmedGamal111 opened 3 years ago
Hi Ahmed,
Sorry I didn't see this sooner. I have graduated so I don't check this github page that often. If you are confused about the algorithm, I recommend checking this page: https://www.bitcraze.io/documentation/repository/lps-node-firmware/master/functional-areas/tdoa_principles/ The code here is mostly based on the Bitcraze implementation.
If you are confused about the code itself (how and were the synchronization is happening) let me know and I can clarify that.
Best, Joao
@jpjporto , I tried using TDOA, but after a few seconds, the ANCHORS stop sending TDOA messages to the TAG. I used four ANCHORs with assigned Anchor_IDs: Anchor 1 (master Anchor) : 0x00, Anchor 2 : 0x01, Anchor 3 : 0x02, and Anchor 4 : 0x03. I haven't modified anything in the code. However, at the TAG, I noticed that the Anchors stop sending TDOA messages after a few seconds, usually between 5 to 10 seconds. Am I doing something wrong? Please help me figure this out.
@jpjporto, do I have to set differently for all anchors, including the master anchor slot and the next slot setting variable in the code, or just leave it as it is? You used slot = number_of_slot - 1
and next_slot = 0
.
What hardware are you using? You need to make sure that each anchor has a unique address here
You can also try changing the number of slots to 4 here
This is a pretty old repo and I don't have access to the hardware anymore, so I can't provide much help.
@jpjporto , I am using the Qorvo DWM1001C Dev-Kit
and have utilized your code to implement TDOA on the DWM1001C Dev-Kit
. I am currently using four Anchors for this purpose, and to accommodate this, I have changed the Number of slots to 4 (#define NSLOTS 4
). Additionally, I have assigned unique IDs to each Anchor: Anchor_1_ID
has been assigned anc_addr = 0x00
, Anchor_2_ID
has been assigned anc_addr = 0x01
, Anchor_3_ID
has been assigned anc_addr = 0x02
, and Anchor_4_ID
has been assigned anc_addr = 0x03
. As a result, all anchors now have individual IDs. However, despite these changes, I'm facing issues as it doesn't seem to work properly.
@jpjporto, I don't know why, but the TAG stops receiving data from the anchor within 1 to 3 seconds.
@jpjporto, Yes, I updated the number of anchors in the TAG_code (#define NR_OF_ANCHORS 4
). One more thing, I changed the anchor id one by one and uploaded the anchor code on respective anchors, according to the anchor id mentioned above.
Do you know if the anchors are still syncing to each other? I'm trying to figure out if the problem is on the tx side or rx side.
@jpjporto, I think problem may be on tx side. But, I am confused.
@jpjporto, How to verify the synchronization of the anchors?
@jpjporto, I think maybe anchors are not synchronized, that's why TAG is not able to receive anything after 1 to 2 seconds. Here are the results:
Have you also tried changing the TDMA_NSLOT_BITS to 2?
@jpjporto, I tried to print string on serial monitor that TAG code sends via
Have you also tried changing the TDMA_NSLOT_BITS to 2?
No, Ok I will try. I have my modules with me right now.
Have you also tried changing the TDMA_NSLOT_BITS to 2?
@jpjporto, I changed TDMA_NSLOT_BITS
to 2
and checked, but nothing changed. After getting a few anchor data, TAG waiting for anchor messages, but anchors somehow stop sending data. Here is the serial string result of the TAG:
@jpjporto, could you check this? Here is the continuous while loop
inside main()
in the anchor side code for TREK_TDOA:
while(1)
{
// Do something
dt = (portGetTickCnt() - portGetLastEvent());
if(dt > 10000)
{
dwt_rxenable(DWT_START_RX_IMMEDIATE);
}
}
I made a few corrections to your second code snippet to address the issue with portGetTickCnt()
and portGetLastEvent()
not being available in the DWM1001C Dev-Kit. I have created a FreeRTOS task for a continuous while loop
and used vTaskDelay
for 10 ms. Here's the updated code:
void main_task_function(void *pvParameter)
{
UNUSED_PARAMETER(pvParameter);
/* Infinite loop */
while (1)
{
dwt_rxenable(DWT_START_RX_IMMEDIATE);
vTaskDelay(pdMS_TO_TICKS(10));
}
}
Hmm, your code might not work the same way. I'm not super familiar with freeRTOS. We only want to call dwt_rx_enable() if the DW module hasn't triggered a callback in the last 10ms.
Sorry, unfortunately I haven't worked with the decawave modules in almost 5 years, so everything is foggy. The original code should work fine with you only needing to change the number of anchors in the TAG. I remember testing the code with 4, 6, and 8 anchors.
Hmm, your code might not work the same way. I'm not super familiar with freeRTOS. We only want to call dwt_rx_enable() if the DW module hasn't triggered a callback in the last 10ms.
Sorry, unfortunately I haven't worked with the decawave modules in almost 5 years, so everything is foggy. The original code should work fine with you only needing to change the number of anchors in the TAG. I remember testing the code with 4, 6, and 8 anchors.
@jpjporto, Thank you for the reply. I think I am experiencing a problem with this line: dt = (portGetTickCnt() - portGetLastEvent());
because your code is attempting to get the system tick using the portGetTickCnt()
function. However, the DWM1001C does not provide any function to retrieve the system tick value.
@jpjporto, could you check this? Here is the continuous
while loop
insidemain()
in the anchor side code for TREK_TDOA:while(1) { // Do something dt = (portGetTickCnt() - portGetLastEvent()); if(dt > 10000) { dwt_rxenable(DWT_START_RX_IMMEDIATE); } }
I made a few corrections to your second code snippet to address the issue with
portGetTickCnt()
andportGetLastEvent()
not being available in the DWM1001C Dev-Kit. I have created a FreeRTOS task for acontinuous while loop
and usedvTaskDelay
for 10 ms. Here's the updated code:void main_task_function(void *pvParameter) { UNUSED_PARAMETER(pvParameter); /* Infinite loop */ while (1) { dwt_rxenable(DWT_START_RX_IMMEDIATE); vTaskDelay(pdMS_TO_TICKS(10)); } }
@jpjporto, I am able to retrieve SysTickCount
, and I have created a function for that called SysTick_Init()
, which enables the SysTick Interrupt to generate a SysTick Interrupt every 1ms
. In the SysTick_Handler()
, I have implemented time32_incr++
, and in the dwt_isr()
, I have used last_event
. Here is the rewritten main continuous while loop:
while(1)
{
dt = portGetTickCnt() - portGetLastEvent();
if(dt > 10)
{
dwt_rxenable(DWT_START_RX_IMMEDIATE);
}
}
But whenever I power up all the Anchors, the Synch-Anchor (Anchor with ID: 0x00) starts communication with the other anchors, but somehow the 4th anchor (Anchor with ID: 0x03) stops receiving Sync-Anchor data. I do not know why. Another issue is that when I print the string of the TAG code, I am only getting data from the previous anchor (Anchor with ID: 0x00) and the current anchor (Anchor ID: 0x01). Additionally, when I disconnect the anchor (Anchor ID: 0x01), then I am able to get anchor data from (Anchor with ID: 0x02). It seems to me that there is a synchronization issue, but I don't know the reason.
@jpjporto, I have just modified the maximum time for the dwt_rx_enable() callback trigger from 10ms to 20ms in the anchor code, and now all the anchors receive the SYNCH-ANCHOR code. However, I am still only receiving a 2-anchor message at the TAG.
@jpjporto, could you please assist me in verifying synchronization? Specifically, I need guidance on how to verify anchor synchronization. I am unsure of the steps to check it.
@jpjporto, I have just modified the maximum time for the dwt_rx_enable() callback trigger from 10ms to 20ms in the anchor code, and now all the anchors receive the SYNCH-ANCHOR code. However, I am still only receiving a 2-anchor message at the TAG.
@jpjporto, I resolved that issue. Now, I am receiving all anchor messages at TAG.
@jpjporto, After obtaining all the data from TAG, how do we calculate the position of the TAG?
@jpjporto, Please help me out to calculate the Position of the TAG?
@jpjporto, I checked the Serial data in which distance is also mentioned, When I cross verified than I found that whatever the distance I am getting at TAG end is wrong.
I want to thank you to avail this big effort to everyone, I just need to understand how synchronization between anchors is working in your code? and i do not know how to connect anchors together to be synced.
Thanks in advance,