-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Innovation function and other functions as inputs #168
Comments
Hello Matthew, yeah this is a good idea and should be quick to add. It's also generally useful when you perform filtering with DAE systems, where you may not be able to compute arithmetic means of points on some nonlinear manifold. |
Check out c5ee9c8 which I accidentally pushed as a commit to master instead of a PR branch :/ It adds support for custom mean and innovation functions. A custom covariance requires slightly more care since there are two different types of covariance computed in an UKF, the covariance of the dynamcis sigma points and the cross covariance between dynamics and output sigma points. You can pass a custom covariance function already in the commit above, but I did not yet document this feature since the custom covariance is only used for the dynamics points. Edit: This PR adds support for custom covariance functions as well. Please check it out and see if it satisfies your needs before I make a new release including this functionality :) |
Thanks heaps! I'll check this out today using my heading measurement function. |
Okay so I tested and the innovation function works well. The mean and covar functions work for the prediction step. However, in the measurement step I believe we'll need the ability to define the mean and covar functions there as well (as using the standard mean and covar functions for a set of angle sigma points is not correct). Another option could be to allow the user to input two residual functions (one for the state and one for the measurement) instead of a covar function (under the assumption that the covariance is computed using the residuals of the sigma points to the mean). In this case, a residual function would be used to compute the predicted state covariance and another residual function would be used to compute both the innovation and the innovation covariance. I'm not too sure how you've currently implemented the standard covariance function so I'm not sure if using a residual function inside it will work. This is how FilterPy implements it if you're interested:
and from there documentation:
|
I added separate functions for |
okay thanks for doing that. I'll be testing it with my code today |
I decided to redesign the internals of how the measurement update is handled, in I introduce the concept of a measurement model, which allows all Kalman-type filters to have one or several measurement models. This is useful to allow
|
I hope the new release addresses your issue, if not, feel free to continue the discussion here |
Hi, thanks for the great package. In the past I used FilterPy to create UKF's for vehicle state estimation. One important feature of FilterPy that I used was the ability to define an innovation function (see FilterPy UKF and the keyword argument
residual_z
).Defining your own innovation function is important in vehicle state estimation where measurements can be angles. For example, a magnetometer can measure the heading of the vehicle, so the innovation needs to be wrapped (if using
z = y -y_pred
with y = 1deg and y_pred = 359deg, then the innovation will be very large even though it should be small).Would you consider allowing the user to input in their own custom functions that override the internal functions in
predict!
andupdate!
? Other functions like the mean and covariance calculations would be useful to when the state includes a quaternion (see this paper, Section 3.4 on why a different mean function is required).The text was updated successfully, but these errors were encountered: