API Documentation
Loading...
Searching...
No Matches
MagneticCalibration.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/IOFactory.h>
4#include <NDEVR/Model.h>
5#include <NDEVR/Buffer.h>
6#include <NDEVR/Vector.h>
7namespace NDEVR
8{
9 /**--------------------------------------------------------------------------------------------------
10 Class: MagneticCalibrationData
11
12 \brief Stores magnetic calibration data as a Model including the transformation and calibration points
13 \ingroup Hardware Magnetometer
14 *-----------------------------------------------------------------------------------------------**/
16 {
17 public:
18 MagneticCalibrationData(const Model& model);
21 void addCalibrationPoint(const Vector<3, fltp08>& point, fltp08 hm = 1.0);
22 void clearData();
23 bool resetToActive();
24 void calculate(fltp08 hm = 1.0);
25 void removeOutliers(fltp08 rejection);
26 void writeToFile(File calibration_file, bool is_active);
27 void readFromFile(File calibration_file, bool is_active);
28 void setVertices(const Buffer<Vector<3, fltp08>>& vertices);
29 void setB(const Vector<3, fltp08>& B);
30 void setA(const Vector<9, fltp08>& A);
31 Vector<3, fltp08> B() const;
32 Vector<9, fltp08> A() const;
33 Buffer<Vector<3, fltp08>> data() const;
34 fltp08 stdDev() const;
35 fltp08 meanVectorLength() const;
36 Model calibratedModel() const;
37 Model uncalibratedModel() const;
38 bool hasSufficientData() const;
39 fltp04 calibrationPercent() const;
40 uint04 dataSize() const;
41 static constexpr const char* TypeName() { return "magnetic_calibration"; }
42 static Matrix<fltp08> CalibrationMatrix(const Vector<9, fltp08>& A, const Vector<3, fltp08>& B);
43 protected:
44 void updateAndApplyCalibrationMatrix(const Vector<9, fltp08>& A, const Vector<3, fltp08>& B);
45 protected:
46 void init();
47 };
48
49 /**--------------------------------------------------------------------------------------------------
50 Class: MagneticCalibrationFactory
51
52 \brief IOFactory interface for reading and writing MagneticCalibrationData to files.
53 \ingroup Hardware Magnetometer
54 *-----------------------------------------------------------------------------------------------**/
56 {
57 public:
59 private:
60 void getSupportedFormats(Buffer<FileFormat>& formats, bool is_read) override;
61 Buffer<UUID> filterModelsToExport(Buffer<UUID> models_to_check, const DesignObjectLookup* lookup, const FileFormat& export_format) const override;
62 bool readFile(FactoryParameters& file) override;
63 bool writeFile(FactoryParameters& file) override;
64 virtual FactoryFeatures factoryFeatures(const FactoryParameters& file, bool is_import) const override;
65 };
66}
#define HARDWARE_API
Definition DLLInfo.h:74
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition DesignObjectLookup.h:61
Definition FactoryFeatures.h:40
Definition FileFormat.h:38
Definition File.h:47
Definition IOFactory.h:99
Stores magnetic calibration data as a Model including the transformation and calibration points.
Definition MagneticCalibration.h:16
static constexpr const char * TypeName()
Definition MagneticCalibration.h:41
IOFactory interface for reading and writing MagneticCalibrationData to files.
Definition MagneticCalibration.h:56
Definition Matrix.hpp:173
Definition Model.h:54
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
A vertex.
Definition Vertex.hpp:54
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
@ B
Definition BaseValues.hpp:203
@ A
Definition BaseValues.hpp:201
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition IOFactory.h:56