org.placelab.client.tracker
Class SmoothingTracker

java.lang.Object
  extended byorg.placelab.client.tracker.Tracker
      extended byorg.placelab.client.tracker.SmoothingTracker
All Implemented Interfaces:
EstimateListener, SpotterListener

public class SmoothingTracker
extends Tracker
implements EstimateListener

This simple smoother creates a reading that is a mix of the last 2 Estimates produced by a wrapped Tracker. X and Y will not change by more than a fixed percentage, nor will the error if the Estimate has one.


Constructor Summary
SmoothingTracker(Tracker t)
           
 
Method Summary
 boolean acceptableMeasurement(Measurement m)
          Returns true if the tracker can make use of this reading to meaningfully update the estimate.
 void estimateUpdated(Tracker t, Estimate e, Measurement m)
          Implement this method to respond to updates from the Tracker(s) you are registered with.
 Estimate getEstimate()
           
 Tracker getTracker()
           
protected  void resetImpl()
          Subclasses should implement this to reset themselves to their initial state.
 void setDeviationThreshold(double newThreshold)
          Sets the threshold at which a new Estimate from the wrapped Tracker will have its standard deviation used without being smoothed with a previous Estimate's standard deviation.
 void setDistanceThreshold(double newThreshold)
          Sets the threshold at which a new Estimate from the wrapped Tracker will have its coordinate used without being smoothed with a previous Estimate's coordinate.
 void setMinDeviation(double newMin)
          Sets the minimum standard deviation an Estimate produced by this SmoothingTracker will have.
 void setNewToOldDeviationRatio(double newRatio)
          Sets the percentage by which the Estimate's standard deviation produced by this SmoothingTracke will change from its last Estimate in light of a new Estimate produced by its wrapped Tracker
 void setNewToOldRatio(double newRatio)
          Sets the percentage by which the Estimate's coordinate produced by this SmoothingTracker will change from its last Estimate in light of a new Estimate produced by its wrapped Tracker.
 java.lang.String toString()
           
 void updateEstimate(Measurement m)
          Called to give the tracker a new measurement.
protected  void updateEstimateImpl(Measurement m)
          Subclasses should implement this to do the actual work of updating their Estimate with the given Measurement.
 void updateWithoutMeasurement(long timeSinceMeasurementMillis)
          This method notifies a tracker that time has elapsed without a new mesurement.
 
Methods inherited from class org.placelab.client.tracker.Tracker
addEstimateListener, fireEstimateUpdate, getLastUpdatedTime, gotMeasurement, numberOfMeasurements, removeEstimateListener, reset, spotterExceptionThrown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmoothingTracker

public SmoothingTracker(Tracker t)
Method Detail

toString

public java.lang.String toString()

getTracker

public Tracker getTracker()

setDistanceThreshold

public void setDistanceThreshold(double newThreshold)
Sets the threshold at which a new Estimate from the wrapped Tracker will have its coordinate used without being smoothed with a previous Estimate's coordinate. The default is 1000 meters.

See Also:
setDeviationThreshold(double)

setNewToOldRatio

public void setNewToOldRatio(double newRatio)
Sets the percentage by which the Estimate's coordinate produced by this SmoothingTracker will change from its last Estimate in light of a new Estimate produced by its wrapped Tracker. For instance, if newRatio is .5, then the new Estimate is produced in the following way: newLat = previousLat + (incomingEstimateLat * .5) and the same for the longitude.

See Also:
setNewToOldDeviationRatio(double)

setDeviationThreshold

public void setDeviationThreshold(double newThreshold)
Sets the threshold at which a new Estimate from the wrapped Tracker will have its standard deviation used without being smoothed with a previous Estimate's standard deviation. The default is 500 meters.

See Also:
setDistanceThreshold(double)

setNewToOldDeviationRatio

public void setNewToOldDeviationRatio(double newRatio)
Sets the percentage by which the Estimate's standard deviation produced by this SmoothingTracke will change from its last Estimate in light of a new Estimate produced by its wrapped Tracker


setMinDeviation

public void setMinDeviation(double newMin)
Sets the minimum standard deviation an Estimate produced by this SmoothingTracker will have.


updateEstimateImpl

protected void updateEstimateImpl(Measurement m)
Description copied from class: Tracker
Subclasses should implement this to do the actual work of updating their Estimate with the given Measurement.

Specified by:
updateEstimateImpl in class Tracker
Parameters:
m - use this to update your Estimate

updateEstimate

public void updateEstimate(Measurement m)
Description copied from class: Tracker
Called to give the tracker a new measurement.

Overrides:
updateEstimate in class Tracker
Parameters:
m - A measurement from a Spotter.
See Also:
Tracker.acceptableMeasurement(Measurement)

getEstimate

public Estimate getEstimate()
Specified by:
getEstimate in class Tracker
Returns:
The Tracker's latest Estimate

acceptableMeasurement

public boolean acceptableMeasurement(Measurement m)
Description copied from class: Tracker
Returns true if the tracker can make use of this reading to meaningfully update the estimate.

Specified by:
acceptableMeasurement in class Tracker

updateWithoutMeasurement

public void updateWithoutMeasurement(long timeSinceMeasurementMillis)
Description copied from class: Tracker
This method notifies a tracker that time has elapsed without a new mesurement. This gives the tracker a chance to update its estimate to account for predicted motion.

Specified by:
updateWithoutMeasurement in class Tracker

resetImpl

protected void resetImpl()
Description copied from class: Tracker
Subclasses should implement this to reset themselves to their initial state.

Specified by:
resetImpl in class Tracker

estimateUpdated

public void estimateUpdated(Tracker t,
                            Estimate e,
                            Measurement m)
Description copied from interface: EstimateListener
Implement this method to respond to updates from the Tracker(s) you are registered with.

Specified by:
estimateUpdated in interface EstimateListener
Parameters:
t - the Tracker producing the Estimate
e - the Estimate produced by the Tracker
m - the latest Measurement used by the Tracker to produce the Estimate