First off thanks for all of the experimentation you have done with the uwb chips.
I was experimenting with your ESP32_anchor_autocalibrate.ino program and I believe there is an error in its implementation.
void newRange()
{
static float last_delta = 0.0;
Serial.print(DW1000Ranging.getDistantDevice()->getShortAddress(), DEC);
float dist = 0;
for (int i = 0; i < 100; i++) {
// get and average 100 measurements
dist += DW1000Ranging.getDistantDevice()->getRange();
}
Since newRange() is a callback that is called when a new range is calculated, the for loop inside will return that same range 100 times. To get 100 different ranges, you need to wait for newRange() to be called 100 times. Making dist global as well as a global iter variable to track how many times newRange() has been called lead to some very repeatable calibration values in my testing.
First off thanks for all of the experimentation you have done with the uwb chips.
I was experimenting with your ESP32_anchor_autocalibrate.ino program and I believe there is an error in its implementation.
Since
newRange()
is a callback that is called when a new range is calculated, the for loop inside will return that same range 100 times. To get 100 different ranges, you need to wait fornewRange()
to be called 100 times. Makingdist
global as well as a globaliter
variable to track how many timesnewRange()
has been called lead to some very repeatable calibration values in my testing.