From 27e98b8b0aedca320e45b5184b3e426e5913e1a3 Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Mon, 3 Apr 2017 15:10:47 -0500 Subject: Update body to use full state. The changes add quaternion estimation to the body state. The quaternion is still provided as an input, but it is ignored. --- src/body.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/body.h') diff --git a/src/body.h b/src/body.h index 7bbd50d..b973b00 100644 --- a/src/body.h +++ b/src/body.h @@ -9,6 +9,7 @@ //#define DOCLAMP #define MAXHEIGHT -1.5 /* Notion of max and min is reversed due to z pointing down */ #define MINHEIGHT -0.3 /* */ +#define FULLSTATE /* Uncomment to estimate quaternion */ using Eigen::Matrix; @@ -25,31 +26,42 @@ class Body { public: /* ==================== LIFECYCLE ======================================= */ - Body (){}; /* constructor */ + Body (){ gravity_world << 0.,0.,9.80655; }; /* constructor */ /* ==================== ACCESSORS ======================================= */ +#ifdef FULLSTATE + Matrix asVector(); + void asVector(const Matrix &m); + void dx( const Matrix &del); + Matrix F(const Vector3d &ang, const Quaterniond &q, double dt); + Matrix H(); + Matrix Q(double dt); + Matrix S(const Matrix &Pxx); +#else + Matrix F(const Vector3d &ang, const Quaterniond &q, double dt); Matrix asVector(); + void asVector(const Matrix &m); + void dx( const Matrix &del); + Matrix H(); + Matrix Q(double dt); + Matrix S(const Matrix &Pxx); +#endif Vector3d ned(); Vector3d vel(); /* ==================== MUTATORS ======================================= */ void accelerometer_bias( const Vector3d &b); - void asVector(const Matrix &m); void clamp(); void pos( const UTM &utm); - void dx( const Matrix &del); void vel(const Matrix &v); /* ==================== OPERATORS ======================================= */ - Matrix F(const Vector3d &ang, const Quaterniond &q, double dt); - Matrix H(); Matrix h(); void motionModel ( const Vector3d &acc, const Vector3d &ang, const Quaterniond &q, const double dt); - Matrix Q(double dt); Matrix R(); - Matrix S(const Matrix &Pxx); Matrix skewSymmetric(const Vector3d &x); + Matrix omega(const Vector3d &x); void unicsv(); protected: @@ -61,9 +73,14 @@ class Body /* ==================== METHODS ======================================= */ /* ==================== DATA MEMBERS ======================================= */ +#ifdef FULLSTATE + Matrix X; +#else Matrix X; +#endif char utm_c; int utm_i; + Vector3d gravity_world; }; /* ----- end of class Body ----- */ -- cgit v1.1