summaryrefslogtreecommitdiff
path: root/src/types.h
blob: b9a5560def8608c5c94ecad2bcf018d0ccc0fcd9 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef  types_INC
#define  types_INC

#include <opencv2/core.hpp>
#include <Eigen/Dense>
#include <exception>
#define MAXLINE 8192
#define MAXFILENAME 1024
#define STATESIZE 13            /* Set to 13 for quaternion estimation, or 9 for quaternion as input  */
#define INLIER_THRESHOLD 24.
#define PATCHSIZE 51            /* must be odd */
using Eigen::Matrix;
using Eigen::Matrix3d;
using Eigen::Quaterniond;
using Eigen::Vector2d;
using Eigen::Vector3d;
using Eigen::Vector4d;

extern double feature_noise;
extern double view_noise;
extern double initial_view_noise;
extern double reflection_view_noise;

extern double r_height;
extern double acc_std;
extern double ang_std;
extern double acc_bias_std;

extern double canoecenter;
extern double canoeheight;

typedef Eigen::Matrix<double,2,1,Eigen::DontAlign> UVector2d;
// A struct for storing measurements.
typedef enum {BOTH,REFLECTION,MONO,HEIGHT} measurement_type;
typedef struct {
    measurement_type z_type;
    int id;
    Vector3d source, reflection;
    double height;
    double Ssrc[2];
    double Sref[2];
    cv::Mat patch, refpatch;
    double xcorrmax;
} measurement_t;

// A struct for storing PVA covariance.
typedef struct {
    Matrix3d position,velocity,attitude;
} covariance_t;

// A struct for storing x,y,z data.
typedef struct {
    double x,y,z;
} tuple;

// A struct for storing velocity in world frame
typedef struct {
    double east, north, up;
} velocity_t;

// A struct for storing attitude data.
typedef struct {
    double roll,pitch,yaw;
} attitude_t;

// A struct for storing UTM data.
typedef struct {
    double northing,easting,up;
    int zone_i;
    char zone_c;
} UTM;

// A struct for storing GPS data.
typedef struct {
    double latitude, longitude, altitude;
} gps;

// Message types
typedef enum {BESTUTM,IMG,INSCOVS,INSPVAS,RAWIMUS} message_type;

/*
 * The message struct is a general container for all message types. Not all
 * members are used for all messages, so care must be taken not to use garbage
 * values. 
 */
typedef struct {
    int secs,nsecs;
} timestamp;

typedef struct {
    // These should always be set.
    timestamp stamp;
    message_type msg_type;

    // Only the members needed by the msg_type are stored.
    tuple angular_velocity;
    attitude_t attitude;
    char image_names[2][MAXFILENAME];
    tuple linear_acceleration;
    gps position;
    UTM utm;
    velocity_t velocity;
    covariance_t covariance;
} message;
#endif   /* ----- #ifndef types_INC  ----- */