diff --git a/dlib/filtering/kalman_filter.h b/dlib/filtering/kalman_filter.h index dc1145949..7de414fbc 100644 --- a/dlib/filtering/kalman_filter.h +++ b/dlib/filtering/kalman_filter.h @@ -36,6 +36,13 @@ namespace dlib void set_process_noise ( const matrix& Q_) { Q = Q_; } void set_measurement_noise ( const matrix& R_) { R = R_; } void set_estimation_error_covariance( const matrix& P_) { P = P_; } + void set_state ( const matrix& xb_) { + xb = xb_; + if (!got_first_meas) { + x = xb_; + got_first_meas = true; + } + } const matrix& get_observation_model ( ) const { return H; } diff --git a/dlib/filtering/kalman_filter_abstract.h b/dlib/filtering/kalman_filter_abstract.h index d5eb3fe92..a2eae3422 100644 --- a/dlib/filtering/kalman_filter_abstract.h +++ b/dlib/filtering/kalman_filter_abstract.h @@ -93,6 +93,18 @@ namespace dlib understand what you are doing.) !*/ + void set_state ( + const matrix& xb + ); + /*! + ensures + - #get_predicted_next_state() == xb + - If update() is never called with a measurement + #get_current_state() == get_predicted_next_state() + (Can be used when the initial state is known, or if the state needs to be corrected + before the next update()) + !*/ + const matrix& get_observation_model ( ) const; /*!