public abstract class AbstractCalibrationFilter extends AbstractFilter implements Calibrate
Modifier and Type | Class and Description |
---|---|
class |
AbstractCalibrationFilter.CalibrationFileException |
Modifier and Type | Field and Description |
---|---|
protected boolean |
calibrating |
protected LowPassFilter |
lowPassFilter |
protected float[] |
max |
protected float[] |
min |
protected int |
numberOfSamplesInCalibration |
protected float[] |
sum |
sampleSize, source
Constructor and Description |
---|
AbstractCalibrationFilter(SampleProvider source) |
Modifier and Type | Method and Description |
---|---|
void |
fetchSample(float[] dst,
int off)
Fetches a sample from the sensor and updates array with minimum and maximum values when
the calibration process is running.
|
protected float |
getProperty(java.lang.String key) |
protected float[] |
getPropertyArray(java.lang.String key) |
protected void |
load(java.lang.String filename)
Loads calibration parameters from the file system.
|
void |
resumeCalibration()
Resumes the process of updating calibration parameters after a stop.
|
protected void |
setProperty(java.lang.String key,
float value) |
protected void |
setPropertyArray(java.lang.String key,
float[] values) |
void |
setTimeConstant(float timeConstant)
Sets the time constant for the lowpass filter that is used when calibrating.
|
void |
startCalibration()
Starts a calibration proces.
|
void |
stopCalibration()
Halts the process of updating calibration parameters.
|
protected void |
store(java.lang.String filename)
Saves the current set of calibration parameters to the file system.
|
void |
suspendCalibration()
Halts the process of updating calibration parameters.
|
sampleSize
protected LowPassFilter lowPassFilter
protected float[] min
protected float[] max
protected float[] sum
protected boolean calibrating
protected int numberOfSamplesInCalibration
public AbstractCalibrationFilter(SampleProvider source)
public void fetchSample(float[] dst, int off)
fetchSample
in interface SampleProvider
fetchSample
in class AbstractFilter
dst
- The array to store the sample in.off
- The elements of the sample are stored in the array starting at the offset position.public void setTimeConstant(float timeConstant)
timeConstant
- between 0 and 1public void startCalibration()
startCalibration
in interface Calibrate
public void stopCalibration()
stopCalibration
in interface Calibrate
public void suspendCalibration()
public void resumeCalibration()
protected void load(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
filename
- filename of the stored calibration parametersjava.io.FileNotFoundException
java.io.IOException
protected void store(java.lang.String filename)
Calibration files are stored in /home/root/sensorCalibration/filename
filename
- Name of the file to store calibration parameters in.protected float[] getPropertyArray(java.lang.String key)
protected void setPropertyArray(java.lang.String key, float[] values)
protected void setProperty(java.lang.String key, float value)
protected float getProperty(java.lang.String key)