31 static const char *result_strings_[3];
34 string result_message_;
36 static const string kDefaultSuccessMessage;
37 static const string kDefaultWarningMessage;
38 static const string kDefaultFailureMessage;
66 : name_(name), description_(description), cb_(cb),
67 is_calibrated_(false) {}
73 is_calibrated_ =
true;
78 void clear() { data_.clear(); is_calibrated_ =
false; }
81 std::string
getName()
const {
return name_; }
84 void setData(GRT::MatrixDouble data) { data_ = data; }
85 GRT::MatrixDouble
getData() {
return data_; }
88 std::string description_;
91 GRT::MatrixDouble data_;
151 Calibrator() : simple_calibrate_func_(nullptr), calibrate_func_(nullptr) {}
158 : simple_calibrate_func_(f), calibrate_func_(nullptr) {}
164 : simple_calibrate_func_(nullptr), calibrate_func_(f) {}
198 Calibrator& addCalibrateProcess(
const string& name,
199 const string& description,
205 return calibrate_processes_;
216 vector<double>
calibrate(vector<double> input);
231 vector<CalibrateProcess> calibrate_processes_;
232 std::set<std::string> registered_;
std::string getName() const
Definition: calibrator.h:81
std::function< double(double)> SimpleCalibrateFunc
Transforms each dimension of incoming samples of live sensor data.
Definition: calibrator.h:130
CalibrateResult(Result result)
Definition: calibrator.cpp:9
Specifies data samples and code used to calibrate incoming sensor data.
Definition: calibrator.h:121
std::string getDescription() const
Definition: calibrator.h:82
Calibrator(SimpleCalibrateFunc f)
Definition: calibrator.h:157
GRT::MatrixDouble getData()
Definition: calibrator.h:85
CalibrateResult indicates if the calibration is successful or not.
Definition: calibrator.h:15
std::function< vector< double >(vector< double >)> CalibrateFunc
Transforms incoming samples of live sensor data.
Definition: calibrator.h:144
Result getResult() const
Definition: calibrator.h:26
CalibrateResult(* CalibratorCallback)(const GRT::MatrixDouble &)
Definition: calibrator.h:52
CalibrateResult calibrate(const MatrixDouble &data)
Definition: user_accelerometer_gestures.cpp:27
void setData(GRT::MatrixDouble data)
Definition: calibrator.h:84
Definition: calibrator.h:20
Definition: calibrator.h:19
string getResultString() const
Definition: calibrator.h:27
Result
Definition: calibrator.h:17
Calibrator(CalibrateFunc f)
Definition: calibrator.h:163
CalibrateProcess(std::string name, std::string description, CalibratorCallback cb)
Definition: calibrator.h:64
bool isCalibrated() const
Definition: calibrator.h:79
string getMessage() const
Definition: calibrator.h:28
CalibrateResult calibrate(GRT::MatrixDouble data)
Definition: calibrator.h:69
A data sample to be collected by the user and callback for processing that sample.
Definition: calibrator.h:50
Definition: calibrator.h:18
vector< CalibrateProcess > & getCalibrateProcesses()
Definition: calibrator.h:204
Calibrator()
Definition: calibrator.h:151
CalibrateProcess::CalibratorCallback CalibratorCallback
Definition: calibrator.cpp:47
void clear()
Definition: calibrator.h:78