I'm currently polishing flight control system for KSP, and I'm fightinng high-frequency noise in state vector measurements right now. I want to try to apply Kalman filter to provide more smooth values for controller inputs, but I have two major math concerns:
1). $ x_i = F_i x_{i-1} + B_i u_i + w_i $ - standard Kalman filter state transition model. It is linear, and it's ok, I've linearized flight model (got linear time-variant system), but to the form of $ x_{i+1} = A x_i + B u_i + C $, where C is bias vector, which comes from linear diffirential equations. For example, aerodynamics torque model: $ torque = k_0 + k_1 * AoA + k_2 * u $, where $k_0$ is the source of bias. How do I accomodate $ C $ in Kalman filter? Should I introduce fictional state, which is always 1, and if yes - what will change in predict-update sense? And why do most internet sources on time-domain control theory have standard system definition form as $ x_i = A x_{i-1} + B u_i $, without a bias vector?
2). Model laws are linear and simple, but coefficient values are unknown until the fight itself. I use batched weighted least squares in real-time in the background to get estimated model koefficients, for example $k_0$, $k_1$ and $k_2$, batch is formed from recent measurements of state vector and some generalization buffers. How risky is to use regressed model with Kalman filter, will it converge? Can I put filter outputs instead of measurements states into regressor, or it will cause positive feedback of errors and divert filter from true state? Or should I simply use workflow: measurements to regressor and filter, model from regressor to filter, filtered state to filter on next step and to controllers?
Thank you.
1) By definition, a system of the form $ x_{k+1} = A x_k + B u_k + c$ is called "affine linear".
As said by A.G., one can find a steady state solution $ \bar{x} = A \bar{x} + B \bar{u} + c $ and create a new system with dynamics $ \tilde{x}_{k+1} = A \tilde{x}_k + B \tilde{u}_k $ where $ \tilde{x}_k = x_k - \bar{x} $ and $ \tilde{u}_k = u_k - \bar{u} $.
However, for the KF case, the derivation does not change (If you want the derivation I edit the question and give it to you). You just need to include the $c$ term into the state prediction equation. The covariance updates stay the same.
2) Parameter estimation coupled with state estimation have no guaranteed convergence, since the resulting dynamics considering both are nonlinear. For this reason convergence depends on the choice of parameters for your filter.
You could use the regressor and the linear Kalman filter as you are doing right now. Or you could append your parameters to your state vector and use a Extended Kalman Filter or Unscented Kalman Filter.