Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/callumjhays/elm-kalman-filter
Simple 1D Kalman Filters in Elm
https://github.com/callumjhays/elm-kalman-filter
elm elm-lang kalman kalman-filter kalman-filtering signal-processing signals
Last synced: about 1 month ago
JSON representation
Simple 1D Kalman Filters in Elm
- Host: GitHub
- URL: https://github.com/callumjhays/elm-kalman-filter
- Owner: CallumJHays
- License: mit
- Created: 2017-04-26T01:37:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-28T16:14:50.000Z (over 7 years ago)
- Last Synced: 2024-11-21T00:59:30.750Z (about 1 month ago)
- Topics: elm, elm-lang, kalman, kalman-filter, kalman-filtering, signal-processing, signals
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/CallumJHays/elm-kalman-filter/2.0.2
- Size: 57.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-kalman-filter
Simple 1D Kalman filters in Elm![kalman filter graph](https://raw.githubusercontent.com/CallumJHays/elm-kalman-filter/master/example.png "Example of a Kalman Filter acting on a noisy quadratic signal")
## Installation
```bash
elm package install CallumJHays/elm-kalman-filter
```## Example
```elm
-- `model.noise` contains 100 gaussian-random numbers generated by
-- elm-community/random-extra: `Random.Float.standardNormal`xAxis =
List.Range 0 1000-- Apply a quadratic function
signal =
xAxis |> List.map (\x -> 0.001 * (x - 10) ^ 2 - (x - 10))noisySignal =
signal |> List.map2 (+) model.noisepredictedSignal : List Float
predictedSignal =
KalmanFilter.filter Nothing noisySignal
```## Getting Started
The `filter` functon is the easiest way to use a Kalman Filter:
```elm
predictedSignal : List Float
predictedSignal =
KalmanFilter.filter Nothing noisySignal
```However, it might not be the most appropriate for your use case. For example,
if your application recieves rolling updates of a signal from an API server
that you need filtered, it would be more appropriate to keep a copy of
`KalmanFilter.Model` in your application Model, and to use it along with
`KalmanFilter.filterMeasurement` to provide less noisy signals as they come in.One great concrete use-case for usage with an API server is multiplayer video-
games that require a mechanism for preventing [Rubber-banding](https://en.wikipedia.org/wiki/Rubber_banding). The Kalman filter may be used
without smoothing to observe the values being passed in (using `filter` with
the `Param.expectedNoisePower` parameter set to `0`). Backup values can then be
provided in durations when the network lags using `predictNext`. Of course,
this use-case would be far more relevant if this library was generalised to
N-Dimensional data (2D, 3D) - but that's still a work in progress :)