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

112 lines
4.1 KiB
C
Raw Normal View History

2022-10-17 20:33:46 +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 "PDRBase.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);
/* 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
*---------------------------------------------------------------------**/
Detector_t *GetDetectorObj(void);
/**---------------------------------------------------------------------
* 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);
/**---------------------------------------------------------------------
* 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);
/**----------------------------------------------------------------------
* Function : DetUserStatic
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ھ<EFBFBD>ֹ״̬
* Date : 2022/10/15 logzhan
*---------------------------------------------------------------------**/
int DetUserStatic(PDR_t* g_pdr, GNSS_t* pgnss, unsigned long delSteps);
/**----------------------------------------------------------------------
* Function : detIsCarMode
* Description : ʶ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>dz<EFBFBD><EFBFBD><EFBFBD>ģʽ
* Input : pgnss<EFBFBD><EFBFBD>GPS<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD>
g_pdr<EFBFBD><EFBFBD>PDR<EFBFBD><EFBFBD><EFBFBD>
delSteps<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD>
time<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Output : int<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>־λ
* Date : 2021/01/28 logzhan
*---------------------------------------------------------------------**/
int DetectCarMode(GNSS_t* pgnss, PDR_t* g_pdr, unsigned long delSteps, int* time);
/**----------------------------------------------------------------------
* Function : detPdrToReset
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>PDRϵͳ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PDR<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>󣬻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>PDR<EFBFBD><EFBFBD>GPS<EFBFBD><EFBFBD>λ<EFBFBD>á<EFBFBD>
* Date : 2021/01/28 logzhan
*---------------------------------------------------------------------**/
int DetectPdrToReset(double pdr_angle, int* gpscnt, unsigned long deltsteps, PDR_t* g_pdr);
/**---------------------------------------------------------------------
* 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, PDR_t* pdr);
#ifdef __cplusplus
}
#endif
#endif