Package me.nabdev.oxconfig.sampleClasses
Class ConfigurableLinearInterpolation
java.lang.Object
me.nabdev.oxconfig.sampleClasses.ConfigurableLinearInterpolation
- All Implemented Interfaces:
ConfigurableClass
A configurable linear interpolation function.
This class is an example of implementing ConfigurableClass, but is safe for
competition use.
-
Constructor Summary
ConstructorsConstructorDescriptionAllocates a ConfigurableLinearInterpolation and registers it to OxConfig -
Method Summary
Modifier and TypeMethodDescriptiondoublecalculate(double x) Calculates the y value of the linear interpolation function at the given xgetKey()Gets the key of the configurable class (e.g.Gets the parameters of the configurable classGets the pretty name of the configurable class (e.g.doublegetX1()Gets the x1 valuedoublegetX2()Gets the x2 valuedoublegetY1()Gets the y1 valuedoublegetY2()Gets the y2 value
-
Constructor Details
-
ConfigurableLinearInterpolation
Allocates a ConfigurableLinearInterpolation and registers it to OxConfig- Parameters:
key- The json key for the controller to be stored in
-
-
Method Details
-
getParameters
Description copied from interface:ConfigurableClassGets the parameters of the configurable class- Specified by:
getParametersin interfaceConfigurableClass- Returns:
- The parameters of the configurable class
-
getKey
Description copied from interface:ConfigurableClassGets the key of the configurable class (e.g. "Arm"), must not include commas- Specified by:
getKeyin interfaceConfigurableClass- Returns:
- The key of the configurable class
-
getPrettyName
Description copied from interface:ConfigurableClassGets the pretty name of the configurable class (e.g. "Arm")- Specified by:
getPrettyNamein interfaceConfigurableClass- Returns:
- The pretty name of the configurable class
-
calculate
public double calculate(double x) Calculates the y value of the linear interpolation function at the given x- Parameters:
x- The x value to calculate- Returns:
- The y value of the linear interpolation function at the given x
-
getY1
public double getY1()Gets the y1 value- Returns:
- The y1 value
-
getY2
public double getY2()Gets the y2 value- Returns:
- The y2 value
-
getX1
public double getX1()Gets the x1 value- Returns:
- The x1 value
-
getX2
public double getX2()Gets the x2 value- Returns:
- The x2 value
-