C MIP-SDK
mip_sdk_ahrs.h
Go to the documentation of this file.
00001 
00002 //
00006 //
00008 //
00009 // External dependencies:
00010 //
00011 //  
00012 // 
00014 //
00017 //
00027 //
00029 
00030 #ifndef _MIP_SDK_AHRS_H
00031 #define _MIP_SDK_AHRS_H
00032 
00034 //
00035 //Include Files
00036 //
00038 
00039 #include "mip.h"
00040 #include "mip_sdk_interface.h"
00041 
00043 //
00044 // Defines
00045 //
00048 
00049 
00051 //
00052 // Descriptor Set designator - used in the Desc Set field of the MIP header
00053 //
00055 
00056 #define MIP_AHRS_DATA_SET                                       0x80
00057 
00058 
00060 //
00061 // Descriptors 
00062 //
00064 
00065 #define MIP_AHRS_DATA_ACCEL_RAW                                 0x01    // 12: 3 single (vector) (no units)
00066 #define MIP_AHRS_DATA_GYRO_RAW                          0x02    // 12: 3 single (vector) (no units)
00067 #define MIP_AHRS_DATA_MAG_RAW                           0x03    // 12: 3 single (vector) (no units)
00068 #define MIP_AHRS_DATA_ACCEL_SCALED                              0x04    // 12: 3 single (vector) (g)
00069 #define MIP_AHRS_DATA_GYRO_SCALED                               0x05    // 12: 3 single (vector) (radians/second)
00070 #define MIP_AHRS_DATA_MAG_SCALED                                0x06    // 12: 3 single (vector) (gauss)
00071 #define MIP_AHRS_DATA_DELTA_THETA                               0x07    // 12: 3 single (vector) (radians/second)
00072 #define MIP_AHRS_DATA_DELTA_VELOCITY                    0x08    // 12: 3 single (vector) (meters/second)
00073 #define MIP_AHRS_DATA_ORIENTATION_MATRIX                0x09    // 36: 9 single (Matrix) (no units)
00074 #define MIP_AHRS_DATA_QUATERNION                                0x0A    // 16: 4 single (Quaternion) (no units)
00075 #define MIP_AHRS_DATA_ORIENTATION_UPDATE_MATRIX 0x0B    // 36: 9 single (Matrix) (no units)
00076 #define MIP_AHRS_DATA_EULER_ANGLES                              0x0C 
00077 #define MIP_AHRS_DATA_TEMPERATURE_RAW                   0x0D    // 8:  4 u16            (no units)
00078 #define MIP_AHRS_DATA_TIME_STAMP_INTERNAL               0x0E    // 4:  1 u32 (Integer) (device specific)
00079 #define MIP_AHRS_DATA_TIME_STAMP_PPS                    0x0F    // 9:  u8 flags u32 seconds u32 nanoseconds
00080 #define MIP_AHRS_DATA_STAB_MAG                          0x10    // 12: 3 single (vector) (Gauss)
00081 #define MIP_AHRS_DATA_STAB_ACCEL                                0x11    // 12: 3 single (vector) (g)
00082 #define MIP_AHRS_DATA_TIME_STAMP_GPS                    0x12    // 14: double GPS TOW u16 GPS week number u16 flags 
00083 #define MIP_AHRS_DATA_PRESSURE_SCALED               0x17 
00084 
00085 
00086 
00087 #define MIP_AHRS_DATA_ASPP                                      0x81    // MicroStrain ASPP packet
00088 #define MIP_AHRS_DATA_GXSB                                      0x82    // MicroStrain GX series single byte command
00089 
00090 
00091 
00093 //
00094 // Structures
00095 //
00097 
00099 // Raw sensor 
00101 
00102 #pragma pack(1)
00103 
00104 typedef struct _mip_ahrs_raw_accel 
00105 {
00106  float raw_accel[3];       //Counts
00107 }mip_ahrs_raw_accel;
00108 
00109 typedef struct _mip_ahrs_raw_gyro 
00110 {
00111  float raw_gyro[3];       //Counts
00112 }mip_ahrs_raw_gyro;
00113 
00114 typedef struct _mip_ahrs_raw_mag 
00115 {
00116  float raw_mag[3];       //Counts
00117 }mip_ahrs_raw_mag;
00118 
00119 
00121 // Scaled/Temp-Comped sensor 
00123 
00124 typedef struct _mip_ahrs_scaled_accel 
00125 {
00126  float scaled_accel[3];       //"G"s
00127 }mip_ahrs_scaled_accel;
00128 
00129 typedef struct _mip_ahrs_scaled_gyro
00130 {
00131  float scaled_gyro[3];       //radians/sec
00132 }mip_ahrs_scaled_gyro;
00133 
00134 typedef struct _mip_ahrs_scaled_mag 
00135 {
00136  float scaled_mag[3];       //Gauss
00137 }mip_ahrs_scaled_mag;
00138 
00139 typedef struct _ahrs_scaled_pressure_mip_field 
00140 {
00141  float scaled_pressure;       //mBar
00142 }ahrs_scaled_pressure_mip_field;
00143 
00144 
00146 // Delta Theta/Velocity
00148 
00149 typedef struct _mip_ahrs_delta_theta 
00150 {
00151  float delta_theta[3];       //radians/sec
00152 }mip_ahrs_delta_theta;
00153 
00154 typedef struct _mip_ahrs_delta_velocity 
00155 {
00156  float delta_velocity[3];       //meters/sec
00157 }mip_ahrs_delta_velocity;
00158 
00159 
00161 // Orientations
00163 
00164 typedef struct _mip_ahrs_orientation_matrix 
00165 {
00166  float m[3][3];    
00167 }mip_ahrs_orientation_matrix;
00168 
00169 typedef struct _mip_ahrs_quaternion 
00170 {
00171  float q[4];    
00172 }mip_ahrs_quaternion;
00173 
00174 typedef struct _mip_ahrs_euler_angles
00175 {
00176  float roll, pitch, yaw;    
00177 }mip_ahrs_euler_angles;
00178 
00179 
00181 // Orientation Update 
00183 
00184 typedef struct _mip_ahrs_orientation_update_matrix
00185 {
00186  float m[3][3];    
00187 }mip_ahrs_orientation_update_matrix;
00188 
00190 // Raw Temperature 
00192 
00193 typedef struct _mip_ahrs_raw_temp 
00194 {
00195  u16 raw_temp[4];       //0 = Mag, 1 = Gyro_3/Accel_3, 2 = Gyro_2/Accel_1/Accel_2, 3 = Gyro_1
00196 }mip_ahrs_raw_temp;
00197 
00199 // Timestamps
00201 
00202 typedef struct _mip_ahrs_internal_timestamp 
00203 {
00204  u32 counts; // 16 uS increments, 1/62,500 of a second
00205 }mip_ahrs_internal_timestamp;
00206 
00207 
00208 typedef struct _mip_ahrs_1pps_timestamp 
00209 {
00210  u8  flags;
00211  u32 seconds, nanoseconds; // seconds, nanoseconds
00212 }mip_ahrs_1pps_timestamp;
00213 
00214 
00215 typedef struct _mip_ahrs_gps_timestamp 
00216 {
00217  double tow;  //Time of Week (seconds)
00218  u16 week_number; 
00219  u16 valid_flags;
00220 }mip_ahrs_gps_timestamp;
00221 
00222 
00224 // Unit Vector Fields
00226 
00227 typedef struct _mip_ahrs_up_vector 
00228 {
00229  float up[3];       //Unit Vector
00230 }mip_ahrs_up_vector;
00231 
00232 
00233 typedef struct _mip_ahrs_north_vector 
00234 {
00235  float north[3];       //Unit Vector
00236 }mip_ahrs_north_vector;
00237 
00238 
00240 // AHRS Signal Conditioning Settings
00242 
00243 typedef struct _mip_ahrs_signal_settings
00244 {
00245  u16 orientation_decimation;
00246  u16 data_conditioning_flags;
00247  u8  inertial_filter_width;
00248  u8  mag_filter_width;
00249  u16 up_compensation;
00250  u16 north_compensation;
00251  u8  mag_bandwidth;
00252  u16 reserved;
00253 }mip_ahrs_signal_settings;
00254 
00255 
00257 // Complementary Filter Settings
00259 
00260 typedef struct _mip_complementary_filter_settings
00261 {
00262  u8    up_compensation_enable;
00263  u8    north_compensation_enable;
00264  float up_compensation_time_constant;
00265  float north_compensation_time_constant;
00266 }mip_complementary_filter_settings;
00267 
00268 
00270 // Scaled data low pass filter settings
00272 
00273 typedef struct _mip_low_pass_filter_settings
00274 {
00275  u8             data_type;
00276  u8             filter_type_selector;
00277  u8             manual_cutoff;
00278  u16    cutoff_frequency;
00279  u8             reserved;       
00280 }mip_low_pass_filter_settings;
00281 
00282 #pragma pack()
00283 
00285 //
00286 // Function Prototypes
00287 //
00289 
00290 void mip_ahrs_raw_accel_byteswap(mip_ahrs_raw_accel *raw_accel);
00291 void mip_ahrs_raw_gyro_byteswap(mip_ahrs_raw_gyro *raw_gyro);
00292 void mip_ahrs_raw_mag_byteswap(mip_ahrs_raw_mag *raw_mag);
00293 void mip_ahrs_scaled_accel_byteswap(mip_ahrs_scaled_accel *scaled_accel);
00294 void mip_ahrs_scaled_gyro_byteswap(mip_ahrs_scaled_gyro *scaled_gyro);
00295 void mip_ahrs_scaled_mag_byteswap(mip_ahrs_scaled_mag *scaled_mag);
00296 void mip_ahrs_delta_theta_byteswap(mip_ahrs_delta_theta *delta_theta);
00297 void mip_ahrs_delta_velocity_byteswap(mip_ahrs_delta_velocity *delta_velocity);
00298 void mip_ahrs_orientation_matrix_byteswap(mip_ahrs_orientation_matrix *orientation_matrix);
00299 void mip_ahrs_quaternion_byteswap(mip_ahrs_quaternion *quaternion);
00300 void mip_ahrs_euler_angles_byteswap(mip_ahrs_euler_angles *euler_angles);
00301 void mip_ahrs_orientation_update_matrix_byteswap(mip_ahrs_orientation_update_matrix *orientation_update_matrix);
00302 void mip_ahrs_raw_temp_byteswap(mip_ahrs_raw_temp *raw_temp);
00303 void mip_ahrs_internal_timestamp_byteswap(mip_ahrs_internal_timestamp *internal_timestamp);
00304 void mip_ahrs_1pps_timestamp_byteswap(mip_ahrs_1pps_timestamp *pps_timestamp);
00305 void mip_ahrs_gps_timestamp_byteswap(mip_ahrs_gps_timestamp *gps_timestamp);
00306 void mip_ahrs_up_vector_byteswap(mip_ahrs_up_vector *up_vector);
00307 void mip_ahrs_north_vector_byteswap(mip_ahrs_north_vector *north_vector);
00308 void mip_ahrs_signal_settings_byteswap(mip_ahrs_signal_settings *signal_settings);
00309 
00310 
00311 #endif
 All Data Structures Files Functions Defines