Add vibration magnitude estimation

This commit is contained in:
Lorenz Meier
2016-02-25 16:54:24 +01:00
parent 5483e7a477
commit cd5857e900
4 changed files with 42 additions and 1 deletions
+24
View File
@@ -197,6 +197,30 @@ DataValidatorGroup::get_vibration_factor(uint64_t timestamp)
return vibe;
}
float
DataValidatorGroup::get_vibration_offset(uint64_t timestamp, int axis)
{
DataValidator *next = _first;
float vibe = -1.0f;
/* find the best vibration value of a non-timed out sensor */
while (next != nullptr) {
if (next->confidence(timestamp) > 0.5f) {
float* vibration_offset = next->vibration_offset();
if (vibe < 0.0f || vibration_offset[axis] < vibe) {
vibe = vibration_offset[axis];
}
}
next = next->sibling();
}
return vibe;
}
void
DataValidatorGroup::print()
{