Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Continues Ranging and update rate  #3

@metehanemlik

Description

@metehanemlik

I want to make continues ranging to make this:

ı changed

PRINTLN(F(" Ranging all anchors. Return to IDLE"));
updateState(STATE_IDLE);

to

PRINTLN(F(" Ranging all anchors. Return to IDLE"));
updateState(STATE_PONG);

and ı add some code to calculateRange function amd then received Continues Ranging like this:

123 , 158 , 182 , 93 , 96
31 , 158 , 185 , 93 , 96
31 , 158 , 185 , 85 , 96
30 , 158 , 185 , 85 , 100
123 , 153 , 185 , 85 , 100
31 , 153 , 194 , 85 , 100
31 , 153 , 194 , 88 , 100
30 , 153 , 194 , 88 , 99
121 , 150 , 194 , 88 , 99
31 , 150 , 172 , 88 , 99
31 , 150 , 172 , 93 , 99
30 , 150 , 172 , 93 , 99
123 , 151 , 172 , 93 , 99
31 , 151 , 170 , 93 , 99

the first row is delay time for every calculateRange(); others are anchors distance(cm)

as you can see sometimes there is a big delay like 120ms,

we can eliminate this delay?

whole code:

void calculateRange() {
DW1000Time round1 = (timePollAckReceived - timePollSent).wrap();
DW1000Time reply1 = (timePollAckSent - timePollReceived).wrap();
DW1000Time round2 = (timeRangeReceived - timePollAckSent).wrap();
DW1000Time reply2 = (timeRangeSent - timePollAckReceived).wrap();
DW1000Time tof = (round1 * round2 - reply1 * reply2)
/ (round1 + round2 + reply1 + reply2);
distance[idx_anchor] = tof.getAsMeters();
if(calHz == 0){
currentMillis = millis();
calHz = 1;
Serial.print( millis() - currentMillis2);
Serial.print(" , ");
}else{
calHz = 0;
currentMillis2 = millis();
Serial.print( millis() - currentMillis);
Serial.print(" , ");
}
Serial.print(round(distance[0]*100));
Serial.print(" , ");
Serial.print(round(distance[1]*100));
Serial.print(" , ");
Serial.print(round(distance[2]*100));
Serial.print(" , ");
Serial.println(round(distance[3]*100));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions