| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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
39 quaternion_type algorithmToUse;
40
41 // counter incrementing each iteration of sensor fusion (typically 25Hz)
42 int32 loopcounter;
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
72 struct SV_1DOF_P_BASIC thisSV_1DOF_P_BASIC;
73 #endif
74
75 // 3DOF accelerometer (Basic) structure
76 #if defined COMPUTE_3DOF_G_BASIC
77 struct SV_3DOF_G_BASIC thisSV_3DOF_G_BASIC;
78 #endif
79
80 // 3DOF magnetometer (Basic) structure
81 #if defined COMPUTE_3DOF_B_BASIC
82 struct SV_3DOF_B_BASIC thisSV_3DOF_B_BASIC;
83 #endif
84
85 // 3DOF gyro (Basic) structure
86 #if defined COMPUTE_3DOF_Y_BASIC
87 struct SV_3DOF_Y_BASIC thisSV_3DOF_Y_BASIC;
88 #endif
89
90 // 6DOF accelerometer and magnetometer (Basic) structure
91 #if defined COMPUTE_6DOF_GB_BASIC
92 struct SV_6DOF_GB_BASIC thisSV_6DOF_GB_BASIC;
93 #endif
94
95 // 6DOF accelerometer and gyro (Kalman) structure
96 #if defined COMPUTE_6DOF_GY_KALMAN
97 struct SV_6DOF_GY_KALMAN thisSV_6DOF_GY_KALMAN;
98 #endif
99
100 // 9DOF accelerometer, magnetometer and gyro (Kalman) structure
101 #if defined COMPUTE_9DOF_GBY_KALMAN
102 struct SV_9DOF_GBY_KALMAN thisSV_9DOF_GBY_KALMAN;
103 #endif
104
105 // algorithm reset flag
106 int8 softReset;
107 // Reset INS inertial navigation velocity and position flag
108 int8 softRINS;
109
110 } fusion_state_t;
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);
122 int32 RdSensData_Run();
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
MagneticBuffer
Definition: magnetic.h:50
uint8
unsigned char uint8
Definition: isf_types.h:76
thisMag
struct MagSensor thisMag
ApplyMagHAL
void ApplyMagHAL(struct MagSensor *pthisMag)
Definition: fusion_exec.c:282
ApplyAccelHAL
void ApplyAccelHAL(struct AccelSensor *pthisAccel)
thisSV_3DOF_B_BASIC
struct SV_3DOF_B_BASIC thisSV_3DOF_B_BASIC
fusion_state_t::softRINS
int8 softRINS
Definition: fusion_exec.h:108
thisMagBuffer
struct MagneticBuffer thisMagBuffer
ApplyGyroHAL
void ApplyGyroHAL(struct GyroSensor *pthisGyro, int16 irow)
Fusion_Init
void Fusion_Init(fusion_state_t *pState)
Definition: fusion_exec.c:48
SV_3DOF_B_BASIC
Definition: fusion_types.h:105
thisSV_6DOF_GY_KALMAN
struct SV_6DOF_GY_KALMAN thisSV_6DOF_GY_KALMAN
AccelSensor
Definition: sensor_data_types.h:33
SV_9DOF_GBY_KALMAN
Definition: fusion_types.h:218
MagSensor
Definition: sensor_data_types.h:47
quaternion_type
enum quaternion quaternion_type
SV_1DOF_P_BASIC
Definition: fusion_types.h:68
MagCal_Run
void MagCal_Run(fusion_state_t *pState)
Definition: fusion_exec.c:268
SV_6DOF_GY_KALMAN
Definition: fusion_types.h:183
fusion_state_t::softReset
int8 softReset
Definition: fusion_exec.h:106
thisGyro
struct GyroSensor thisGyro
RdSensData_Init
void RdSensData_Init(void)
isf_sensor_base_types.h
The isf_sensor_base_types.h file contains declarations for the general base types used in the isf sen...
RdSensData_Run
int32 RdSensData_Run()
int16
signed short int int16
Definition: isf_types.h:73
thisSV_3DOF_Y_BASIC
struct SV_3DOF_Y_BASIC thisSV_3DOF_Y_BASIC
SV_3DOF_Y_BASIC
Definition: fusion_types.h:131
thisMagCal
struct MagCalibration thisMagCal
magnetic.h
fusion_state_t::algorithmToUse
quaternion_type algorithmToUse
Definition: fusion_exec.h:39
fusion_config.h
The fusion_config.h file contains additional static configuration for the Sensor Fusion based Virtual...
fusion_types.h
thisSV_1DOF_P_BASIC
struct SV_1DOF_P_BASIC thisSV_1DOF_P_BASIC
isf_timestamp_t
uint32 isf_timestamp_t
Standard timestamp.
Definition: isf_sensor_base_types.h:15
fusion_state_t::loopcounter
int32 loopcounter
Definition: fusion_exec.h:42
thisSV_3DOF_G_BASIC
struct SV_3DOF_G_BASIC thisSV_3DOF_G_BASIC
fusion_state_t
Definition: fusion_exec.h:36
int32
signed long int int32
Definition: isf_types.h:74
MagCalibration
Definition: magnetic.h:59
sensor_data_types.h
thisSV_6DOF_GB_BASIC
struct SV_6DOF_GB_BASIC thisSV_6DOF_GB_BASIC
thisSV_9DOF_GBY_KALMAN
struct SV_9DOF_GBY_KALMAN thisSV_9DOF_GBY_KALMAN
Fusion_Run
int8 Fusion_Run(fusion_state_t *pState, fusion_algorithmConfig_t *pAlgorithmConfig)
Definition: fusion_exec.c:97
SV_6DOF_GB_BASIC
Definition: fusion_types.h:155
SV_3DOF_G_BASIC
Definition: fusion_types.h:79
thisAccel
struct AccelSensor thisAccel
fusion_algorithmConfig_t
Definition: fusion_types.h:264
GyroSensor
Definition: sensor_data_types.h:64
PressureSensor
Definition: sensor_data_types.h:20
thisPressure
struct PressureSensor thisPressure
int8
signed char int8
Definition: isf_types.h:72
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.