#include "kalman_filter.h"
#include "../ptp_defs.h"
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <flexptp_options.h>
Go to the source code of this file.
|
typedef double | mtx[2][2] |
|
typedef double | vec[2] |
|
|
static void | mtx_copy (mtx dst, mtx src) |
|
static void | mtx_add (mtx r, mtx a, mtx b) |
|
static void | mtx_sub (mtx r, mtx a, mtx b) |
|
static void | mtx_scale (mtx r, double c, mtx a) |
|
static void | mtx_dot (vec r, mtx m, vec v) |
|
static void | mtx_mul (mtx r, mtx a, mtx b) |
|
static void | mtx_transp (mtx r, mtx m) |
|
static double | mtx_det (mtx m) |
|
static void | mtx_inverse (mtx r, mtx m) |
|
static void | mtx_print (mtx m) |
|
static void | mtx_zero (mtx m) |
|
static void | mtx_unit (mtx m) |
|
static void | vec_copy (vec r, vec v) |
|
static void | vec_add (vec r, vec a, vec b) |
|
static void | vec_sub (vec r, vec a, vec b) |
|
static void | vec_zero (vec v) |
|
static void | init_variances () |
|
void | kalman_filter_init () |
|
void | kalman_filter_deinit () |
|
void | kalman_filter_reset () |
|
static void | insert_DT (double DT) |
|
float | kalman_filter_run (int32_t dt, PtpServoAuxInput *pAux) |
|
◆ CALM_TUNING_COEFFICIENT
#define CALM_TUNING_COEFFICIENT (0.01) |
◆ FAST_TUNING_COEFFICIENT
#define FAST_TUNING_COEFFICIENT (0.2) |
◆ FAST_TUNING_THRESHOLD
#define FAST_TUNING_THRESHOLD (500E-09) |
◆ MTX_ELEMENTWISE
#define MTX_ELEMENTWISE |
( |
|
ctx | ) |
|
Value: for (uint8_t i = 0; i < 2; i++) { \
for (uint8_t j = 0; j < 2; j++) { \
ctx \
} \
}
Definition at line 41 of file kalman_filter.c.
◆ SIGMA_CT_SQUARED
#define SIGMA_CT_SQUARED (1E-10) |
◆ SIGMA_GAMMA_SQUARED
#define SIGMA_GAMMA_SQUARED (1E-12) |
◆ SIGMA_THETA_SQUARED
#define SIGMA_THETA_SQUARED (1E-16) |
A Kalman-filter based servo. This module implements the Kalman-filter introduced in the paper: 'Performance Analysis of Kalman-Filter-Based Clock Synchronization in IEEE 1588 Networks' by Giada Gorgi and Claudio Narduzzi (https://ieeexplore.ieee.org/document/5934411)
Definition at line 19 of file kalman_filter.c.
◆ SQR
#define SQR |
( |
|
x | ) |
((x) * (x)) |
◆ VEC_ELEMENTWISE
#define VEC_ELEMENTWISE |
( |
|
ctx | ) |
|
Value: for (uint8_t i = 0; i < 2; i++) { \
ctx \
}
Definition at line 48 of file kalman_filter.c.
◆ mtx
◆ vec
◆ init_variances()
static void init_variances |
( |
| ) |
|
|
static |
◆ insert_DT()
static void insert_DT |
( |
double |
DT | ) |
|
|
static |
◆ kalman_filter_deinit()
void kalman_filter_deinit |
( |
| ) |
|
◆ kalman_filter_init()
void kalman_filter_init |
( |
| ) |
|
A Kalman-filter based servo. This module implements the Kalman-filter introduced in the paper: 'Performance Analysis of Kalman-Filter-Based Clock Synchronization in IEEE 1588 Networks' by Giada Gorgi and Claudio Narduzzi (https://ieeexplore.ieee.org/document/5934411) Initialize the Kalman-filter.
Definition at line 251 of file kalman_filter.c.
◆ kalman_filter_reset()
void kalman_filter_reset |
( |
| ) |
|
◆ kalman_filter_run()
Run the Kalman-filter.
- Parameters
-
dt | time error in nanoseconds |
pAux | auxiliary synchronization cycle context data |
Definition at line 298 of file kalman_filter.c.
◆ mtx_add()
◆ mtx_copy()
static void mtx_copy |
( |
mtx |
dst, |
|
|
mtx |
src |
|
) |
| |
|
static |
◆ mtx_det()
static double mtx_det |
( |
mtx |
m | ) |
|
|
static |
◆ mtx_dot()
◆ mtx_inverse()
static void mtx_inverse |
( |
mtx |
r, |
|
|
mtx |
m |
|
) |
| |
|
static |
◆ mtx_mul()
◆ mtx_print()
static void mtx_print |
( |
mtx |
m | ) |
|
|
static |
◆ mtx_scale()
static void mtx_scale |
( |
mtx |
r, |
|
|
double |
c, |
|
|
mtx |
a |
|
) |
| |
|
static |
◆ mtx_sub()
◆ mtx_transp()
static void mtx_transp |
( |
mtx |
r, |
|
|
mtx |
m |
|
) |
| |
|
static |
◆ mtx_unit()
static void mtx_unit |
( |
mtx |
m | ) |
|
|
static |
◆ mtx_zero()
static void mtx_zero |
( |
mtx |
m | ) |
|
|
static |
◆ vec_add()
◆ vec_copy()
static void vec_copy |
( |
vec |
r, |
|
|
vec |
v |
|
) |
| |
|
static |
◆ vec_sub()
◆ vec_zero()
static void vec_zero |
( |
vec |
v | ) |
|
|
static |
◆ cycle
◆ dt_prev
◆ P_pri
◆ sigma_gamma_squared
double sigma_gamma_squared |
|
static |
◆ sigma_theta_m_squared
double sigma_theta_m_squared |
|
static |
◆ sigma_theta_squared
double sigma_theta_squared |
|
static |
◆ x_pri