class
ButterworthLowPassFilterButterworthLowPass implements a low pass filter of order N.
The system is described by the following transfer function
where is the cutoff frequency and is the order of the filter and is the Laplace variable.
What follows is a brief description of the filter and how it is implemented.
Compute the transfer function of the continuous system
What follows is taken from from Passive and Active Network Analysis and Synthesis, Aram Budak, Houghton Mifflin, 1974 and from https:/
where and is the imaginary unit. By construction, the Butterworth filter does not have zeros. The gain of the filter is given by
Compute the transfer function of the discrete system
As mentioned before, the transfer function of the discrete system is obtained by the bilinear transform
The poles of the discrete system are obtained by substituting the poles of the continuous system in the bilinear transformation as explained in https:/
where are the poles of the continuous system, is the sampling time and . All the zeros of the continuous system are mapped to -1. Finally, the gain of the discrete system is given by
Pre-wrapping
The ButterworthLowPass supports the pre-wrapping of the filter. The pre-wrapping is a technique used to mitigate the distortion that can occur during the bilinear transformation. It consists in shifting the poles of the continuous system in the s-plane. To easily implement the pre-wrapping, we slightly modify the bilinear transformation as
where is the cutoff frequency and is the sampling time. In the class the pre-wrapping is enabled by default and can be disabled by setting the parameter enable_prewrapping
to false. The interested reader can find more information about the pre-wrapping at this link.
Compute the coefficients of the discrete system
Once we have the poles and the gain of the discrete system we can compute the coefficients of the filter by applying the Vieta's formulas. The transfer function of the discrete system is given by
Once the numerator and the denominator are computed we can easily antitransform the transfer function to obtain the coefficients of the filter as
where is the input of the filter and is the output of the filter.
Base classes
-
template<class _Input, class _Output>class BipedalLocomotion::System::Advanceable<Eigen::VectorXd, Eigen::VectorXd>
- Basic class that represents a discrete system.
Constructors, destructors, conversion operators
- ButterworthLowPassFilter()
- Constructor.
- ~ButterworthLowPassFilter() override
- Destructor.
Public functions
-
auto initialize(std::weak_ptr<const ParametersHandler::
IParametersHandler> handler) -> bool override - Initialize the Dynamical system.
- auto reset(Eigen::Ref<const Eigen::VectorXd> initialState) -> bool
- Set the state of the smoother.
- auto advance() -> bool override
- Compute the output of the filter.
- auto getOutput() const -> const Eigen::VectorXd& override
- Get the output of the filter.
- auto setInput(const Eigen::VectorXd& input) -> bool override
- Set the input of the filter.
- auto isOutputValid() const -> bool override
- Determines the validity of the object retrieved with getOutput()
Function documentation
bool BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: initialize(std::weak_ptr<const ParametersHandler:: IParametersHandler> handler) override
Initialize the Dynamical system.
Parameters | |
---|---|
handler | pointer to the parameter handler. |
Returns | true in case of success/false otherwise. |
bool BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: reset(Eigen::Ref<const Eigen::VectorXd> initialState)
Set the state of the smoother.
Parameters | |
---|---|
initialState | initial state of the smoother |
Returns | true in case of success, false otherwise. |
bool BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: advance() override
Compute the output of the filter.
Returns | true in case of success, false otherwise. |
---|
const Eigen::VectorXd& BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: getOutput() const override
Get the output of the filter.
Returns | a vector containing the output of the smoother |
---|
bool BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: setInput(const Eigen::VectorXd& input) override
Set the input of the filter.
Parameters | |
---|---|
input | the vector representing the input of the filter |
Returns | True in case of success and false otherwise |
bool BipedalLocomotion:: ContinuousDynamicalSystem:: ButterworthLowPassFilter:: isOutputValid() const override
Determines the validity of the object retrieved with getOutput()
Returns | True if the object is valid, false otherwise. |
---|