org.placelab.client.tracker
Class HamsterTracker

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

public class HamsterTracker
extends Tracker
implements EstimateListener

A Tracker that wraps another Tracker and makes it behave like a Hamster in a ball. This makes it possible to reduce jitter in some Trackers. That is, the wrapped Tracker must produce Estimates whose positions lie outside the radius of a center circle in order to move the Estimate produced by the HamsterTracker. When such an Estimate is encountered, the HamsterTracker's Estimate is shifted by no more than 50% of the distance to the new Estimate's location.


Field Summary
 double RADIUS
           
 
Constructor Summary
HamsterTracker(Tracker insideTracker)
           
 
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()
           
 double getRadius()
           
protected  void resetImpl()
          Subclasses should implement this to reset themselves to their initial state.
 void setRadius(double newRadius)
          Sets the radius for which Estimates produced by the wrapped Tracker must fall away from the previous center to be incorporated into this HamsterTracker's Estimate.
 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
 

Field Detail

RADIUS

public double RADIUS
Constructor Detail

HamsterTracker

public HamsterTracker(Tracker insideTracker)
Method Detail

getRadius

public double getRadius()

setRadius

public void setRadius(double newRadius)
Sets the radius for which Estimates produced by the wrapped Tracker must fall away from the previous center to be incorporated into this HamsterTracker's Estimate. Calling this method has the side effect of resetting the HamsterTracker, since the previous center will no longer be meaningful with a different radius.


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

toString

public java.lang.String toString()

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

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