Kalman Filter Tutorial #458
Replies: 2 comments
-
Hi @jasonbeach Thanks for your interest in the library 😉 I must admit that I do not have much experience in Kalman filters. Also, as you stated, there is no library algebra library on the market that allows different types of matrix rows/columns, at least until we will do it based on https://www.youtube.com/watch?v=4LmMwhM8ODI. The types in Some comments:
kalman_filter-example_1.cpp using state = kalman::state<quantity<isq::mass[g]>>;
const state initial = {1 * kg}; kalman_filter-example_2.cpp using state = kalman::state<quantity<isq::position_vector[m]>, quantity<isq::velocity[m / s]>>;
const state initial = {30 * km, 40 * (m / s)}; kalman_filter-example_4.cpp using state = kalman::state<quantity<isq::position_vector[m]>, quantity<isq::velocity[m / s]>,
quantity<isq::acceleration[m / s2]>>;
const state initial = {30 * km, 50 * (m / s), 0 * (m / s2)}; kalman_filter-example_5.cpp const estimation initial = {state{isq::height(60. * m)}, pow<2>(isq::height(15. * m))}; kalman_filter-example_8.cpp const estimation initial = {state{quantity_point{10. * deg_C}}, pow<2>(100. * deg_C)}; Please note that in the last example, I used it with temperatures, so your example would not work. Also, I would need at least three such fixed structures for different numbers of quantities and their different types. |
Beta Was this translation helpful? Give feedback.
-
There are two parts to a good solution for combining linear algebra with units of measure.
In my library, this future work is tracked in aurora-opensource/au#70. Here's the gist of the state of affairs.
There is some chance I'd be able to fix up the proof of concept I did a couple of years ago, and add it under a new If this does end up happening, it would support mixed-unit vectors and matrices, which I assume would be good enough for the kalman filter example. It would also show people how to implement this kind of matrix wrapper, which could stimulate some to make their own. It's not especially likely that I'll be able to do this any time soon, but hey, there's a chance! |
Beta Was this translation helpful? Give feedback.
-
I've been trying to wade through the Kalman Filter tutorial. I'm relatively experienced with C++ but not particularly strong with template meta-programming so to be honest,
kalman.h
is a bit daunting and is why I haven't really started using the library even though I've been aware of it for some time (still trying to figure out how to have a matrix of mixed units.) I really want to though.Looking at it again yesterday I think a better example would be to allow the user to define the state specific to the use-case as opposed to have a generic state struct that is a giant tuple. So instead of
making it simply something like
This more than likely wouldn't allow the generic
state_update
,covariance_update
andstate_extrapolation
functions.I tried to extend example2 (tracking the constant velocity aircraft in one dimension to two dimensions, but the generic definitions in the
kalman.h
didn't appear to support this and it wasn't obvious what needed to change to support this.I guess defining state the way it is in the example gives it a vector like feel--a mathematical vector is what you would ideally need to do the linear algebra properly, but I didn't see any obvious examples of using units in a matrix. I believe this was something @chiphogg was working on too).
So I guess I'm curious what other's experiences are in using this library in a linear algebra / more complex filtering contexts are.
Beta Was this translation helpful? Give feedback.
All reactions