#ifndef feature_INC #define feature_INC #include #include #include "types.h" #define FEATURE_NOISE 1e-3 /* Feature process noise */ #define VIEW_NOISE 5e-3 /* */ #define INITIAL_VIEW_NOISE 1e-1 /* */ #define REFLECTION_VIEW_NOISE 5e-3 /* */ #define FEATURECOVX .01 /* */ #define FEATURECOVY .01 /* */ #define FEATURECOVRHO 25e-4 /* */ #define FEATURECOVRHO_MONO 0.5 /* */ #define RHO_0 1./10. /* */ #define INLIER_THRESHOLD 5.9915 /* */ #define RANSAC_LI_THRESHOLD 4e-5 /* */ #define RANSAC_HI_THRESHOLD 5e-2 /* */ using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd; using Eigen::Quaterniond; using Eigen::Vector2d; using Eigen::Vector3d; using std::cout; using std::cerr; using std::endl; /* * ===================================================================================== * Class: Feature * Description: * ===================================================================================== */ class Feature { public: /* ==================== LIFECYCLE ======================================= */ Feature ( int id, const Vector3d &xs, const Vector3d &xr, const Vector3d &xbw, const Quaterniond &q, double z); Feature ( int id, const Vector3d &xs, const Vector3d &xbw, const Quaterniond &q); /* ==================== ACCESSORS ======================================= */ int id(); Matrix P0(measurement_type t); Vector3d asVector(); UTM utm(Vector3d &xbw, Quaterniond &q); /* ==================== MUTATORS ======================================= */ void asVector(const Vector3d &m); void motionModel ( const Vector3d &ang, const Vector3d &vel, const double dt); void dx( const Vector3d &del); /* ==================== OPERATORS ======================================= */ bool sane(); bool isInlier(const measurement_t &z, const Matrix &Pxx, const Matrix &Pxy, const Matrix &Pyy, const Vector3d &pos, const Quaterniond &q, double thr); 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(); Matrix measurement_vector(const Vector3d &xs, const Vector3d &xr); Matrix measurement_vector( const Vector3d &xs ); 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); protected: /* ==================== METHODS ======================================= */ /* ==================== DATA MEMBERS ======================================= */ private: /* ==================== METHODS ======================================= */ /* ==================== DATA MEMBERS ======================================= */ int _id; Vector3d X; Vector3d X0; Quaterniond q0; Vector3d xb0w; }; /* ----- end of class Feature ----- */ #endif /* ----- #ifndef feature_INC ----- */