ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
fusion_exec.h
Go to the documentation of this file.
1 // Copyright (c) 2015, Freescale Semiconductor, Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of Freescale Semiconductor, Inc. nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL FREESCALE SEMICONDUCTOR, INC. BE LIABLE FOR ANY
19 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 #ifndef FUSION_EXEC_H
27 #define FUSION_EXEC_H
28 
29 //#include "PE_Types.h"
30 #include "isf_sensor_base_types.h"
31 #include "sensor_data_types.h"
32 #include "fusion_types.h"
33 #include "fusion_config.h"
34 #include "magnetic.h"
35 
36 typedef struct
37 {
38  // default quaternion type
40 
41  // counter incrementing each iteration of sensor fusion (typically 25Hz)
43 
44  // sensor data structures
45 #ifdef USE_PRESSURE_SENSOR
46  // pressure sensor found flag
47  int8 usingPressureSensor;
48  uint8 pressureSampleCount;
49  isf_timestamp_t pressureTimestamp; // from the most recent sensor sample
50  struct PressureSensor thisPressure; // this pressure sensor
51 #endif
52 
53 #ifdef USE_ACCELEROMETER
54  isf_timestamp_t accelTimestamp; // from the most recent sensor sample
55  struct AccelSensor thisAccel; // this accelerometer
56 #endif
57 
58 #ifdef USE_MAGNETOMETER
59  struct MagSensor thisMag; // this magnetometer
60  struct MagCalibration thisMagCal; // hard and soft iron magnetic calibration
61  struct MagneticBuffer thisMagBuffer; // magnetometer measurement buffer
62  isf_timestamp_t magTimestamp; // from the most recent sensor sample
63 #endif
64 
65 #ifdef USE_GYROMETER
66  struct GyroSensor thisGyro; // this gyro
67  isf_timestamp_t gyroTimestamp; // from the most recent sensor sample
68 #endif
69 
70  // 1DOF pressure structure
71 #if defined COMPUTE_1DOF_P_BASIC
73 #endif
74 
75  // 3DOF accelerometer (Basic) structure
76 #if defined COMPUTE_3DOF_G_BASIC
78 #endif
79 
80  // 3DOF magnetometer (Basic) structure
81 #if defined COMPUTE_3DOF_B_BASIC
83 #endif
84 
85  // 3DOF gyro (Basic) structure
86 #if defined COMPUTE_3DOF_Y_BASIC
88 #endif
89 
90  // 6DOF accelerometer and magnetometer (Basic) structure
91 #if defined COMPUTE_6DOF_GB_BASIC
93 #endif
94 
95  // 6DOF accelerometer and gyro (Kalman) structure
96 #if defined COMPUTE_6DOF_GY_KALMAN
98 #endif
99 
100  // 9DOF accelerometer, magnetometer and gyro (Kalman) structure
101 #if defined COMPUTE_9DOF_GBY_KALMAN
103 #endif
104 
105  // algorithm reset flag
107  // Reset INS inertial navigation velocity and position flag
109 
111 
112 extern struct PressureSensor thisPressure;
113 extern struct AccelSensor thisAccel;
114 extern struct MagSensor thisMag;
115 extern struct GyroSensor thisGyro;
116 
117 // function prototypes for functions in tasks_func.c
118 void ApplyAccelHAL(struct AccelSensor *pthisAccel);
119 void ApplyMagHAL(struct MagSensor *pthisMag);
120 void ApplyGyroHAL(struct GyroSensor *pthisGyro, int16 irow);
121 void RdSensData_Init(void);
123 void Fusion_Init(fusion_state_t *pState);
124 int8 Fusion_Run(fusion_state_t *pState, fusion_algorithmConfig_t *pAlgorithmConfig);
125 void MagCal_Run(fusion_state_t *pState);
126 
127 #endif // #ifndef FUSION_EXEC_H
128 
unsigned char uint8
Definition: isf_types.h:76
struct MagSensor thisMag
void ApplyMagHAL(struct MagSensor *pthisMag)
Definition: fusion_exec.c:282
void ApplyAccelHAL(struct AccelSensor *pthisAccel)
struct SV_3DOF_B_BASIC thisSV_3DOF_B_BASIC
struct MagneticBuffer thisMagBuffer
void ApplyGyroHAL(struct GyroSensor *pthisGyro, int16 irow)
void Fusion_Init(fusion_state_t *pState)
Definition: fusion_exec.c:48
struct SV_6DOF_GY_KALMAN thisSV_6DOF_GY_KALMAN
enum quaternion quaternion_type
void MagCal_Run(fusion_state_t *pState)
Definition: fusion_exec.c:268
struct GyroSensor thisGyro
void RdSensData_Init(void)
The isf_sensor_base_types.h file contains declarations for the general base types used in the isf sen...
int32 RdSensData_Run()
signed short int int16
Definition: isf_types.h:73
struct SV_3DOF_Y_BASIC thisSV_3DOF_Y_BASIC
struct MagCalibration thisMagCal
quaternion_type algorithmToUse
Definition: fusion_exec.h:39
The fusion_config.h file contains additional static configuration for the Sensor Fusion based Virtual...
struct SV_1DOF_P_BASIC thisSV_1DOF_P_BASIC
uint32 isf_timestamp_t
Standard timestamp.
int32 loopcounter
Definition: fusion_exec.h:42
struct SV_3DOF_G_BASIC thisSV_3DOF_G_BASIC
signed long int int32
Definition: isf_types.h:74
struct SV_6DOF_GB_BASIC thisSV_6DOF_GB_BASIC
struct SV_9DOF_GBY_KALMAN thisSV_9DOF_GBY_KALMAN
int8 Fusion_Run(fusion_state_t *pState, fusion_algorithmConfig_t *pAlgorithmConfig)
Definition: fusion_exec.c:97
struct AccelSensor thisAccel
struct PressureSensor thisPressure
signed char int8
Definition: isf_types.h:72