Skip to content

Improve online filter functions #605

Open
@ufechner7

Description

If you want to filter online data, you can use the following function:

"""
    apply_filter(tfilter::DF2TFilter, measurement)

Apply the filter to the measurement.

# Arguments
- `tfilter`: The filter, created with `create_filter` and converted to a DF2TFilter
- `measurement`: The measurement value
"""
function apply_filter(tfilter::DF2TFilter, measurement)
    results = zeros(1)
    measurements = ones(1) * measurement
    @views filt!(results[1:1], tfilter, measurements)
    return results[1]
end

This is an ugly workaround. We need a function that does the same, but:

  • does not require the allocation of one element arrays
  • does not allocate at all (important for real-time control systems)

In addition, the fact that this function does not accept a filter of type ZeroPoleGain is annoying.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions