diff options
author | Martin Miller | 2017-03-18 20:32:08 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-18 20:32:08 -0500 |
commit | 816411abf8e9ff633a29449cc0ac445c11f73a1c (patch) | |
tree | 6e388395e8a5a56024113661da0bcacd5b7d8287 /src/main.h | |
parent | c0727bbe1404e788b4ae82f6c6d99e105ecfacdf (diff) | |
download | refslam-816411abf8e9ff633a29449cc0ac445c11f73a1c.zip refslam-816411abf8e9ff633a29449cc0ac445c11f73a1c.tar.gz |
Major rewrite moves state variables into state.
Rather than maintain X and P in the main function they are moved into
the body and state classes, respectively. This will become much more
important when features are added and the accounting becomes more
complicated.
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 78 |
1 files changed, 4 insertions, 74 deletions
@@ -1,99 +1,29 @@ #ifndef main_INC #define main_INC -//#define USE_ROS /* Uncomment to use with ROS */ - -#ifndef USE_ROS +#include <cmath> #include <cstdio> #include <cstring> -#endif /* ----- USE_ROS ----- */ - -#include <cmath> #include <Eigen/Dense> #include <iostream> #include "body.h" #include "state.h" +#include "types.h" -#define MAXLINE 8192 -#define MAXFILENAME 1024 using Eigen::Matrix; using Eigen::Matrix3d; using Eigen::Quaternion; using Eigen::Vector3d; -// 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; int parseLine(char *line, message *msg); timestamp update_dt(const timestamp t, timestamp *t_old); -#ifdef USE_ROS -void imuCallback(); -#else /* ----- not USE_ROS ----- */ void covCallback(const message &msg, Matrix<double,9,9> &P, const Quaternion<double> &q); void imgCallback(const message *msg); -void imuCallback(const message &msg, Matrix<double,9,1> &X, Matrix<double,9,9> &P, - const Quaternion<double> &q, const timestamp dt); +void imuCallback(const message &msg, State &mu, const Quaternion<double> &q, const timestamp dt); void pvaCallback(const message &msg, Matrix<double,9,1> &X, Quaternion<double> &q); -void utmCallback(const message &msg, Matrix<double,9,1> &X, Matrix<double,9,9> &P); -#endif /* ----- not USE_ROS ----- */ +void utmCallback(const message &msg, State &mu); #endif /* ----- #ifndef main_INC ----- */ |