112 lines
4.1 KiB
C
112 lines
4.1 KiB
C
#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 : 获取PDR运动分类器对象
|
||
* Date : 2020/02/16 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
Detector_t *GetDetectorObj(void);
|
||
|
||
/**---------------------------------------------------------------------
|
||
* Function : Detector_Init
|
||
* Description : 初始化运动分类器,识别用户处于哪一种运动模式
|
||
* Date : 2022/09/23 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
Detector_t* Detector_Init(void);
|
||
|
||
/**---------------------------------------------------------------------
|
||
* Function : DetectorReset
|
||
* Description : 重置PDR运动分类器
|
||
* Date : 2022/09/23 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
void DetectorReset(void);
|
||
|
||
/**---------------------------------------------------------------------
|
||
* Function : DetectMotionType
|
||
* Description : pdr运动类型检测
|
||
* Date : 2020/7/20
|
||
*---------------------------------------------------------------------**/
|
||
int DetectMotionType(void);
|
||
|
||
/**---------------------------------------------------------------------
|
||
* Function : predict
|
||
* Description : 判断手机携带方式(静止、手持、摆手等)
|
||
* Date : 2020/7/20 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
int pdr_detectorPredict(float* feature);
|
||
|
||
|
||
/**----------------------------------------------------------------------
|
||
* Function : DetUserStatic
|
||
* Description : 检测用户是否处于静止状态
|
||
* Date : 2022/10/15 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
int DetUserStatic(PDR_t* g_pdr, GNSS_t* pgnss, unsigned long delSteps);
|
||
|
||
/**----------------------------------------------------------------------
|
||
* Function : detIsCarMode
|
||
* Description : 识别是否是车载模式
|
||
* Input : pgnss,GPS数据结构体
|
||
g_pdr,PDR结构体
|
||
delSteps, 与上次相比步数的变化量
|
||
time,计数器
|
||
* Output : int,车载模式标志位
|
||
* Date : 2021/01/28 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
int DetectCarMode(GNSS_t* pgnss, PDR_t* g_pdr, unsigned long delSteps, int* time);
|
||
|
||
/**----------------------------------------------------------------------
|
||
* Function : detPdrToReset
|
||
* Description : 检测PDR系统是否需要重置,考虑到后续PDR推算失误,或者其他情况
|
||
* 重置PDR到GPS的位置。
|
||
* Date : 2021/01/28 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
int DetectPdrToReset(double pdr_angle, int* gpscnt, unsigned long deltsteps, PDR_t* g_pdr);
|
||
|
||
/**---------------------------------------------------------------------
|
||
* Function : DetectorUpdateIMU
|
||
* Description : 更新运动类型检测器的imu信息,如果到达一定的时间间隔,则会检测
|
||
* 用户的运动类型
|
||
* Date : 2022/09/23
|
||
*---------------------------------------------------------------------**/
|
||
void DetectorUpdateIMU(IMU_t* imu, PDR_t* pdr);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif
|