Zephyr Scientific Library (zscilib)
kalman.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Marti Riba Pons
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
23 #ifndef ZEPHYR_INCLUDE_ZSL_FUSION_KALMAN_H_
24 #define ZEPHYR_INCLUDE_ZSL_FUSION_KALMAN_H_
25 
26 #include <zsl/zsl.h>
27 #include <zsl/vectors.h>
28 #include <zsl/matrices.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Source: https://ahrs.readthedocs.io/en/latest/filters/ekf.html */
36 
45 
50 
55 
61  struct zsl_mtx P;
62 
63 };
64 
74 int zsl_fus_kalm_init(uint32_t freq, void *cfg);
75 
89 int zsl_fus_kalm_feed(struct zsl_vec *a, struct zsl_vec *m,
90  struct zsl_vec *g, zsl_real_t *incl, struct zsl_quat *q,
91  void *cfg);
92 
100 void zsl_fus_kalm_error(int error);
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /* ZEPHYR_INCLUDE_ZSL_FUSION_KALMAN_H_ */
107  /* End of algorithms group */
zsl_fus_kalm_cfg::P
struct zsl_mtx P
The predicted error state covariance, which is updated every iteration. Its first value (P0) is a 4x4...
Definition: kalman.h:61
zsl_quat
Represents a quaternion, a 4D structure capable of representing 3D rigid body orientations.
Definition: quaternions.h:89
zsl_mtx
Represents a m x n matrix, with data stored in row-major order.
Definition: matrices.h:46
zsl_fus_kalm_cfg
Config settings for the extended Kalman filter.
Definition: kalman.h:40
zsl_fus_kalm_cfg::var_g
zsl_real_t var_g
Noise spectral density of the gyroscope, in rad/s.
Definition: kalman.h:44
quaternions.h
API header file for quaternions in zscilib.
vectors.h
API header file for vectors in zscilib.
zsl_fus_kalm_init
int zsl_fus_kalm_init(uint32_t freq, void *cfg)
Sets the sample frequency (in Hz) for the algorithm.
zsl_fus_kalm_cfg::var_a
zsl_real_t var_a
Noise spectral density of the accelerometer, in m/s.
Definition: kalman.h:49
zsl_fus_kalm_error
void zsl_fus_kalm_error(int error)
Default error handler for the extended Kalman filter driver.
matrices.h
API header file for matrices in zscilib.
zsl.h
API header file for zscilib.
zsl_vec
Represents a vector.
Definition: vectors.h:40
zsl_fus_kalm_cfg::var_m
zsl_real_t var_m
Noise spectral density of the magnetometer, in micro Tesla.
Definition: kalman.h:54
zsl_real_t
double zsl_real_t
Definition: zsl.h:51
zsl_fus_kalm_feed
int zsl_fus_kalm_feed(struct zsl_vec *a, struct zsl_vec *m, struct zsl_vec *g, zsl_real_t *incl, struct zsl_quat *q, void *cfg)
Extended Kalman filter algorithm implementation.