2022-09-15 16:35:25 +08:00
|
|
|
|
#ifndef __DETECTOR_H
|
|
|
|
|
#define __DETECTOR_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Header File Including ------------------------------------------------------------------------ */
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include "pdr_base.h"
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "pdr_ahrs.h"
|
|
|
|
|
|
|
|
|
|
/* Macro Declaration ---------------------------------------------------------------------------- */
|
|
|
|
|
#define DETECTOR_NO_ERROR 0
|
|
|
|
|
#define DETECTOR_OUT_OF_MEMORY 1
|
|
|
|
|
|
|
|
|
|
#define MAG_BUF_LEN 256
|
|
|
|
|
#define MAG_LEN 6
|
|
|
|
|
|
|
|
|
|
/* Struct Declaration --------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (*DETECTOR_update_callback)(DETECTOR *detector);
|
|
|
|
|
|
|
|
|
|
/* Global Variable Declaration ------------------------------------------------------------------ */
|
|
|
|
|
extern BUFFER_SHORT g_acc_frq_buf[3];
|
|
|
|
|
extern BUFFER_SHORT g_acc_amp_buf[3];
|
|
|
|
|
extern BUFFER_SHORT g_gyr_frq_buf[3];
|
|
|
|
|
extern BUFFER_SHORT g_gyr_amp_buf[3];
|
|
|
|
|
|
|
|
|
|
/* Function Declaration ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/**---------------------------------------------------------------------
|
|
|
|
|
* Function : pdr_getDetector
|
|
|
|
|
* Description : <EFBFBD><EFBFBD>ȡPDR<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
* Date : 2020/02/16 logzhan &
|
|
|
|
|
*
|
|
|
|
|
*---------------------------------------------------------------------**/
|
|
|
|
|
DETECTOR *pdr_getDetector(void);
|
|
|
|
|
|
|
|
|
|
/**---------------------------------------------------------------------
|
|
|
|
|
* Function : pdr_initDetector
|
|
|
|
|
* Description : <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>ģʽ
|
|
|
|
|
* Date : 2020/02/16 logzhan & logzhan
|
|
|
|
|
*---------------------------------------------------------------------**/
|
2022-09-17 01:12:48 +08:00
|
|
|
|
DETECTOR* Detector_Init(void);
|
2022-09-15 16:35:25 +08:00
|
|
|
|
|
|
|
|
|
/**---------------------------------------------------------------------
|
|
|
|
|
* Function : pdr_resetDetector
|
|
|
|
|
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>PDR<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* Date : 2020/02/16 logzhan & logzhan
|
|
|
|
|
*---------------------------------------------------------------------**/
|
|
|
|
|
void pdr_resetDetector(void);
|
|
|
|
|
|
|
|
|
|
/**---------------------------------------------------------------------
|
|
|
|
|
* Function : pdr_motionTypeDetect
|
|
|
|
|
* Description : pdr<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* Date : 2020/7/20
|
|
|
|
|
*
|
|
|
|
|
*---------------------------------------------------------------------**/
|
2022-09-17 01:12:48 +08:00
|
|
|
|
int MotionTypeDetect(void);
|
2022-09-15 16:35:25 +08:00
|
|
|
|
|
|
|
|
|
/**---------------------------------------------------------------------
|
|
|
|
|
* Function : predict
|
|
|
|
|
* Description : <EFBFBD>ж<EFBFBD><EFBFBD>ֻ<EFBFBD>Я<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD>ֳ֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵȣ<EFBFBD>
|
|
|
|
|
* Date : 2020/7/20 logzhan
|
|
|
|
|
*---------------------------------------------------------------------**/
|
|
|
|
|
int pdr_detectorPredict(float* feature);
|
|
|
|
|
|
|
|
|
|
void mag_calibration(IMU *imu);
|
|
|
|
|
void mag_m_trans(float a[MAG_BUF_LEN][3], float r[3][MAG_BUF_LEN]);
|
|
|
|
|
void mag_min(float a[MAG_BUF_LEN], float *mag_min);
|
|
|
|
|
void mag_max(float a[MAG_BUF_LEN], float *mag_max);
|
|
|
|
|
void mag_rand(float r[6]);
|
|
|
|
|
|
2022-09-19 23:05:00 +08:00
|
|
|
|
void UpdateDetectorImu(imu* imu);
|
2022-09-15 16:35:25 +08:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|