From f683e1e8be18de841c714f3bf8ec15d2d0b68a75 Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Tue, 4 Apr 2017 11:25:20 -0500 Subject: Begin updating Feature to use FULLSTATE --- src/feature.cpp | 24 ++++++++++++++++++++++++ src/feature.h | 21 ++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/feature.cpp b/src/feature.cpp index a75fdf0..c9cdda1 100644 --- a/src/feature.cpp +++ b/src/feature.cpp @@ -130,10 +130,19 @@ Feature::findDepth ( const Quaterniond &qbw, double z, const Vector3d &xs, *-------------------------------------------------------------------------------------- */ Matrix +#ifdef FULLSTATE +Feature::S ( const Matrix &Pxx, const Matrix &Pxy, + const Matrix &Pyy, const Vector3d &pos, const Quaterniond &q) +#else Feature::S ( const Matrix &Pxx, const Matrix &Pxy, const Matrix &Pyy, const Vector3d &pos, const Quaterniond &q) +#endif { +#ifdef FULLSTATE + Matrix hx; +#else Matrix hx; +#endif Matrix hy; hx = Hx( pos, q); hy = Hy( pos, q); @@ -341,17 +350,28 @@ Feature::x2p ( const Vector3d &x ) * body. *-------------------------------------------------------------------------------------- */ +#ifdef FULLSTATE +Matrix +#else Matrix +#endif Feature::Fx ( double dt ) { double y0,y1,y2; y0 = X[0]; y1 = X[1]; y2 = X[2]; +#ifdef FULLSTATE + Matrix F; + F << 0., 0., 0., y0*y2,-y2, 0.,0,0,0,0,0,0,0, + 0.,0.,0., y1*y2, 0.,-y2, 0,0,0,0,0,0,0, + 0,0,0, y2*y2, 0, 0, 0,0,0,0,0,0,0; +#else Matrix F; F << 0., 0., 0., y0*y2,-y2, 0.,0,0,0, 0.,0.,0., y1*y2, 0.,-y2, 0,0,0, 0,0,0, y2*y2, 0, 0, 0,0,0; +#endif F *= dt; return F; } /* ----- end of method Feature::Fx ----- */ @@ -388,7 +408,11 @@ Feature::Fy ( const Vector3d &v, const Vector3d &w, double dt ) return F; } /* ----- end of method Feature::Fy ----- */ +#ifdef FULLSTATE +Matrix +#else Matrix +#endif Feature::Hx ( const Vector3d &pos, const Quaterniond &q ) { double xbw1,xbw2,xbw3; diff --git a/src/feature.h b/src/feature.h index db4f05e..6260d71 100644 --- a/src/feature.h +++ b/src/feature.h @@ -58,16 +58,30 @@ class Feature /* ==================== OPERATORS ======================================= */ bool sane(); +#ifdef FULLSTATE + bool isInlier(const measurement_t &z, const Matrix &Pxx, + const Matrix &Pxy, const Matrix &Pyy, + const Vector3d &pos, const Quaterniond &q, double thr); + Matrix Fx( double dt ); + Matrix Hx( const Vector3d &pos, const Quaterniond &q); + Matrix S ( const Matrix &Pxx, + const Matrix &Pxy, const Matrix &Pyy, + const Vector3d &pos, const Quaterniond &q); +#else bool isInlier(const measurement_t &z, const Matrix &Pxx, const Matrix &Pxy, const Matrix &Pyy, const Vector3d &pos, const Quaterniond &q, double thr); + Matrix Fx( double dt ); + Matrix Hx( const Vector3d &pos, const Quaterniond &q); + Matrix S ( const Matrix &Pxx, + const Matrix &Pxy, const Matrix &Pyy, + const Vector3d &pos, const Quaterniond &q); +#endif bool isRansacInlier(const measurement_t &z, const Vector3d &pos, const Quaterniond &q); bool inFOV(); Vector3d findDepth( const Quaterniond &q, double z, const Vector3d &xs, const Vector3d &xr); - Matrix Fx( double dt ); Matrix Fy( const Vector3d &vel, const Vector3d &ang, double dt); - Matrix Hx( const Vector3d &pos, const Quaterniond &q); Matrix Hy( const Vector3d &pos, const Quaterniond &q); Matrix h( const Vector3d &x, const Quaterniond &q); Matrix L(); @@ -76,9 +90,6 @@ class Feature Matrix Q(const double dt); Matrix R(); - Matrix S ( const Matrix &Pxx, - const Matrix &Pxy, const Matrix &Pyy, - const Vector3d &pos, const Quaterniond &q); Vector3d p2x(const Vector3d &p); Vector3d x2p(const Vector3d &x); -- cgit v1.1