Sensor Fusion Library 0.6.1
Orientation sensing for Espressif (ESP32, ESP8266) processors
Loading...
Searching...
No Matches
precisionAccelerometer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
13#ifndef PRECISIONACCELEROMETER_H
14#define PRECISIONACCELEROMETER_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include <stdint.h>
21
23#define ACCEL_CAL_AVERAGING_SECS 2
24#define MAX_ACCEL_CAL_ORIENTATIONS 12
25
27typedef struct
28{
29 float fGsStored[MAX_ACCEL_CAL_ORIENTATIONS][3];
30 float fSumGs[3];
31 int16_t iStoreCounter;
33 int16_t iStoreFlags;
35
37typedef struct
38{
39 // start of elements stored in flash memory
40 float fV[3];
41 float finvW[3][3];
42 float fR0[3][3];
43 // end of elements stored in flash memory
44 float fmatA[10][10];
45 float fmatB[10][10];
46 float fvecA[10];
47 float fvecB[4];
48 float fA[3][3];
49 float finvA[3][3];
51
52struct AccelSensor; // actual typedef is located in sensor_fusion_types.h
53
54// function prototypes for functions in precisionAcclerometer.c
57 AccelCalibration *pthisAccelCal,
58 AccelBuffer *pthisAccelBuffer,
59 volatile int8_t *AccelCalPacketOn
60);
63 AccelCalibration *pthisAccelCal,
64 AccelBuffer *pthisAccelBuffer,
65 struct AccelSensor* pthisAccel,
66 volatile int8_t *AccelCalPacketOn
67);
70 struct AccelSensor *pthisAccel,
71 AccelCalibration *pthisAccelCal
72);
75 AccelCalibration *pthisAccelCal,
76 AccelBuffer *pthisAccelBuffer,
77 struct AccelSensor* pthisAccel
78);
81 AccelBuffer *pthisAccelBuffer,
82 AccelCalibration *pthisAccelCal,
83 struct AccelSensor* pthisAccel
84);
87 AccelBuffer *pthisAccelBuffer,
88 AccelCalibration *pthisAccelCal,
89 struct AccelSensor* pthisAccel
90);
93 AccelBuffer *pthisAccelBuffer,
94 AccelCalibration *pthisAccelCal,
95 struct AccelSensor* pthisAccel
96);
97
98#ifdef __cplusplus
99}
100#endif
101
102#endif // PRECISIONACCELEROMETER_H
void fRunAccelCalibration(AccelCalibration *pthisAccelCal, AccelBuffer *pthisAccelBuffer, struct AccelSensor *pthisAccel)
function runs the precision accelerometer calibration
void fUpdateAccelBuffer(AccelCalibration *pthisAccelCal, AccelBuffer *pthisAccelBuffer, struct AccelSensor *pthisAccel, volatile int8_t *AccelCalPacketOn)
Update the buffer used to store samples used for accelerometer calibration.
void fInvertAccelCal(struct AccelSensor *pthisAccel, AccelCalibration *pthisAccelCal)
function maps the accelerometer data fGs (g) onto precision calibrated and de-rotated data fGc (g),...
#define MAX_ACCEL_CAL_ORIENTATIONS
number of stored precision accelerometer measurements
void fInitializeAccelCalibration(AccelCalibration *pthisAccelCal, AccelBuffer *pthisAccelBuffer, volatile int8_t *AccelCalPacketOn)
Initialize the accelerometer calibration functions.
void fComputeAccelCalibration4(AccelBuffer *pthisAccelBuffer, AccelCalibration *pthisAccelCal, struct AccelSensor *pthisAccel)
calculate the 4 element calibration from the available measurements
void fComputeAccelCalibration7(AccelBuffer *pthisAccelBuffer, AccelCalibration *pthisAccelCal, struct AccelSensor *pthisAccel)
calculate the 7 element calibration from the available measurements
void fComputeAccelCalibration10(AccelBuffer *pthisAccelBuffer, AccelCalibration *pthisAccelCal, struct AccelSensor *pthisAccel)
calculate the 10 element calibration from the available measurements
accelerometer measurement buffer
int16_t iStoreCounter
number of remaining iterations at FUSION_HZ to average measurement
int16_t iStoreFlags
denotes which measurements are present
int16_t iStoreLocation
-1 for none, 0 to 11 for the 12 storage locations
precision accelerometer calibration structure
The AccelSensor structure stores raw and processed measurements for a 3-axis accelerometer.