Merge lp:~vytng/kalmanfilterimpl/supprot_B_u into lp:kalmanfilterimpl

Proposed by Vy Thuy Nguyen
Status: Merged
Approved by: Vy Nguyen
Approved revision: 4
Merged at revision: 4
Proposed branch: lp:~vytng/kalmanfilterimpl/supprot_B_u
Merge into: lp:kalmanfilterimpl
Diff against target: 90 lines (+32/-5)
3 files modified
nbproject/private/private.properties (+1/-1)
src/kalmanfilter/KalmanFilter.java (+7/-3)
src/kalmanfilter/RunFilter.java (+24/-1)
To merge this branch: bzr merge lp:~vytng/kalmanfilterimpl/supprot_B_u
Reviewer Review Type Date Requested Status
Vy Nguyen Approve
Review via email: mp+112476@code.launchpad.net

Description of the change

- support B and u control signals
- change RunFilter accordingly

To post a comment you must log in.
Revision history for this message
Vy Nguyen (oontvoo) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nbproject/private/private.properties'
2--- nbproject/private/private.properties 2012-06-26 08:40:46 +0000
3+++ nbproject/private/private.properties 2012-06-28 02:32:21 +0000
4@@ -1,2 +1,2 @@
5 compile.on.save=true
6-user.properties.file=C:\\Users\\NhatPhan\\.netbeans\\7.1.2\\build.properties
7+user.properties.file=C:\\Users\\VyNguyen\\.netbeans\\7.1\\build.properties
8
9=== modified file 'src/kalmanfilter/KalmanFilter.java'
10--- src/kalmanfilter/KalmanFilter.java 2012-06-27 01:47:04 +0000
11+++ src/kalmanfilter/KalmanFilter.java 2012-06-28 02:32:21 +0000
12@@ -23,7 +23,6 @@
13
14 /**
15 * Implements the Kalman Filter using Jama's Matrix API
16- * For simplicity, the control input (signal) is assumed to be 0
17 *
18 * @author Vy Thao Nguyen
19 */
20@@ -39,8 +38,10 @@
21 private final Matrix I; // the identity matrix
22 private final Matrix A; // state matrix
23 private final Matrix R; // measurement noise covariance matrix
24+ private final Matrix B; // control input matrix
25+ private final Matrix u;
26
27- public KalmanFilter(Matrix X, Matrix P, Matrix Q, Matrix H, Matrix A, Matrix R)
28+ public KalmanFilter(Matrix X, Matrix P, Matrix Q, Matrix H, Matrix A, Matrix R, Matrix B, Matrix u)
29 {
30 this.X = X;
31 this.P = P;
32@@ -48,12 +49,15 @@
33 this.H = H;
34 this.A = A;
35 this.R = R;
36+ this.B = B;
37+ this.u = u;
38+
39 I = Matrix.identity(P.getRowDimension(), P.getColumnDimension());
40 }
41
42 public KalmanFilter timeUpdate()
43 {
44- X = A.times(X);
45+ X = A.times(X).plus(B.times(u));
46 P = A.times(P).times(A.transpose()).plus(Q);
47 return this; // for easy chaining
48 }
49
50=== modified file 'src/kalmanfilter/RunFilter.java'
51--- src/kalmanfilter/RunFilter.java 2012-06-28 00:21:09 +0000
52+++ src/kalmanfilter/RunFilter.java 2012-06-28 02:32:21 +0000
53@@ -63,7 +63,9 @@
54 getQ(),
55 getH(),
56 createA(inputs, 0),
57- createR(sensorNoise));
58+ createR(sensorNoise),
59+ createB(),
60+ createU());
61
62 for (int n = 1; n < inputs.size(); ++n)
63 {
64@@ -159,5 +161,26 @@
65 H.set(0, 0, 1);
66 return H;
67 }
68+
69+ /**
70+ * TODO: determine the value of B
71+ * (could take an argument)
72+ * @return
73+ */
74+ private static Matrix createB()
75+ {
76+ throw new UnsupportedOperationException();
77+ }
78+
79+ /**
80+ * TODO: similar to B
81+ *
82+ * @return
83+ */
84+ private static Matrix createU()
85+ {
86+ throw new UnsupportedOperationException();
87+ }
88+
89 private static final int VARS_COUNT = 6;
90 }

Subscribers

People subscribed via source and target branches

to all changes: