/* * ===================================================================================== * * Filename: state.cpp * * Description: A Class for managing body and features. * * Version: 1.0 * Created: 03/17/2017 07:55:56 PM * Revision: none * Compiler: gcc * * Author: Martin Miller (MHM), miller7@illinois.edu * Organization: Aerospace Robotics and Controls Lab (ARC) * * ===================================================================================== */ #include "state.h" void State::update (Matrix &X, Matrix &P, const Matrix H, const Matrix &h, const Matrix &z, const Matrix &R) { Matrix S; Matrix K; S = H*P*H.transpose() + R; K = P*H.transpose()*S.inverse(); P = (Matrix::Identity()-K*H)*P; P = 0.5*(P+P.transpose()); X += K*(z-h); } /* *-------------------------------------------------------------------------------------- * Class: State * Method: State :: Pkk1 * Description: Updates P_k|k-1 *-------------------------------------------------------------------------------------- */ void State::Pkk1 ( Matrix &P, const Matrix &F, const Matrix &Q ) { P = F*P*F.transpose()+Q; // Enforce symmetry P = 0.5*(P+P.transpose()); return ; } /* ----- end of method State::Pkk1 ----- */