TReK C++
5.3.3
Telemetry/Command API
|
This class calibrates a value using a polynomial equation. More...
#include <polynomial_calibrator.h>
Inherits trek::Calibrator.
Public Member Functions | |
int32_t | LoadFile (const char *filename) |
Loads the PolynomialCalibrator definition from the specified file. More... | |
int32_t | SaveFile (const char *filename) |
Saves the PolynomialCalibrator definition to the specified file. More... | |
Constructors, Destructor, and Other Basic Methods | |
PolynomialCalibrator () | |
Default constructor of the class. | |
PolynomialCalibrator (PolynomialCalibrator &input) | |
Copy constructor of the class. | |
virtual | ~PolynomialCalibrator () |
Class destructor. More... | |
virtual Calibrator * | Clone () |
Creates and returns an extact copy of the object. | |
void | operator= (PolynomialCalibrator &right_side) |
Provides the equal operator. | |
virtual void | Init () |
Initializes the object. | |
Calibration Methods | |
int32_t | SetOrder (uint16_t input_value, bool keep_coefficients=false) |
Sets the order for the polynomial calibrator. More... | |
int32_t | SetCoefficient (uint16_t power, double input_value) |
Sets the coefficient value for the specified term. More... | |
uint16_t | GetOrder () |
Returns the current order of the calibrator. | |
int32_t | GetCoefficient (uint16_t power, double &value) |
Gets the coefficient value for the specified term. More... | |
int32_t | Calibrate (double input_value, double &output_value) |
Performs the calibration on the input value. More... | |
Public Member Functions inherited from trek::Calibrator | |
virtual int32_t | Calibrate (double input_value, double &output_value)=0 |
Virtual method for derived classes to calibrate an input value. More... | |
Calibrator () | |
Default constructor of the class. | |
Calibrator (Calibrator &input) | |
Copy constructor of the class. | |
virtual | ~Calibrator () |
Class destructor. More... | |
void | operator= (Calibrator &right_side) |
Provides the equal operator. | |
Public Member Functions inherited from trek::NamedItem | |
void | SetName (const char *input_ptr) |
Sets the name of the item. More... | |
void | SetAlias (const char *input) |
Sets the alias of the item. More... | |
void | SetShortDescription (const char *input_ptr) |
Sets the short description of the item. More... | |
void | SetLongDescription (const char *input_ptr) |
Sets the long description of the item. More... | |
void | SetUserDescription (const char *input_ptr) |
Sets the user description of the item. More... | |
void | SetOwner (const char *input_ptr) |
Sets the owner of the item. More... | |
const char * | GetName () |
Returns the name of the item. | |
const char * | GetAlias () |
Returns the alias of the item. | |
const char * | GetShortDescription () |
Returns the short description of the item. | |
const char * | GetLongDescription () |
Returns the long description of the item. | |
const char * | GetUserDescription () |
Returns the user description of the item. | |
const char * | GetOwner () |
Returns the owner of the item. | |
NamedItem () | |
Default constructor of the class. | |
NamedItem (NamedItem &input) | |
Copy constructor of the class. | |
virtual | ~NamedItem () |
Class destructor. More... | |
void | operator= (NamedItem &right_side) |
Provides the equal operator. | |
bool | operator== (NamedItem &right_side) |
Provides the == operator. | |
This class calibrates a value using a polynomial equation.
The order of the equation is not limited by this class, but restrictions may be placed by projects.
|
virtual |
Class destructor.
Removes all resources created with this instance of the class.
|
virtual |
Performs the calibration on the input value.
[in] | input_value | Value to calibrate. |
[out] | output_value | Calibrated value. |
Example:
Implements trek::Calibrator.
int32_t trek::PolynomialCalibrator::GetCoefficient | ( | uint16_t | power, |
double & | value | ||
) |
Gets the coefficient value for the specified term.
[in] | power | Specifies the power of the term. |
[in] | value | The value for the coefficient |
Example:
int32_t trek::PolynomialCalibrator::LoadFile | ( | const char * | filename | ) |
Loads the PolynomialCalibrator definition from the specified file.
Reads an XML format for the PolynomialCalibrator. It can be written in with SaveFile.
[in] | filename | The file to load the parameter object from. |
Example:
int32_t trek::PolynomialCalibrator::SaveFile | ( | const char * | filename | ) |
Saves the PolynomialCalibrator definition to the specified file.
Writes an XML format for the PolynomialCalibrator. It can be read in with LoadFile.
[in] | filename | The file to save the parameter object to. |
Example:
int32_t trek::PolynomialCalibrator::SetCoefficient | ( | uint16_t | power, |
double | input_value | ||
) |
Sets the coefficient value for the specified term.
[in] | power | Specifies the power of the term. |
[in] | input_value | The new value for the coefficient |
Example:
int32_t trek::PolynomialCalibrator::SetOrder | ( | uint16_t | input_value, |
bool | keep_coefficients = false |
||
) |
Sets the order for the polynomial calibrator.
If the order is higher than the previous value, memory is destroyed and then recreated.
[in] | input_value | The new order number. |
[in] | keep_coefficients | If true, current coefficients are kept. Otherwise all coefficients are set to 0. |
Example: