From fde220c19346797c4d55c2f479f7efb2f8c9073a Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Sat, 18 Mar 2017 14:32:52 -0500 Subject: Add support for INSCOVS. The position and velocity covariances are rotated into the correct frames: NED and FRD. --- src/body.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) (limited to 'src/body.cpp') diff --git a/src/body.cpp b/src/body.cpp index daf4e69..330c0a8 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -19,7 +19,64 @@ #include #include "body.h" - void +/* + *-------------------------------------------------------------------------------------- + * Class: Body + * Method: Body :: H + * Description: Writes the Jacobian of the measurement model into H. + *-------------------------------------------------------------------------------------- + */ +void +Body::H ( Matrix &H ) +{ + H = Matrix::Zero(); + H[0,2] = 1; + return ; +} /* ----- end of method Body::H ----- */ + + +/* + *-------------------------------------------------------------------------------------- + * Class: Body + * Method: Body :: h + * Description: Writes the predicted measurement vector into h. + *-------------------------------------------------------------------------------------- + */ +void +Body::h ( const Matrix &X, Matrix &h ) +{ + h[0] = X[2]; + return ; +} /* ----- end of method Body::h_hat ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: Body + * Method: Body :: F + * Description: Computes the Jacobian of the motion model of the body. + *-------------------------------------------------------------------------------------- + */ +void +Body::F ( const Matrix &X, const Vector3d &ang, const Quaternion &q ) +{ + Matrix F = Matrix::Zero(); + Matrix Rbw(q.toRotationMatrix()); + Matrix W; + skewSymmetric(ang,W); + F.block(0,3,3,3) = Rbw; + F.block(3,3,3,3) = -W; + F.block(3,6,3,3) = -Matrix::Identity(); + return ; +} /* ----- end of method Body::F ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: Body + * Method: Body :: motionModel + * Description: Propagates the motion model of the body into vector X. + *-------------------------------------------------------------------------------------- + */ +void Body::motionModel ( Matrix &X, const Vector3d &acc, const Vector3d &ang, const Quaternion &q, const double dt) { Vector3d bias(X.segment(6,3)); @@ -41,10 +98,18 @@ Body::motionModel ( Matrix &X, const Vector3d &acc, const Vector3d & return ; } /* ----- end of method Body::motionModel ----- */ - void +/* + *-------------------------------------------------------------------------------------- + * Class: Body + * Method: Body :: skewSymmetric + * Description: Create the skew symmetric matrix y from the vector x. + *-------------------------------------------------------------------------------------- + */ +void Body::skewSymmetric ( const Vector3d &x, Matrix &y ) { y << 0.,-x[2], x[1], x[2],0.,-x[0],-x[1],x[0],0.; return ; } /* ----- end of method Body::skewSymmetric ----- */ + -- cgit v1.1