JKalman(工事中)
JKalmanで遊ぼう。
Jkalmanとは
Jkalman関係の資料
javadoc
Jkalmanの機能概要
状態空間モデルは、以下のように表される。
(1) System dynamic model(システムノイズwは、正規分布N(0,Q)に従う白色ノイズと仮定する)
xt = Axt-1 + But-1 + w
(2) Measurement model(観測ノイズvは、正規分布N(0,R)に従う白色ノイズと仮定する)
yt = Hxt + v
Figure 1. The dynamic process illustration.
Kalman filterの動作は、以下のように表される。
予測ステップ(Predict)
(1) Project the state ahead
x-t = Axt-1 + But-1
(2) Project the error covaniance ahead
P-t = APt-1AT + Q
フィルタリングステップ(Correct)
(1) Compute the Kalman gain
Kt = P-tHT(HP-tHT + R)-1
(2) Update estimate with measurment yt
xt = x-t + Kt(yt - Hx-t)
(3) Updatet the error covaniance
Pt = (I - KtH)P-t
Figure 2. Operation of Kalman filter, combining the high-level diagram with the equations.
Jkalmanの使い方
Jkalmanの生成
コンストラクタ1:制御入力がない場合
JKalman(int dynam_params, int measure_params)
例
JKalman kalman = new JKalman(4, 2);
コンストラクタ2:制御入力がある場合
JKalman(int dynam_params, int measure_params, int control_params)
例
JKalman kalman = new JKalman(4, 2, 2);
Jkalmanの初期化
JKalman kalman = new JKalman(4, 2, 2); // constant velocity dx = 0.2; dy = 0.2; s = new Matrix(4, 1); // state [x, y, dx, dy, dxy] c = new Matrix(4, 1); // corrected state [x, y, dx, dy, dxy] m = new Matrix(2, 1); // measurement [x] m.set(0, 0, 0); m.set(1, 0, 0); // transitions for x, y, dx, dy double[][] tr = { {1, 0, dx, 0}, {0, 1, 0, dy}, {0, 0, 1, 0}, {0, 0, 0, 1} }; kalman.setTransition_matrix(new Matrix(tr)); // 1s somewhere? kalman.setError_cov_post(kalman.getError_cov_post().identity());
Predict関数(制御入力がない場合)
Predict()
動的計画法では、価値関数と言うのが出てきます。 しかし、なぜ、価値関数を導入する必要があったのかの説明がないのです。
Predict関数(制御入力がある場合)
Predict(Matrix control)
動的計画法では、価値関数と言うのが出てきます。 しかし、なぜ、価値関数を導入する必要があったのかの説明がないのです。
お花畑5