Giter Site home page Giter Site logo

simplekalmanfilter's People

Contributors

denyssene avatar edjopato avatar iansc avatar majorarkwolf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplekalmanfilter's Issues

Stm32 bluepill support

Hello,
Good day.
Does this library support STM32 blue pill? As Bluepill is a 32-bit MCU.
Please let me know.

Feature request: Weighted inputs

I would like to request a new feature.

It would be nice to have a version that accepts two values, the value to be filtered, and the values weight.

The weight is used as a means to tell the filter how much influence the current value should have on the next estimate.

Is this something we can implement?

Question concerning err_estimate

Hi! Compared to Professor Michel van Biezen lectures, in the following line:

_err_estimate = (1.0f - _kalman_gain)*_err_estimate + fabsf(_last_estimate-_current_estimate)*_q;

where this additional formula + fabsf(_last_estimate-_current_estimate)*_q not explained by the Pr comes from? I remember when I tried Pr formulas, my Kalman did not succeed to filter high fluctuations in the signal, with this extra code it works.

Thanks!

Kalman for dummies

Hi,
I must say this was the best library I found in a while. Kalman filter is just what I was missing in my project. I have tried all sorts of averages moving averages IIR FIR but this filter is just superb at filtering noise while still having decent response time.
I am not really strong at this level of mathematics and I was wondering if you could explain fine tuning of this filter.
I just would like to know how the filter actually changes with change in those constants e_mea, q and if I understand correctly e_est don't have to worry about since the filter adjusts it anyway.
I can see that if I increase e_mea or decrease q the response is slower but I would love to be able to fine tune and understand how to fine tune the filter. Can you give me some sort of kalman filter for dummies info, please?
thank you
Josef

Change the "Always start at 0" behaviour?

With the current behaviour the Filter starts at 0. This results in a high error estimate at the beginning.

What about setting the first value as the start value instead? the starting error estimate would have more impact then.

A possible implementation of this could be the following code. the Gain can never be 0 with a positive error in the measurement so this is only the case for the first value.

float SimpleKalmanFilter::updateEstimate(float mea)
{
  if (_kalman_gain == 0.0) {
    _last_estimate = mea;
  }
  […]
}

Is this useful? Or do is miss something?

handling millis() rollover in the example

In the altitude example or the basic example

this type of construct

  if (millis() > refresh_time) {
    ...
    refresh_time=millis()+SERIAL_REFRESH_TIME;
  }

will lead to an incorrect behaviour
Not only refresh_time as a signed long so will become negative (so best would be to declare it as unsigned long, which is millis() returned type) but in ~50 days refresh_time will rollover to 0 whilst millis() will stay at a huge value and thus you'll trigger the display right away.

the typical way to handle this is through subtraction, not addition. I suggest the following code

#include <SimpleKalmanFilter.h>

/*
  This sample code demonstrates how to use the SimpleKalmanFilter object.
  Use a potentiometer in Analog input A0 as a source for the reference real value.
  Some random noise will be generated over this value and used as a measured value.
  The estimated value obtained from SimpleKalmanFilter should match the real
  reference value.

  SimpleKalmanFilter(e_mea, e_est, q);
  e_mea: Measurement Uncertainty
  e_est: Estimation Uncertainty
  q: Process Noise
*/

SimpleKalmanFilter simpleKalmanFilter(2, 2, 0.01);

// Serial output refresh time
const unsigned long SERIAL_REFRESH_TIME = 100;
unsigned long last_refresh_time = -SERIAL_REFRESH_TIME;

void setup() {
  Serial.begin(115200);
  while (!Serial); // wait for serial port to connect. Needed for native USB boards
}

void loop() {

  // read a reference value from A0 and map it from 0 to 100
  float real_value = analogRead(A0) / 1023.0 * 100.0;

  // add a noise to the reference value and use as the measured value
  float measured_value = real_value + random(-100, 100) / 100.0;

  // calculate the estimated value with Kalman Filter
  float estimated_value = simpleKalmanFilter.updateEstimate(measured_value);

  // send to Serial output every SERIAL_REFRESH_TIME ms (here every 100ms)
  // use the Serial Ploter for a good visualization
  if (millis() - last_refresh_time >= SERIAL_REFRESH_TIME) {
    Serial.print(real_value, 4);
    Serial.write(',');
    Serial.print(measured_value, 4);
    Serial.write(',');
    Serial.println(estimated_value, 4);
    last_refresh_time += SERIAL_REFRESH_TIME; // or last_refresh_time = millis();
  }
}

same approach would also work for the altitude example.

Please update the release version to 0.1.1 to cover the new getEstimateError() functionality.

Per arduino/Arduino#10119 (comment) it looks like one should update the version in

with a new version number (0.2 or 0.1.1 or 0.2.0?) so that Arduino would pick up and propagate the new capability in 16478b0

Also update the version in

"version": "0.1.0",
to match

Otherwise the code and documentation won't match the version installed by Arduino.

Example for RSSI Signal

Please, if possible, add some example to use the lib for filter an RSSI signal (from BLE or Wifi).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.