From f21a53aa32f9a005258b129c1e0ef5c7d71890df Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Fri, 31 Mar 2017 15:54:02 -0500 Subject: Add 1-Point RANSAC. 1-Pt RANSAC is a method for detecting outlier measurements in the EKF framework. This algorithm is as described in Civera 2010. --- src/state.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/state.h') diff --git a/src/state.h b/src/state.h index d223d0f..2383706 100644 --- a/src/state.h +++ b/src/state.h @@ -1,5 +1,6 @@ #ifndef state_INC #define state_INC +#include #include #include #include @@ -12,9 +13,8 @@ #define MAXFEATURES 50 #define COVBIAS 2e-5 //#define FASTMOTIONMODEL // Uncomment this to perform motion model update on all features at once -#define FULLS // Comment out to treat each measurement independently. -//#define BLOCKSI -//#define MEAS1 +#define DORANSAC /* */ + using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd; @@ -24,6 +24,7 @@ using Eigen::Vector3d; using std::cout; using std::cerr; using std::endl; + /* * ===================================================================================== * Class: State @@ -37,8 +38,10 @@ class State State (); /* constructor */ /* ==================== ACCESSORS ======================================= */ + Matrix asVector(); bool exists(int id); int rowById(int id); + int iById(int id); Feature *featureById(int id); MatrixXd F(const Quaterniond &q, const Vector3d &w, double dt); MatrixXd H ( const Quaterniond &q, const std::vector &z ); @@ -53,16 +56,21 @@ class State /* ==================== MUTATORS ======================================= */ void accelerometer_bias(const Vector3d &b); + void asVector(const Matrix &m); void pos(const UTM &utm); void handle_measurements( const std::vector & z, const Quaterniond &q); void initializePi(int i, const Matrix &Pi); void kalmanUpdate( const MatrixXd &h, const MatrixXd &S, const std::vector &z, const Quaterniond &q); + void ransacUpdate(std::vector &z, const Quaterniond &q); void motionModel(const Vector3d &acc, const Vector3d &ang, const Quaterniond &q, const double dt); + MatrixXd partialUpdate( const MatrixXd &h, const MatrixXd &S, + const std::vector &z, const Quaterniond &q ); void Pkk1 ( const Vector3d &ang, const Quaterniond &q, const double dt); void position_covariance(const Matrix &p); - std::list::iterator removeFeature(std::list::iterator &i, int j); + std::list::iterator removeFeature(std::list::iterator &i, bool bl); + std::list::iterator removeFeature ( int id, bool bl ); void velocity_covariance(const Matrix &p); void vel(const Matrix &v); @@ -88,6 +96,7 @@ class State char utm_c; int utm_i; std::list features; + std::vector blacklist; }; /* ----- end of class State ----- */ -- cgit v1.1