API Documentation
Loading...
Searching...
No Matches
IMUCalibrator.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/Device.h>
3#include <NDEVR/Matrix.h>
4#include <NDEVR/Buffer.h>
5#include <NDEVR/INIInterface.h>
6#include <NDEVR/TranslatedString.h>
7
8namespace NDEVR
9{
27 {
28 Q_OBJECT
29 enum Status
30 {
31 e_idle
32 , e_rotate_to_position
33 , e_wait_to_stable
34 , e_collect_data
35 };
36 public:
37 IMUCalibrator(const UUID& id, const Model& model);
38 IMUCalibrator(const File& location, const Model& model);
39 bool isActive() const;
40 virtual fltp04 percent() const;
41 Status status() const;
42 void setSamplesToCollect(uint04 samples);
43 Time calibrationTime() const;
44 Vertex<3, fltp08> gyroBias() const;
45 void setMaxRotationThreshold(const Ray<3, fltp08>& rotation_threshold) { m_rotation_threshold = rotation_threshold;}
46 void setMaxNormalDeviation(const Ray<3, fltp08>& dev) { m_max_norm = dev; }
47 Matrix<fltp08> accelerometerTransform() const;
48 virtual TranslatedString message() const;
49 virtual String iconID() const;
50 void onReading(const Ray<3, fltp08>& accel, const Ray<3, fltp08>& gyro, Time t);
51 bool canCalibrate() const;
52 void setCalibrationPositions(const Buffer<CalibrationPosition>& postions);
53 const Buffer<CalibrationPosition>& calibrationPositions() const { return m_calibration_positions; };
54 void startCalibration();
55 void cancelCalibration();
56 Ray<3, fltp08> expectedGravity() const;
57 virtual void getINI(INIFactory& factory) override;
60 virtual void finishCalibration();
61 uint04 stepIndex() const { return m_calibration_idx; }
62 Ray<3, fltp08> gravityTarget() const;
63 signals:
65 protected:
66 Matrix<fltp08> m_accelerometer_calibration = Constant<Matrix<fltp08>>::NaN;
69 Ray<3, fltp08> m_gyro_bias = Ray<3, fltp08>(0.0);
70 Ray<3, fltp08> m_rotation_threshold = Ray<3, fltp08>(0.1);
72 TimeSpan m_time_to_stable = TimeSpan(3.0);
73 Time m_step_start_time = Constant<Time>::NaN;
74 fltp04 m_percent = 1.0f;
75 uint04 m_samples_to_collect = 1000;
76 uint04 m_calibration_idx = 0;
77 Status m_state = Status::e_idle;
78 Time m_calibration_time = Constant<Time>::NaN;
79 bool m_is_moving = false;
80 bool m_is_in_norm = false;
81 };
82}
#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 Device.h:48
Definition File.h:47
Definition IMUCalibrator.h:27
Buffer< CalibrationPosition > m_calibration_positions
Definition IMUCalibrator.h:68
void setMaxRotationThreshold(const Ray< 3, fltp08 > &rotation_threshold)
Definition IMUCalibrator.h:45
const Buffer< CalibrationPosition > & calibrationPositions() const
Definition IMUCalibrator.h:53
uint04 stepIndex() const
Definition IMUCalibrator.h:61
void setMaxNormalDeviation(const Ray< 3, fltp08 > &dev)
Definition IMUCalibrator.h:46
Buffer< std::pair< Time, Ray< 3, fltp08 > > > m_collected_gyro_data
Definition IMUCalibrator.h:67
Definition INIReader.h:57
Definition INIInterface.h:40
Definition Matrix.hpp:173
Definition Model.h:54
Definition Vertex.hpp:341
Definition String.h:40
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TimeSpan.h:40
Definition TranslatedString.h:9
Definition UUID.h:66
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
Definition IMUCalibrator.h:11
String location_icon
Definition IMUCalibrator.h:20
Ray< 3, fltp08 > gravity
Definition IMUCalibrator.h:17
Buffer< std::pair< Time, Ray< 3, fltp08 > > > acc_data
Definition IMUCalibrator.h:18
void clearData()
Definition IMUCalibrator.h:21
CalibrationPosition(const TranslatedString &location_title, const String &image, const Ray< 3, fltp08 > &gravity)
Definition IMUCalibrator.h:12
TranslatedString location_title
Definition IMUCalibrator.h:19
Definition BaseValues.hpp:272