Sygaldry
Loading...
Searching...
No Matches
sygsp-complementary_mimu_fusion.hpp
1#pragma once
2/*
3Copyright 2023 Travis J. West, Input Devices and Music Interaction Laboratory
4(IDMIL), Centre for Interdisciplinary Research in Music Media and Technology
5(CIRMMT), McGill University, Montréal, Canada, and Univ. Lille, Inria, CNRS,
6Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
7
8SPDX-License-Identifier: MIT
9*/
10
11#include <array>
12#include "sygac-mimu.hpp"
13#include "sygsp-complementary_mimu_fusion_endpoints.hpp"
14
15namespace sygaldry { namespace sygsp {
16
20
24
30void complementary_mimu_fusion_init( ComplementaryMimuFusionInputs& in
31 , ComplementaryMimuFusionOutputs& out
32 );
33
34
44void complementary_mimu_fusion( const std::array<float, 3>& gyro
45 , const std::array<float, 3>& accl, bool accl_updated
46 , const std::array<float, 3>& magn, bool magn_updated
47 , const unsigned long elapsed
48 , const ComplementaryMimuFusionInputs& in
49 , ComplementaryMimuFusionOutputs& out
50 );
51
59template<MimuComponent Mimu>
61: name_<"Complementary MIMU Fusion Filter">
62, description_<"Runtime calibration and sensor fusion using a complementary filter approach">
63, author_<"Travis J. West">
64, copyright_<"Copyright 2023 Sygaldry Contributors">
65, license_<"SPDX-License-Identifier: MIT">
66, version_<"0.0.0">
67{
69
71
73 void init()
74 {
75 complementary_mimu_fusion_init(inputs, outputs);
76 }
77
79 void main(const Mimu& mimu)
80 {
81 if (gyro_of(mimu).updated)
83 , accl_of(mimu), accl_of(mimu).updated
84 , magn_of(mimu), magn_of(mimu).updated
85 , mimu.outputs.elapsed
86 , inputs, outputs);
87 }
88};
89
92
93} }
auto & magn_of(auto &mimu_data)
Access the magnetometer data of a presumed MIMU data structure.
Definition sygac-mimu.hpp:52
auto & accl_of(auto &mimu_data)
Access the accelerometer data of a presumed MIMU data structure.
Definition sygac-mimu.hpp:30
auto & gyro_of(auto &mimu_data)
Access the gyroscope data of a presumed MIMU data structure.
Definition sygac-mimu.hpp:42
void complementary_mimu_fusion(const std::array< float, 3 > &gyro, const std::array< float, 3 > &accl, bool accl_updated, const std::array< float, 3 > &magn, bool magn_updated, const unsigned long elapsed, const ComplementaryMimuFusionInputs &in, ComplementaryMimuFusionOutputs &out)
Definition sygsp-complementary_mimu_fusion.cpp:52
void complementary_mimu_fusion_init(ComplementaryMimuFusionInputs &in, ComplementaryMimuFusionOutputs &out)
Definition sygsp-complementary_mimu_fusion.cpp:45
Document the author of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:39
Document the copyright statement of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:47
Document a textual description of an entity, e.g. an endpoint, component or binding.
Definition sygah-metadata.hpp:35
Document the copyright license of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:45
Document the name of an entity, e.g. an endpoint, component, or binding.
Definition sygah-metadata.hpp:33
Inputs for the MIMU sensor fusion component.
Definition sygsp-complementary_mimu_fusion_endpoints.hpp:25
Outputs of the MIMU sensor fusion component.
Definition sygsp-complementary_mimu_fusion_endpoints.hpp:73
MIMU sensor fusion and runtime calibration component.
Definition sygsp-complementary_mimu_fusion.hpp:67
void main(const Mimu &mimu)
Update the filter.
Definition sygsp-complementary_mimu_fusion.hpp:79
void init()
Initialize the filter.
Definition sygsp-complementary_mimu_fusion.hpp:73
Document a textual description of the version number of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:51