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 |
private static java.lang.String |
DIRECTORY |
private static java.lang.String |
EXT |
protected LowPassFilter |
lowPassFilter |
protected float[] |
max |
protected float[] |
min |
protected int |
numberOfSamplesInCalibration |
private java.util.Properties |
props |
protected float[] |
sum |
private float |
timeConstant |
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 sensors and updates array with minimum and maximum values when
the calibration process is running.
|
private java.io.File |
getFile(java.lang.String filename) |
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
private static final java.lang.String DIRECTORY
private static final java.lang.String EXT
private final java.util.Properties props
protected int numberOfSamplesInCalibration
private float timeConstant
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()
private java.io.File getFile(java.lang.String filename)
protected void load(java.lang.String filename) throws java.io.IOException
filename
- filename of the stored calibration parametersjava.io.IOException
- Exceptionprotected 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)