42 lines
963 B
C
42 lines
963 B
C
//
|
||
// Created by xemon on 22.11.22.
|
||
//
|
||
|
||
#ifndef UVEOS_ON_NATION_CARFLIPDETECTION_H
|
||
#define UVEOS_ON_NATION_CARFLIPDETECTION_H
|
||
|
||
#include "vector.h"
|
||
#include "stdbool.h"
|
||
|
||
typedef struct {
|
||
///пока этот флаг в нуле, событие с авари
|
||
bool enabled;
|
||
vector3 gravity;
|
||
struct {
|
||
float angleCos;
|
||
uint32_t antiFlightMs;
|
||
} thresholds;
|
||
} tCarFlipDetectionSettings;
|
||
|
||
typedef struct {
|
||
//watch value
|
||
struct {
|
||
float angleCos;
|
||
vector3 value;
|
||
uint32_t durationMs;
|
||
} current;
|
||
|
||
tCarFlipDetectionSettings *settings;
|
||
|
||
//detection result
|
||
bool flipDetected;
|
||
} tCarFlipDetection;
|
||
|
||
void CarFlipDetection_InitSettings(tCarFlipDetectionSettings *settings);
|
||
|
||
void CarFlipDetection_Init(tCarFlipDetection *env, tCarFlipDetectionSettings *settings);
|
||
|
||
void CarFlipDetection_ApplyCurrentAccel(tCarFlipDetection *env, vector3 currentValue);
|
||
|
||
#endif //UVEOS_ON_NATION_CARFLIPDETECTION_H
|