Skip to content

File evamMedianDecor.h

File List > src > evamMedianDecor.h

Go to the documentation of this file

#pragma once

#include <evafMedian.h>
#include "evaStdReaders.h"

namespace evam
{
    template <class TMotor, unsigned short tWindowSize = evaf::kDefaultWindowSize>
    class MedianDecor : public TMotor
    {
    private:
        evaf::Median<eva::ValueReader, tWindowSize> mFilter;

    public:
        MedianDecor() : TMotor() {}

        template <typename... Args>
        MedianDecor(Args... args) : TMotor(args...) {}

        void Go(signed short value)
        {
            mFilter.setValue(constrain(value, -1000, 1000));
            TMotor::Go(mFilter.getValue());
        }
    };
}