fix
This commit is contained in:
commit
582e2d3267
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// Created by villuton on 08.11.2024.
|
||||
//
|
||||
|
||||
#ifndef KALMANFILTER_H
|
||||
#define KALMANFILTER_H
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
typedef struct {
|
||||
float k;
|
||||
float result;
|
||||
float old;
|
||||
}tSimpleKalman;
|
||||
|
||||
typedef struct {
|
||||
tSimpleKalman x;
|
||||
tSimpleKalman y;
|
||||
tSimpleKalman z;
|
||||
}tSimpleKalmanVect3;
|
||||
|
||||
#endif //KALMANFILTER_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Created by villuton on 08.11.2024.
|
||||
//
|
||||
#include "KalmanFilter.h"
|
||||
void SimpleKalmanInit(tSimpleKalman *env, float k){
|
||||
env->k = k;
|
||||
env->result = (float)0.0;
|
||||
env->old = (float)0.0;
|
||||
}
|
||||
|
||||
float SimpleKalman(tSimpleKalman *env,float current){
|
||||
env->old = env->result;
|
||||
env->result = env->k * current +(1-env->k)*env->old;
|
||||
return env->result;
|
||||
}
|
||||
|
||||
void SimpleKalmanVect3Init(tSimpleKalmanVect3 *env, float k){
|
||||
SimpleKalmanInit(&env->x,k);
|
||||
SimpleKalmanInit(&env->y,k);
|
||||
SimpleKalmanInit(&env->z,k);
|
||||
}
|
||||
vector3 SimpleKalmanVect3(tSimpleKalmanVect3 *env,vector3 current){
|
||||
vector3 result = {
|
||||
SimpleKalman(&env->x,current.x),
|
||||
SimpleKalman(&env->y,current.y),
|
||||
SimpleKalman(&env->z,current.z)
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"dep": [
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "ficom_modules",
|
||||
"repo": "BaseTypes"
|
||||
}
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"Inc"
|
||||
],
|
||||
"srcs": [
|
||||
"Src/**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue