OSX MotionFX Software Library: Inc/osx_motion_fx.h Source File

OSX MotionFX

osx_motion_fx.h
Go to the documentation of this file.
1 
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef _OSX_MOTION_FX_H_
40 #define _OSX_MOTION_FX_H_
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /* Includes ------------------------------------------------------------------*/
47 #include "stdint.h"
48 
60 /* Exported types ------------------------------------------------------------*/
61 #define NUM_AXES 3
62 #define QNUM_AXES 4
63 
70 typedef enum
71 {
72  OSXMFX_ENGINE_DISABLE = 0,
73  OSXMFX_ENGINE_ENABLE = 1
74 } osxMFX_Engine_State;
75 
76 typedef enum
77 {
78  OSXMFX_ENGINE_OUTPUT_NED = 0,
79  OSXMFX_ENGINE_OUTPUT_ENU = 1
80 } osxMFX_Engine_Output_Ref_Sys;
81 
82 typedef struct
83 {
84  float ATime; /* merge rate to the accel */
85  float MTime; /* merge rate to the mag */
86  float FrTime; /* merge rate to the accel when external accelerations occours */
87  unsigned char LMode; /* gyro bias learn mode: 1-static learning 2-dynamic learning */
88  float gbias_mag_th_sc_6X; /* 6 axes scaler for the gyro bias mag threshold nominal */
89  float gbias_acc_th_sc_6X; /* 6 axes scaler for the gyro bias acc threshold nominal */
90  float gbias_gyro_th_sc_6X; /* 6 axes scaler for the gyro bias gyro threshold nominal */
91  float gbias_mag_th_sc_9X; /* 9 axes scaler for the gyro bias mag threshold nominal */
92  float gbias_acc_th_sc_9X; /* 9 axes scaler for the gyro bias acc threshold nominal */
93  float gbias_gyro_th_sc_9X; /* 9 axes scaler for the gyro bias gyro threshold nominal */
94  unsigned char modx; /* setting to indicate the decimation,
95  set to 1 in smartphone/tablet
96  set to >=1 in embedded solutions */
97  char acc_orientation[QNUM_AXES]; /* accelerometer data orientation */
98  char gyro_orientation[QNUM_AXES]; /* gyroscope data orientation */
99  char mag_orientation[QNUM_AXES]; /* magnetometer data orientation */
100  osxMFX_Engine_Output_Ref_Sys output_type; /* 0: NED, 1: ENU */
101  int start_automatic_gbias_calculation;
102 } osxMFX_knobs;
103 
104 typedef struct
105 {
106  float mag[NUM_AXES]; /* calibrated mag [uT]/50 */
107  float acc[NUM_AXES]; /* acc [g] */
108  float gyro[NUM_AXES]; /* gyro [dps] */
109 } osxMFX_input;
110 
111 typedef struct
112 {
113  float rotation_9X[NUM_AXES]; /* 9 axes yaw, pitch and roll */
114  float quaternion_9X[QNUM_AXES]; /* 9 axes quaternion */
115  float gravity_9X[NUM_AXES]; /* 9 axes device frame gravity */
116  float linear_acceleration_9X[NUM_AXES]; /* 9 axes device frame linear acceleration */
117  float heading_9X; /* 9 axes heading */
118  float rotation_6X[NUM_AXES]; /* 6 axes yaw, pitch and roll */
119  float quaternion_6X[QNUM_AXES]; /* 6 axes quaternion */
120  float gravity_6X[NUM_AXES]; /* 6 axes device frame gravity */
121  float linear_acceleration_6X[NUM_AXES]; /* 6 axes device frame linear acceleration */
122  float heading_6X; /* 6 axes heading */
123 } osxMFX_output;
124 
125 typedef struct
126 {
127  signed short magOffX; /* X axis Offset */
128  signed short magOffY; /* Y axis Offset */
129  signed short magOffZ; /* Z axis Offset */
130  float magGainX; /* X axis Gain */
131  float magGainY; /* Y axis Gain */
132  float magGainZ; /* Z axis Gain */
133  float expMagVect; /* expected magnetic field */
139 /* Exported constants --------------------------------------------------------*/
140 /* Exported variables --------------------------------------------------------*/
141 /* Exported macro ------------------------------------------------------------*/
142 /* Exported functions ------------------------------------------------------- */
150 uint8_t osx_MotionFX_initialize(void);
151 
158 
165 
170 osxMFX_Engine_State osx_MotionFX_getStatus_6X(void);
171 
176 osxMFX_Engine_State osx_MotionFX_getStatus_9X(void);
177 
183 void osx_MotionFX_enable_6X(osxMFX_Engine_State enable);
184 
190 void osx_MotionFX_enable_9X(osxMFX_Engine_State enable);
191 
197 void osx_MotionFX_setGbias(float *gbias);
198 
204 void osx_MotionFX_getGbias(float *gbias);
205 
214 void osx_MotionFX_update(osxMFX_output *data_out, osxMFX_input *data_in, float eml_deltatime, float *eml_q_update);
215 
223 void osx_MotionFX_propagate(osxMFX_output *data_out, osxMFX_input *data_in, float eml_deltatime);
224 
230 int osx_MotionFX_getLibVersion(char *version);
231 
236 void osx_MotionFX_compass_init(void);
237 
245 void osx_MotionFX_compass_saveAcc(int acc_x, int acc_y, int acc_z);
246 
254 void osx_MotionFX_compass_saveMag(int mag_x, int mag_y, int mag_z);
255 
260 int osx_MotionFX_compass_run(void);
261 
266 unsigned char osx_MotionFX_compass_isCalibrated(void);
267 
273 
280 
287 
300 #ifdef __cplusplus
301 }
302 #endif
303 
304 #endif /* _OSX_MOTION_FX_H_ */
305 
306 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Definition: osx_motion_fx.h:111
void osx_MotionFX_getCalibrationData(osxMFX_calibFactor *CalibrationData)
Get calibration data.
Definition: osx_motion_fx.h:82
void osx_MotionFX_enable_6X(osxMFX_Engine_State enable)
Enable or disable the 6 axes function (ACC + GYRO)
void osx_MotionFX_compass_init(void)
Initialize the compass calibration library.
Definition: osx_motion_fx.h:125
void osx_MotionFX_update(osxMFX_output *data_out, osxMFX_input *data_in, float eml_deltatime, float *eml_q_update)
Run the Kalman filter update.
int osx_MotionFX_compass_run(void)
Run compass API at 25 Hz.
void osx_MotionFX_setCalibrationData(osxMFX_calibFactor *CalibrationData)
Set calibration data.
void osx_MotionFX_setKnobs(osxMFX_knobs *knobs)
Set the internal knobs.
osxMFX_Engine_State osx_MotionFX_getStatus_6X(void)
Get the status of the 6 axes library.
void osx_MotionFX_setGbias(float *gbias)
Set the initial gbias.
void osx_MotionFX_compass_forceReCalibration(void)
Force new calibration.
unsigned char osx_MotionFX_compass_isCalibrated(void)
Check if calibration is needed.
osxMFX_Engine_State osx_MotionFX_getStatus_9X(void)
Get the status of the 9 axes library.
void osx_MotionFX_getGbias(float *gbias)
Get the initial gbias.
Definition: osx_motion_fx.h:104
void osx_MotionFX_compass_saveMag(int mag_x, int mag_y, int mag_z)
Save magnetometer data ENU systems coordinate.
uint8_t osx_MotionFX_initialize(void)
Initialize the MotionFX engine.
void osx_MotionFX_propagate(osxMFX_output *data_out, osxMFX_input *data_in, float eml_deltatime)
Run the Kalman filter propagate.
int osx_MotionFX_getLibVersion(char *version)
Get the library version.
void osx_MotionFX_getKnobs(osxMFX_knobs *knobs)
Get the current internal knobs.
void osx_MotionFX_compass_saveAcc(int acc_x, int acc_y, int acc_z)
Save accelerometer data ENU systems coordinate.
void osx_MotionFX_enable_9X(osxMFX_Engine_State enable)
Enable or disable the 9 axes function (ACC + GYRO + MAG)
Generated on Tue Apr 5 2016 17:29:15 for OSX MotionFX Software Library by   doxygen 1.8.8