flrs / HampelFilter

Arduino library for identifying outliers with a Hampel filter
Other
28 stars 5 forks source link

General questions & Removing outliers #3

Closed huub8 closed 1 year ago

huub8 commented 4 years ago

Hi Florian,

Thirst of all, thank you very much for the effort you put into writing and documenting this library! It helped me out a lot.

Now, on to the question part, I would love to get your opinion on a couple of aspects, but I need to explain what I'm trying to do first. The project I'm currently working on contains a drone that will fly indoors using an ultra-wideband positioning system. This system will replace the gps input that my flightcontroller (ardupilot) normally gets. This UWB system can be very accurate, but it does have some noise and erroneous location data too.

My plan to filter this data is to first use your algortithm to remove the outliers, and then feed that filtered data into a kalman filter. Does this seem logical to you? Or do you know of a better approach?

The second point is in regard to a comment you made:

Please note that technically, including outliers does not count as a real "Hampel" filter. In a real "Hampel" filter, outliers are replaced by the median value of the buffer. Since I did not have many outliers in data I worked with in the past, I went without that functionality. Below is a plot of data I worked with and used the filter in. It did a good job!

Would this be a problem for me? In other words, do you think I should add the removal of outliers to improve performance?

Lastly, since you seem to know a lot more about filters than I do, do you have any tips?

flrs commented 3 years ago

Hi @huub8, how is your project going? Regarding your filter problem I think it is a good idea to try different approaches. Not every filter will work well for all kinds of data.

Regarding your second point, I would say if your data are very noisy and outliers are skewed to one side, you may encounter some trouble with the filter.

When working with filters I always found it useful to also think about where your noise is coming from and if there may be a way to reduce that noise using other methods than a filter. For example, if you get a more accurate UWB system, that may already help your problem.

If it was me solving this problem, I would just try the filter and see if it helps reduce the kind of noise you are seeing.

flrs commented 1 year ago

Since there has not been any update, I am closing this issue.