PDR/1.Software/PDR 1.04/include/pdr_detector.h

90 lines
3.1 KiB
C
Raw Normal View History

2022-10-07 23:49:43 +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 "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_t *detector);
2022-10-07 23:49:43 +08:00
/* 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 : GetDetectorObj
* Description : <EFBFBD><EFBFBD>ȡPDR<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Date : 2020/02/16 logzhan
2022-10-07 23:49:43 +08:00
*---------------------------------------------------------------------**/
Detector_t *GetDetectorObj(void);
2022-10-07 23:49:43 +08:00
/**---------------------------------------------------------------------
* Function : Detector_Init
* 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 : 2022/09/23 logzhan
*---------------------------------------------------------------------**/
Detector_t* Detector_Init(void);
2022-10-07 23:49:43 +08:00
/**---------------------------------------------------------------------
* Function : DetectorReset
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>PDR<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Date : 2022/09/23 logzhan
*---------------------------------------------------------------------**/
void DetectorReset(void);
/**---------------------------------------------------------------------
* Function : DetectMotionType
* Description : pdr<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>
* Date : 2020/7/20
*---------------------------------------------------------------------**/
int DetectMotionType(void);
/**---------------------------------------------------------------------
* 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]);
/**---------------------------------------------------------------------
* Function : DetectorUpdateIMU
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imu<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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Date : 2022/09/23
*---------------------------------------------------------------------**/
void DetectorUpdateIMU(IMU_t* imu);
#ifdef __cplusplus
}
#endif
#endif