Browse Source

ECL: Factor in error counts from sensor

sbg
Lorenz Meier 10 years ago
parent
commit
1148ba4a77
  1. 10
      src/lib/ecl/validation/data_validator.h
  2. 5
      src/lib/ecl/validation/data_validator_group.h

10
src/lib/ecl/validation/data_validator.h

@ -66,6 +66,12 @@ public: @@ -66,6 +66,12 @@ public:
*/
float confidence(uint64_t timestamp);
/**
* Get the error count of this validator
* @return the error count
*/
uint64_t error_count() { return _error_count; }
/**
* Get the value of this validator
* @return the stored value
@ -118,10 +124,10 @@ DataValidator::~DataValidator() @@ -118,10 +124,10 @@ DataValidator::~DataValidator()
}
void
DataValidator::put(uint64_t timestamp, float val[3], uint64_t error_count)
DataValidator::put(uint64_t timestamp, float val[3], uint64_t error_count_in)
{
_event_count++;
_error_count = error_count;
_error_count = error_count_in;
for (unsigned i = 0; i < _dimensions; i++) {
if (_time_last == 0) {

5
src/lib/ecl/validation/data_validator_group.h

@ -118,15 +118,18 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index) @@ -118,15 +118,18 @@ DataValidatorGroup::get_best(uint64_t timestamp, int *index)
// XXX This should eventually also include voting
float max_confidence = 0.0f;
int max_index = -1;
uint64_t min_error_count = 30000;
DataValidator *best = nullptr;
unsigned i = 0;
while (next != nullptr) {
float confidence = next->confidence(timestamp);
if (confidence > max_confidence) {
if (confidence > max_confidence &&
next->error_count() < min_error_count) {
max_index = i;
max_confidence = confidence;
min_error_count = next->error_count();
best = next;
}
next = next->sibling();

Loading…
Cancel
Save