summaryrefslogtreecommitdiff
path: root/src/feature.h
blob: c8b835ee9ec73cf12d8a711c0288e426165cc0cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef  feature_INC
#define  feature_INC
#include <Eigen/Dense>
#include <iostream>
#include "types.h"

using Eigen::Vector2d;
using Eigen::Vector3d;
using Eigen::Matrix;
using Eigen::MatrixXd;
using Eigen::Quaterniond;
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);

        /* ====================  ACCESSORS     ======================================= */
        int id();
        Matrix<double,3,3> P0();
        UTM utm(Vector3d &xbw, Quaterniond &q); 

        /* ====================  MUTATORS      ======================================= */
        void motionModel ( const Vector3d &ang, const Vector3d &vel, const double dt);
        void dx( const Vector3d &del);

        /* ====================  OPERATORS     ======================================= */
        bool sane();
        bool inFOV();
        Vector3d findDepth( const Quaterniond &q, double z, const Vector3d &xs,
                const Vector3d &xr);
        Matrix<double,3,9> Fx( double dt );
        Matrix<double,3,3> Fy( const Vector3d &vel, const Vector3d &ang, double dt);
        Matrix<double,6,9> Hx( const Vector3d &pos, const Quaterniond &q);
        Matrix<double,6,3> Hy( const Vector3d &pos, const Quaterniond &q);
        Matrix<double,6,1> h( const Vector3d &x, const Quaterniond &q);
        Matrix<double,3,6> L();
        Matrix<double,6,1> measurement_vector(const Vector3d &xs, const Vector3d &xr);

        Matrix<double,3,3> Q(const double dt);
        Matrix<double,6,6> R();
        Matrix<double,6,6> S ( const Matrix<double,9,9> &Pxx, const Matrix<double,9,3> &Pxy,
            const Matrix<double,3,3> &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  ----- */