diff options
author | Martin Miller | 2017-03-17 21:31:12 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-17 21:31:12 -0500 |
commit | 6e0de4f0d4fac653dde826712e81cee95b470195 (patch) | |
tree | f19eb814f3f375a9a1651a223b72b4de930a4667 /src/body.cpp | |
parent | 622d6805689aec4f6619c5e2edd026850d8c2498 (diff) | |
download | refslam-6e0de4f0d4fac653dde826712e81cee95b470195.zip refslam-6e0de4f0d4fac653dde826712e81cee95b470195.tar.gz |
Integration is implemented. But there are problems.
The coordinates are not working correctly. When I run integration on a
known dataset the body seems to turn in the opposite direction of
reality. It's probably best to change it to NED and FRD. Currenty it is
ENU and RFU.
Diffstat (limited to 'src/body.cpp')
-rw-r--r-- | src/body.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/body.cpp b/src/body.cpp new file mode 100644 index 0000000..b9ea683 --- /dev/null +++ b/src/body.cpp @@ -0,0 +1,50 @@ +/* + * ===================================================================================== + * + * Filename: body.cpp + * + * Description: Method definitions for body class. + * + * Version: 1.0 + * Created: 03/17/2017 08:07:35 PM + * Revision: none + * Compiler: gcc + * + * Author: Martin Miller (MHM), miller7@illinois.edu + * Organization: Aerospace Robotics and Controls Lab (ARC) + * + * ===================================================================================== + */ + +#include <Eigen/Dense> +#include "body.h" + + void +Body::motionModel ( Matrix<double,9,1> &X, const Vector3d &acc, const Vector3d &ang, const Quaternion<double> &q, const double dt) +{ + Vector3d bias(X.segment(6,3)); + Vector3d gravity_world(0.,0.,-9.80655); + + Matrix<double,6,3> A; + Matrix<double,6,1> b; + A = Matrix<double,6,3>::Zero(); + b = Matrix<double,6,1>::Zero(); + + Matrix<double,3,3> Rbw(q.toRotationMatrix()); + A.block(0,0,3,3) = Rbw; + Matrix<double,3,3> W; + skewSymmetric(ang,W); + A.block(3,0,3,3) = -W; + b.segment(3,3) = acc-bias+Rbw.transpose()*gravity_world; + + X.segment(0,6) += (A*X.segment(3,3)+b)*dt; + return ; +} /* ----- end of method Body::motionModel ----- */ + + void +Body::skewSymmetric ( const Vector3d &x, Matrix<double,3,3> &y ) +{ + y << 0.,-x[2], x[1], x[2],0.,-x[0],-x[1],x[0],0.; + return ; +} /* ----- end of method Body::skewSymmetric ----- */ + |