diff --git a/src/shared/algorithms/SFD/SFDAscent.cpp b/src/shared/algorithms/SFD/SFDAscent.cpp index 355faf8e2c7d5a1b9d09b51f6b2fe62721d9a423..4a527054413a14f182df8945f3e574bad2806831 100644 --- a/src/shared/algorithms/SFD/SFDAscent.cpp +++ b/src/shared/algorithms/SFD/SFDAscent.cpp @@ -52,7 +52,7 @@ SFDAscent::FeaturesVec SFDAscent::getFeatures(const SFDVectorIn& input) s2 = x0.array().pow(2).mean(); m4 = x0.array().pow(4).mean(); - rfourier = FFT32::fft(data).real(); // TODO: fix complex -> float + rfourier = FFT32::fft(data).cwiseAbs(); // TODO: fix complex -> float rfmean = rfourier.mean(); rfvar = (rfourier - rfmean * SFDVectorIn::Ones()).squaredNorm() / LEN_CHUNK; diff --git a/src/shared/algorithms/SFD/SFDAscent.h b/src/shared/algorithms/SFD/SFDAscent.h index 95f98437c244f4717581a6ad33174c2180720c0f..93b79568be8991a7990535e198bc24fa331385af 100644 --- a/src/shared/algorithms/SFD/SFDAscent.h +++ b/src/shared/algorithms/SFD/SFDAscent.h @@ -48,6 +48,11 @@ public: explicit SFDAscent(const SFDAscentConfig& config); + /** + * @brief Classifies the input vector as faulty or not. + * + * @return true if the input is faulty, false otherwise. + */ bool classify(const SFDVectorIn& input); private: diff --git a/src/shared/algorithms/SFD/SFDDescent.h b/src/shared/algorithms/SFD/SFDDescent.h index c41a57aa3bf2d2e37573fff385429093d49e3e5a..a435fdb949097b8f53ba74b268b9674b7278ae86 100644 --- a/src/shared/algorithms/SFD/SFDDescent.h +++ b/src/shared/algorithms/SFD/SFDDescent.h @@ -48,6 +48,11 @@ public: explicit SFDDescent(const SFDDescentConfig& config); + /** + * @brief Classifies the input vector as faulty or not. + * + * @return true if the input is faulty, false otherwise. + */ bool classify(const SFDVectorIn& input); private: diff --git a/src/shared/sensors/SFD/PressureSFD.cpp b/src/shared/sensors/SFD/PressureSFD.cpp index 7aead52a5a7703207ad187908bcd774336d280f3..e5c4d369a6d0527c8df8876a61dfc20d4f2116f7 100644 --- a/src/shared/sensors/SFD/PressureSFD.cpp +++ b/src/shared/sensors/SFD/PressureSFD.cpp @@ -110,7 +110,6 @@ PressureSFDData PressureSFD::sampleImpl() processed_value = medianFilter.filter(processed_value); processed_value = lowPassFilter.filter(processed_value); - samples = sampleWindow.last(); data.pressure = processed_value; return data; @@ -147,7 +146,6 @@ void PressureSFD::setDisabledSensors() skipped++; continue; } - // TODO: check if the score is correct (true means faulty) if (sfdAscent.classify(sensor_samples[i])) { disabledSensors[i] = true; @@ -164,7 +162,6 @@ void PressureSFD::setDisabledSensors() skipped++; continue; } - // TODO: check if the score is correct (true means faulty) if (sfdDescent.classify(sensor_samples[i])) { disabledSensors[i] = true; diff --git a/src/shared/sensors/SFD/PressureSFD.h b/src/shared/sensors/SFD/PressureSFD.h index 553c77d3acb95d7b9f5c37891c4ccbe9572111a5..98a7d3c4b1cc7ef2c14223d56fd125e20ce8e012 100644 --- a/src/shared/sensors/SFD/PressureSFD.h +++ b/src/shared/sensors/SFD/PressureSFD.h @@ -49,7 +49,7 @@ class PressureSFD : public Sensor<PressureSFDData> { public: static constexpr int MASKED_SENSORS = 2; - static constexpr int WIN_LEN = MASKED_SENSORS * LEN_CHUNK; + static constexpr int WIN_LEN = LEN_CHUNK; // TODO: set these values static constexpr int MED_FILTER_WIN_LEN = 25;