org.placelab.example
Class CentroidTrackerExample

java.lang.Object
  extended byorg.placelab.client.tracker.Tracker
      extended byorg.placelab.example.CentroidTrackerExample
All Implemented Interfaces:
SpotterListener

public class CentroidTrackerExample
extends Tracker

This sample is a tracker that calculates the centroid of the observed readings. This tracker estimates the device position to be the geometric center of the readings that have the same timestamp.


Constructor Summary
CentroidTrackerExample(Mapper m)
           
 
Method Summary
 boolean acceptableMeasurement(Measurement m)
          Returns true if the tracker can make use of this reading to meaningfully update the estimate.
 Estimate getEstimate()
          return an estimate based on the last set of measurements we saw *
static void main(java.lang.String[] args)
           
protected  void resetImpl()
          Subclasses should implement this to reset themselves to their initial state.
 void updateEstimateImpl(Measurement m)
          updateEstimateImpl uses the passed measurement to compute a simple geometic center.
 void updateWithoutMeasurement(long durationMillis)
          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, updateEstimate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CentroidTrackerExample

public CentroidTrackerExample(Mapper m)
Method Detail

getEstimate

public Estimate getEstimate()
return an estimate based on the last set of measurements we saw *

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

updateEstimateImpl

public void updateEstimateImpl(Measurement m)
updateEstimateImpl uses the passed measurement to compute a simple geometic center.

Specified by:
updateEstimateImpl in class Tracker
Parameters:
m - use this to update your 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 durationMillis)
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

main

public static void main(java.lang.String[] args)