Zephyr Scientific Library (zscilib)
madgwick.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Kevin Townsend
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
23 #ifndef ZEPHYR_INCLUDE_ZSL_FUSION_MADGWICK_H_
24 #define ZEPHYR_INCLUDE_ZSL_FUSION_MADGWICK_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://www.x-io.co.uk/res/doc/madgwick_internal_report.pdf */
36 
46 };
47 
57 int zsl_fus_madg_init(uint32_t freq, void *cfg);
58 
72 int zsl_fus_madg_feed(struct zsl_vec *a, struct zsl_vec *m,
73  struct zsl_vec *g, zsl_real_t *incl, struct zsl_quat *q,
74  void *cfg);
75 
83 void zsl_fus_madg_error(int error);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* ZEPHYR_INCLUDE_ZSL_FUSION_MADGWICK_H_ */
90  /* End of algorithms group */
zsl_fus_madg_init
int zsl_fus_madg_init(uint32_t freq, void *cfg)
Sets the sample frequency (in Hz) for the algorithm.
zsl_quat
Represents a quaternion, a 4D structure capable of representing 3D rigid body orientations.
Definition: quaternions.h:89
zsl_fus_madg_cfg
Config settings for the Madwick filter.
Definition: madgwick.h:40
quaternions.h
API header file for quaternions in zscilib.
zsl_fus_madg_error
void zsl_fus_madg_error(int error)
Default error handler for the Madgwick sensor fusion driver.
vectors.h
API header file for vectors in zscilib.
zsl_fus_madg_cfg::beta
zsl_real_t beta
The filter gain beta is a positive number that represents the divergence rate of the gyroscope.
Definition: madgwick.h:45
matrices.h
API header file for matrices in zscilib.
zsl_fus_madg_feed
int zsl_fus_madg_feed(struct zsl_vec *a, struct zsl_vec *m, struct zsl_vec *g, zsl_real_t *incl, struct zsl_quat *q, void *cfg)
Madgwick sensor fusion algorithm implementation.
zsl.h
API header file for zscilib.
zsl_vec
Represents a vector.
Definition: vectors.h:40
zsl_real_t
double zsl_real_t
Definition: zsl.h:51