3#include <NDEVR/Device.h>
4#include <NDEVR/Matrix.h>
5#include <NDEVR/Buffer.h>
6#include <NDEVR/INIInterface.h>
7#include <NDEVR/TranslatedString.h>
8#include <NDEVR/CalibrationData.h>
9#include <NDEVR/CalibrationPosition.h>
10#include <NDEVR/ApplicationResource.h>
13 class CalibrationData;
28 , e_rotate_to_position
79 void onReading(
const Ray<3, fltp08>& accel,
const Ray<3, fltp08>& gyro,
Time t);
121 CalibrationData m_calibration_data;
125 Ray<3, fltp08> m_gyro_bias = Ray<3, fltp08>(0.0);
126 Ray<3, fltp08> m_rotation_threshold = Ray<3, fltp08>(0.1);
127 Ray<3, fltp08> m_accelerometer_threshold = Ray<3, fltp08>(0.02);
130 Time m_step_start_time = Constant<Time>::Invalid;
132 uint04 m_samples_to_collect;
133 uint04 m_calibration_idx = 0;
134 uint04 m_valid_step_samples = 0U;
135 Status m_state = Status::e_idle;
136 Time m_calibration_time = Constant<Time>::Invalid;
137 bool m_is_moving =
false;
138 bool m_is_in_norm =
false;
The default object to store data of any type that should persist through sessions of the application.
The equivelent of std::vector but with a bit more control.
Device(const Model &model, LogPtr log, QObject *parent=nullptr)
Constructs a Device from a Model with the given log and optional Qt parent.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
void stepFinishedSignal()
Emitted when a calibration step has been completed.
Matrix< fltp08 > accelerometerTransform() const
Returns the computed accelerometer calibration transform matrix.
void setMaxRotationThreshold(const Ray< 3, fltp08 > &rotation_threshold)
Sets the maximum rotation rate threshold for stability detection.
const Buffer< CalibrationPosition > & calibrationPositions() const
Returns the list of target calibration positions.
virtual void getINI(INIFactory &factory) override
Serializes calibration settings to an INI factory.
Vertex< 3, fltp08 > gyroBias() const
Returns the computed gyroscope bias from the calibration data.
IMUCalibrator(const File &location, const Model &model)
Constructs an IMUCalibrator loading calibration data from a file.
virtual fltp04 percent() const
Returns the completion percentage of the current calibration step.
Buffer< CalibrationReading > & accData()
Returns a mutable reference to the collected accelerometer calibration data.
static ApplicationOption< fltp08 > std_dev_filter
Standard deviation threshold for filtering readings.
bool isActive() const
Returns whether the calibration process is currently active.
static ApplicationOption< TimeSpan > default_stability_span
Default time the sensor must remain stable.
Buffer< std::pair< Time, Ray< 3, fltp08 > > > & gyroData()
Returns a mutable reference to the collected gyroscope data buffer.
void setCalibrationPositions(const Buffer< CalibrationPosition > &positions)
Sets the list of target calibration positions.
virtual String iconID() const
Returns the icon identifier for this calibrator device.
void cancelCalibration()
Cancels the calibration process and returns to idle state.
bool canCalibrate() const
Returns whether enough data has been collected to compute a calibration.
void finishStep()
Finishes the current calibration step and advances to the next position.
void onReading(const Ray< 3, fltp08 > &accel, const Ray< 3, fltp08 > &gyro, Time t)
Processes a new IMU reading during calibration.
void setMaxAccelerometerThreshold(const Ray< 3, fltp08 > &rotation_threshold)
Sets the maximum accelerometer threshold for stability detection.
Time calibrationTime() const
Returns the time when calibration started.
Ray< 3, fltp08 > expectedGravity() const
Returns the expected gravity vector for the current calibration position.
const Buffer< CalibrationReading > & accData() const
Returns a const reference to the collected accelerometer calibration data.
void setMaxNormalDeviation(const Ray< 3, fltp08 > &dev)
Sets the maximum allowed deviation from the expected gravity normal.
void setCalibrationData(const CalibrationData &data)
Sets the calibration data used for computing the transform.
void setStabilitySpan(const TimeSpan &span)
Sets the time the sensor must remain stable before data collection begins.
void setSamplesToCollect(uint04 samples)
Sets the number of samples to collect per calibration position.
virtual TranslatedString message() const
Returns a translated status message describing the current calibration state.
fltp08 stdDev(fltp08 &mean_vector_length) const
Computes the standard deviation of collected data at the current position.
virtual void finishCalibration()
Computes the final calibration transform from the collected data.
IMUCalibrator(const UUID &id, const Model &model)
Constructs an IMUCalibrator with the given UUID and Model.
void startCalibration()
Starts the calibration process from the beginning.
uint04 stepIndex() const
Returns the index of the current calibration step.
Ray< 3, fltp08 > gravityTarget() const
Returns the target gravity vector for the current calibration step.
static ApplicationOption< uint04 > default_sample_count
Default number of samples per calibration step.
Status status() const
Returns the current calibration state.
Contains methods for easily reading and writing to an INI file including efficient casting,...
INIInterface()
Constructs an INIInterface with no default INI file.
Templated logic for doing matrix multiplication.
A core class that represents a node on model hierarchy.
The core String class for the NDEVR API.
Stores a time span, or difference between two times, with an optional start time.
Represents a timestamp with utilities for manipulation and conversion.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...