sensorfw
magcoordinatealignfilter.h
Go to the documentation of this file.
1
27#ifndef MAGCOORDINATEALIGNFILTER_H
28#define MAGCOORDINATEALIGNFILTER_H
29
31#include "filter.h"
32
37{
38private:
39 static const int DIM = 3;
40
41public:
43 setMatrix((const double[DIM][DIM]){{1,0,0},{0,1,0},{0,0,1}});
44 }
45 TMagMatrix(const TMagMatrix& other) {
46 setMatrix(other.data_);
47 }
48 TMagMatrix(double m[][DIM]) {
49 setMatrix(m);
50 }
52 setMatrix(other.data_);
53 return *this;
54 }
55
56 double get(int i, int j) const {
57 if (i >= DIM || j >= DIM || i < 0 || j < 0) {
58 qWarning("Index out of bounds");
59 return 0;
60 }
61 return data_[i][j];
62 };
63
64 void setMatrix(const double m[DIM][DIM]) {
65 memcpy(data_, m, sizeof(double[DIM][DIM]));
66 }
67
68 double data_[DIM][DIM];
69};
71
72
81{
82 Q_OBJECT
83 Q_PROPERTY(TMagMatrix transMatrix READ matrix WRITE setMatrix)
84public:
85
90 static FilterBase* factoryMethod() {
91 return new MagCoordinateAlignFilter;
92 }
93
94 const TMagMatrix& matrix() const { return matrix_; }
95
96 void setMatrix(const TMagMatrix& matrix) { matrix_ = matrix; }
97
98protected:
103
104private:
105 void filter(unsigned, const CalibratedMagneticFieldData*);
106
107 TMagMatrix matrix_;
108};
109
110#endif // MagCoordinateAlignFilter_H
Datatype for calibrated magnetometer measurements.
Coordinate alignment filter.
MagCoordinateAlignFilter()
Constructor.
const TMagMatrix & matrix() const
void setMatrix(const TMagMatrix &matrix)
static FilterBase * factoryMethod()
Factory method.
TMagMatrix holds a transformation matrix.
double get(int i, int j) const
TMagMatrix(const TMagMatrix &other)
TMagMatrix & operator=(const TMagMatrix &other)
double data_[DIM][DIM]
void setMatrix(const double m[DIM][DIM])
TMagMatrix(double m[][DIM])
Q_DECLARE_METATYPE(TMatrix)
Datatypes for different filters.