File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -522,12 +522,16 @@ impl UKF {
522522 self . mean_state [ 8 ] = wrap_to_2pi ( self . mean_state [ 8 ] ) ;
523523 // Switch to Joseph Form update here
524524 // P = (I - K * H) P (I - K H)^T + K R K^T
525- let I = DMatrix :: < f64 > :: identity ( self . state_size , self . state_size ) ;
526- let P = self . covariance . clone ( ) ;
527- //self.covariance -= &k * s * &k.transpose();
525+ let i = DMatrix :: < f64 > :: identity ( self . state_size , self . state_size ) ;
526+ let p = self . covariance . clone ( ) ;
527+ // println!("Updating covariance matrix");
528+ // println!("Kalman gain: {:?}", k.shape());
529+ // println!("Cross covariance: {:?}", cross_covariance.shape());
530+ let m = & i - & k * & cross_covariance. transpose ( ) ;
528531 self . covariance =
529- ( & I - & k * & cross_covariance ) * & P * ( & I - & k * & cross_covariance ) . transpose ( )
532+ & m * & p * & m . transpose ( )
530533 + & k * measurement. get_noise ( ) * & k. transpose ( ) ;
534+ //self.covariance -= &k * s * &k.transpose();
531535 }
532536}
533537#[ derive( Clone , Debug , Default ) ]
You can’t perform that action at this time.
0 commit comments