SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
Implement a piecewise linear interpolation transform. More...
#include <sensesp/transforms/curveinterpolator.h>
Classes | |
class | Sample |
Protected Attributes | |
std::set< Sample > | samples_ |
String | input_title_ = "Input" |
String | output_title_ = "Output" |
Protected Attributes inherited from sensesp::Configurable | |
String | description_ = "" |
int | sort_order_ = 1000 |
Protected Attributes inherited from sensesp::ValueProducer< P > | |
P | output |
Additional Inherited Members | |
Static Public Member Functions inherited from sensesp::TransformBase | |
static const std::set< TransformBase * > & | get_transforms () |
Static Public Member Functions inherited from sensesp::Startable | |
static void | start_all () |
Public Attributes inherited from sensesp::Configurable | |
const String | config_path_ |
Protected Member Functions inherited from sensesp::Configurable | |
virtual void | load_configuration () |
Implement a piecewise linear interpolation transform.
Piecewise linear functions are defined by a collection of x,y pairs, in which the x values are monotonically increasing. The y values are the corresponding values of the function at the x values. The interpolator will linearly interpolate between the y values to produce a value for any x value.
As a practical example, consider the following samples:
At different input values, the following happens:
It can be used e.g. for non-linear analog gauges such as temperature gauges and oil pressure gauges, which get their input from analog sensors that are variable resistors.
Definition at line 35 of file curveinterpolator.h.
sensesp::CurveInterpolator::CurveInterpolator | ( | std::set< Sample > * | defaults = NULL , |
String | config_path = "" |
||
) |
Construct a new CurveInterpolator object.
defaults | Default sample values |
config_path | |
input_title | Display name for the input sample values |
output_title | Display name for the output sample values |
Definition at line 23 of file curveinterpolator.cpp.
Definition at line 133 of file curveinterpolator.cpp.
void sensesp::CurveInterpolator::clear_samples | ( | ) |
Definition at line 131 of file curveinterpolator.cpp.
|
overridevirtual |
Returns a configuration schema that specifies the key/value pairs that can be expected when calling get_configuration(), or are expected by set_configuration(). The schema will be in JSON Schema format
Reimplemented from sensesp::Configurable.
Definition at line 99 of file curveinterpolator.cpp.
|
overridevirtual |
Returns the current configuration data as a JsonObject. In general, the current state of local member variables are saved to a new object created with JsonDocument::as<JsonObject>() and returned.
Reimplemented from sensesp::Configurable.
Definition at line 71 of file curveinterpolator.cpp.
Definition at line 77 of file curveinterpolator.h.
|
overridevirtual |
Sets the current state of local member variables using the data stored in config.
Reimplemented from sensesp::Configurable.
Definition at line 106 of file curveinterpolator.cpp.
|
inline |
Definition at line 58 of file curveinterpolator.h.
|
inline |
Definition at line 62 of file curveinterpolator.h.
|
protected |
Definition at line 81 of file curveinterpolator.h.
|
protected |
Definition at line 82 of file curveinterpolator.h.
|
protected |
Definition at line 80 of file curveinterpolator.h.