Package trclib.dataprocessor
Class TrcKalmanFilter
java.lang.Object
trclib.dataprocessor.TrcFilter
trclib.dataprocessor.TrcKalmanFilter
This class implements the Kalman filter. It is useful for filtering noise from the sensor data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
private static final double
private boolean
private final double
private final double
private double
private double
Fields inherited from class trclib.dataprocessor.TrcFilter
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionTrcKalmanFilter
(String instanceName) Constructor: Create an instance of the object.TrcKalmanFilter
(String instanceName, double kQ, double kR) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiondouble
filterData
(double data) This method returns the filtered data.void
reset()
This method resets the filter.
-
Field Details
-
DEF_KQ
private static final double DEF_KQ- See Also:
-
DEF_KR
private static final double DEF_KR- See Also:
-
kQ
private final double kQ -
kR
private final double kR -
prevP
private double prevP -
prevXEst
private double prevXEst -
initialized
private boolean initialized
-
-
Constructor Details
-
TrcKalmanFilter
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.kQ
- specifies the KQ constant.kR
- specifies the KR constant.
-
TrcKalmanFilter
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
reset
public void reset()This method resets the filter. -
filterData
public double filterData(double data) This method returns the filtered data.- Specified by:
filterData
in classTrcFilter
- Parameters:
data
- specifies the data value to be filtered.- Returns:
- filtered data.
-