164 lines
6.8 KiB
C
164 lines
6.8 KiB
C
/*********************************************************************************/
|
||
/* FILE NAME : scene_recognition.h */
|
||
/* AUTHOR : Zhang Jingrui, ID: 11082826, Version: V0.1_Beta, Data:2019-03-28 */
|
||
/* DESCRIPTION: This header file conterns the prototype description of the external */
|
||
/* interface funtions of the scene recognition module and the definit- */
|
||
/* ion of related resources. */
|
||
/* HISTORY : (NONE) */
|
||
/********************************************************************************/
|
||
|
||
#ifndef _PDR_SCENE_RECOGNITION_H_
|
||
#define _PDR_SCENE_RECOGNITION_H_
|
||
|
||
/* Header Files Including -----------------------------------------*/
|
||
/*=================================================================*/
|
||
#include "pdr_sensor.h"
|
||
|
||
/* Macro Declaration ----------------------------------------------*/
|
||
/*=================================================================*/
|
||
|
||
#define _TIME_BUFFER_SIZE 10 /* Buffer size for the time calculation. */
|
||
#define _ACCURACY_BUFFER_SIZE 9 /* Accuracy time-based buffer size. */
|
||
#define _GNSS_INDEX_LEN 103 /* Structural array size in _GnssInfo. */
|
||
|
||
/* Extern Variable Declaration ------------------------------------*/
|
||
/*=================================================================*/
|
||
//extern int scene_recognition_debug_flag ;
|
||
//extern int scene_recognition_log_debug_flag ;
|
||
|
||
/* Status Declaration ---------------------------------------------*/
|
||
/*=================================================================*/
|
||
/* Usage: 场景识别模块初始化、重置操作结果状态标志位 */
|
||
typedef enum SCENE_INIT_STATE
|
||
{
|
||
// 场景识别模块初始化相关状态
|
||
INIT_SUCCESS = 0,
|
||
INIT_NOT_PERFORMED,
|
||
|
||
INIT_ERROR_MEMORY_OCCUPIED, // 模块资源未提前释放,需先释放资源
|
||
INIT_ERROR_MEMORY_INIT_FAILED, // 初始化内存申请失败
|
||
INIT_ERROR_REDUNDANCY, // 模块重复初始化,此时初始化无效。若需要重启模块,可以:
|
||
// 方法1:先关闭模块,关闭成功后,重新初始化模块。
|
||
// 方法2:重启模块,效果同方法1。
|
||
// 场景识别模块重置相关状态(for debug)
|
||
INIT_RESET_SUCCESS = 0,
|
||
INIT_RESET_FAILED
|
||
} SCENE_INIT_STATE;
|
||
|
||
/* Usage: 场景分类结果 */
|
||
typedef enum SCENE_RECOGNITION_RESULT
|
||
{
|
||
RECOG_UNKNOWN, // 未能确定场景的状态(默认状态)
|
||
RECOG_OPEN_AREA, // 场景open-area
|
||
RECOG_OTHERS, // 除了上述确定场景外的其他场景
|
||
RECOG_ERROR_PARAM_INCRECT, // 输入参数检查错误
|
||
RECOG_ERROR_NMEA_INFO_MISS, // 输入参数正确但是内容有误
|
||
/* 预研检测结果(不稳定) */
|
||
RECOG_MULTIPATH // 检测多径
|
||
} SCENE_RECOGNITION_RESULT;
|
||
|
||
/* Usage: 场景识别模块资源释放操作结果 */
|
||
typedef enum SCENE_DESTROY_STATE
|
||
{
|
||
DESTROY_SUCCESS = 0,
|
||
DESTROY_FIALED,
|
||
DESTROY_ERROR,
|
||
DESTROY_INVALID // 无效释放操作,表示没有对应的初始化或重置操作
|
||
} SCENE_DESTROY_STATE;
|
||
|
||
|
||
/* Status Declaration--------------------------------------------*/
|
||
/*===============================================================*/
|
||
|
||
// 描述当前场景识别模块的工作状态
|
||
typedef enum _SCENE_MODEL_WORK_STATE
|
||
{
|
||
MODEL_OFF,
|
||
MODEL_ON
|
||
} _SCENE_MODEL_WORK_STATE;
|
||
|
||
/* Usage: Identifier of the quality of the satellites' signal source. */
|
||
typedef enum _SIGNAL_QUALITY
|
||
{
|
||
SIG_UNKNOWN,
|
||
GOOD,
|
||
BAD
|
||
} SIGNAL_QUALITY;
|
||
|
||
/* Usage: extract and save information from lct_nmea for the module. */
|
||
/* This is the interface for the lct_nmea. */
|
||
typedef struct _GnssInfo
|
||
{
|
||
int update; // GNSS更新标志位 1:更新 0:不更新
|
||
double local_timestamp; // 当地时间
|
||
float accuracy; // GPS 输出的Accuracy参数,Accuracy > 0 当其为负数表示无效
|
||
int sat_visible_number; // 当前时间可见卫星数量
|
||
float snr_list[_GNSS_INDEX_LEN]; // 当前时间可见卫星的SNR列表
|
||
int sat_used_list[_GNSS_INDEX_LEN]; // 当前使用卫星列表
|
||
} GnssInfo;
|
||
|
||
/* Usage: 标记GNSS中的各个卫星系统 */
|
||
|
||
/* Struct Declaration -------------------------------------------*/
|
||
/*===============================================================*/
|
||
|
||
|
||
/* Function Declaration -------------------------------------------*/
|
||
/*=================================================================*/
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* Function Name: sceneRecognitionInit() */
|
||
/* Usage: Initialization module for configuring related resources */
|
||
/* and must be executed once first beforing using the scene */
|
||
/* recognition module funcition. */
|
||
/* Param @ (NONE) */
|
||
/* Return @ init_res: Result state of the initialization process. */
|
||
SCENE_INIT_STATE initSceneRecognition(void);
|
||
|
||
/* Function Name: scene_recognition_reset() */
|
||
/* Usage: 初始化模块,配置相关资源,在使用模块前必须首先被执行。 */
|
||
/* Param @ (NONE) */
|
||
/* Return @ init_res: 重置执行结果。 */
|
||
SCENE_INIT_STATE scene_recognition_reset(void);
|
||
|
||
/**----------------------------------------------------------------------
|
||
* Function : sceneRecognitionProc
|
||
* Description : GNSS场景识别处理流程:
|
||
* 1)将nmea转换为gnss
|
||
* 2) 通过accuracy、snr、卫星数量分析GNSS信号质量
|
||
* 3) 返回结果
|
||
* Input : PDR的nmea结构体
|
||
* Return : 场景识别结果
|
||
* Date : 2020/02/18
|
||
*
|
||
*
|
||
*
|
||
*
|
||
*
|
||
*
|
||
*---------------------------------------------------------------------**/
|
||
SCENE_RECOGNITION_RESULT sceneRecognitionProc(const lct_nmea* nmea);
|
||
|
||
/* Function Name: scene_recognition_destroy() */
|
||
/* Usage: 场景识别处理结束后的资源释放操作,资源释放后无法继续进行场 */
|
||
/* 景识别过程。 */
|
||
/* Param @ (NONE) */
|
||
/* Return @ destroy_state: 资源释放操作结果。 */
|
||
SCENE_DESTROY_STATE scene_recognition_destroy(void);
|
||
|
||
/**----------------------------------------------------------------------
|
||
* Function : isOpenArea
|
||
* Description : GNSS开阔地检测,通过输入GNSS信号,分析当前信号质量,从而确定
|
||
* 目标是否处于开阔场地。
|
||
* Return : 0 : 非开阔地 1:开阔地(信号质量较好)
|
||
* Author : Zhang Jingrui, Geek ID: 11082826
|
||
* Date : 2020/02/18 logzhan
|
||
*---------------------------------------------------------------------**/
|
||
int isOpenArea(const lct_nmea* nmea);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
#endif //__SCENE_RECOGNITION_H__
|