mpiFilterPostFilterSet

Declaration

int32_t mpiFilterPostFilterSet(MPIFilter                   filter,
                            int32_t                        *sectionsCount,
                            MPIFilterPostFilterSection  *sections);

Required Header: stdmpi.h

Description

mpiFilterPostFilterSet sets the number of postfilter sections within an MPIFilter object and configures each postfilter section as well. If numberOfSections equals zero, then sections can be NULL and the postfilter will be disabled.

The MPI calculates the post filter coefficients and takes into consideration the sample rate of the controller at that time. If you change the sample rate of the controller, you will need to recalculate the post filters. This can be done for all filters specified in Hertz by setting the filters again with the MPI. The MPI will calculate the filters using the current servo sample rate.

Postfilters are used to digitally filter the output of a control loop. One common use for postfilters is the compensation of system resonances.

filter the handle of the MPIFilter object whose postfilter sections will be configured.
*sectionsCount the number of postfilter sections to set in the filter object.
*sections a pointer to an array of MPIFilterPostFilterSection data structures to be set in filter.
Return Values
MPIMessageOK

Sample Code

/*   Set a 4th order low-pass post-filter by using 
     two 2nd order low-pass sections.
     Sample usage:   

     returnValue =        
         fourthOrderLowPass(filter, 300 /* Hz */);
*/int32_t filterFouthOrderLowpass(MPIFilter filter, int32_t breakPointFrequency)
{
    MPIFilterConfig config;
    MPIFilterPostFilterSection section[MPIFilterPostFilterSectionCOUNT_MAX];
    int32_t returnValue;

    section[0].type = MPIFilterPostFilterSectionTypeLOW_PASS;
    section[0].form = MPIFilterPostFilterformINT_BIQUAD;
    section[0].data.lowPass.breakpoint = breakPointFrequency;
    section[1] = section[0]; /* copy first section */
 
    returnValue =
        mpiFilterPostFilterSet(filter, 2, section);

    return returnValue;
}

See Also

MPIFilterPostFilterSection | mpiFilterPostFilterGet | meFilterPostfilterSectionSet | MPIFilterPostFilterSectionCOUNT_MAX | Post Filter Theory