Hi,
I’m trying to run some of the example code for the API with some slight modifications. I’ve already configured 3 anchors successfully and their positions are returned correctly by the get_loc function. However when I configure a 4th dwm1001 as a tag and run the get_loc function it only returns zero. Looking a little bit deeper it seems the loc.anchors.dist.cnt object always returns 0. Is there any reason my tag wont recognize the surrounding anchors?
int get_loc(void)
{
// ========== dwm_loc_get ==========
int rv, err_cnt = 0, i;
dwm_loc_data_t loc;
dwm_pos_t pos;
loc.p_pos = &pos;
HAL_Log(“dwm_loc_get(&loc)\n”);
rv = Test_CheckTxRx(dwm_loc_get(&loc));
gettimeofday(&tv,NULL);
if(rv == RV_OK)
{
HAL_Log(“ts:%ld.%06ld [%d,%d,%d,%u]\n”, tv.tv_sec, tv.tv_usec, loc.p_pos->x, loc.p_pos->y, loc.p_pos->z, loc.p_pos->qf);
printf(“ts:%ld.%06ld [%d,%d,%d,%u]”, tv.tv_sec, tv.tv_usec, loc.p_pos->x, loc.p_pos->y, loc.p_pos->z, loc.p_pos->qf);
auto var = loc.anchors.dist.cnt;
for (i = 0; i < loc.anchors.dist.cnt; ++i)
{
HAL_Log("#%u)", i);
printf("#%u)", i);
HAL_Log(“a:0x%08x”, loc.anchors.dist.addr[i]);
printf(“a:0x%08x”, loc.anchors.dist.addr[i]);
if (i < loc.anchors.an_pos.cnt)
{
HAL_Log("[%d,%d,%d,%u]", loc.anchors.an_pos.pos[i].x,
loc.anchors.an_pos.pos[i].y,
loc.anchors.an_pos.pos[i].z,
loc.anchors.an_pos.pos[i].qf);
printf("[%d,%d,%d,%u]", loc.anchors.an_pos.pos[i].x,
loc.anchors.an_pos.pos[i].y,
loc.anchors.an_pos.pos[i].z,
loc.anchors.an_pos.pos[i].qf);
}
HAL_Log(“d=%u,qf=%u\n”, loc.anchors.dist.dist[i], loc.anchors.dist.qf[i]);
printf(“d=%u,qf=%u”, loc.anchors.dist.dist[i], loc.anchors.dist.qf[i]);
}
HAL_Log("\n");
printf("\n");
}
err_cnt += rv;
return err_cnt;
}
int main(int argc, char*argv[])
{
dwm_init(argv[1]);
{//init
printf(“Initializing…\n”);
HAL_Log(“Initializing…\n”);
HAL_Log(“Done\n”);
}
if (argc > 1)
{
if (strcmp(argv[2], “anchor”) == 0)
{
configAnchor(atoi(argv[3]), atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
}
if (strcmp(argv[2], “tag”) == 0)
{
setup_tag();
}
}
dwm_upd_rate_set(1,1);
dwm_panid_set(1);
dwm_int_cfg_set(DWM1001_INTR_LOC_READY);
dwm_pos_t checker;
// dwm_pos_get(&checker);
dwm_cfg_t cfg;
dwm_cfg_get(&cfg);
printf(“Configured as %d\n”, cfg.mode);
dwm_pos_get(&checker);
while(1)
{
get_loc();
HAL_Delay(10);
}