@@ -83,7 +83,7 @@ int main(int argc, char** argv)
83
83
// load Kalman Filter weighting matrices from file
84
84
ct::core::StateMatrix<state_dim> Q, dFdv;
85
85
ct::core::OutputMatrix<output_dim> R;
86
- dFdv.setIdentity (); // todo tune me!
86
+ dFdv.setIdentity ();
87
87
ct::core::loadMatrix (settingsFile, " kalman_weights.Q" , Q);
88
88
ct::core::loadMatrix (settingsFile, " kalman_weights.R" , R);
89
89
std::cout << " Loaded Kalman R as " << std::endl << R << std::endl;
@@ -92,7 +92,9 @@ int main(int argc, char** argv)
92
92
// create a sensitivity approximator to compute A and B matrices
93
93
std::shared_ptr<ct::core::SystemLinearizer<state_dim, control_dim>> linearizer (
94
94
new ct::core::SystemLinearizer<state_dim, control_dim>(oscillator));
95
- ct::core::SensitivityApproximation<state_dim, control_dim> sensApprox (dt, linearizer);
95
+
96
+ std::shared_ptr<ct::core::SensitivityApproximation<state_dim, control_dim>> sensApprox (
97
+ new ct::core::SensitivityApproximation<state_dim, control_dim>(dt, linearizer));
96
98
97
99
98
100
// the observer is supplied with a dynamic model identical to the one used above for data generation
@@ -103,8 +105,10 @@ int main(int argc, char** argv)
103
105
new ct::optcon::CTSystemModel<state_dim, control_dim>(oscillator_observer_model, sensApprox, dFdv));
104
106
105
107
// set up the measurement model
108
+ ct::core::OutputStateMatrix<output_dim, state_dim> dHdw;
109
+ dHdw.setIdentity ();
106
110
std::shared_ptr<ct::optcon::LinearMeasurementModel<output_dim, state_dim>> measModel (
107
- new ct::optcon::LTIMeasurementModel<output_dim, state_dim>(C));
111
+ new ct::optcon::LTIMeasurementModel<output_dim, state_dim>(C, dHdw ));
108
112
109
113
// set up Filter, e.g. extended Kalman or Unscented Kalman filter
110
114
ct::optcon::ExtendedKalmanFilter<state_dim, control_dim, output_dim> filter (
@@ -129,7 +133,7 @@ int main(int argc, char** argv)
129
133
// compute an observation
130
134
states_meas[i] = states[i];
131
135
132
- // todo this is technically not correct, the noise enters not on the state but on the output!!!
136
+ // note that this is technically not correct, the noise enters not on the state but on the output!!!
133
137
position_measurement_noise.noisify (states_meas[i](0 )); // Position noise.
134
138
velocity_measurement_noise.noisify (states_meas[i](1 )); // Velocity noise.
135
139
ct::core::OutputVector<output_dim> y = C * states_meas[i];
0 commit comments