/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */
#ifndef _TRACKER_H_
#define _TRACKER_H_

#include <string>
#include "../headers/matrix.h"
#include "../headers/DogTypes.h"
#include "../headers/Geometry.h"
#include "../headers/Gaussian2.h"

using std::string;

// A generic front-end class which provides a common interface to
// different kinds of trackers

class Tracker {

 public:

  //------------------------------------------------------------------------
  /// Virtual destructor
  virtual ~Tracker() {}

  //------------------------------------------------------------------------
  /// Propagate the kinematics model with a new process model
  virtual void propagate(ulong timestamp)=0;

  //------------------------------------------------------------------------
  /// Set the process noise used by the propagate method
  virtual void setProcessNoise(Matrix __Q)=0;

  //------------------------------------------------------------------------
  /// Propagate with new process model and add an observation with new sensor model
  virtual void observe(ulong timestamp,
		       Matrix __z,
		       Matrix __Q,
		       Matrix __R,
		       bool imp_filter)=0;

  //------------------------------------------------------------------------
  /// Perturb the tracker with a new position with a new process model
  virtual void perturb(ulong timestamp,
		       Matrix __x,
		       int hypothesis,
		       bool clone)=0;

  /// Erase a hypothesis
  virtual void erase(int hypothesis)=0;

  //------------------------------------------------------------------------
  /// Reset the tracker
  virtual void reset(ulong timestamp,
		     Matrix __x,
		     Matrix __P)=0;

  //------------------------------------------------------------------------
  /// Number of hypothesis
  virtual int numHypotheses()=0;

  //------------------------------------------------------------------------
  /// Obtain state by parameter and hypothesis
  virtual bool getState(Matrix & val, 
			const string & param, 
			int hypothesis)=0;

  virtual bool getLikelihood(double & val,
			     int hypotheses)=0;

  /// Return the time of the observation by hypothesis
  virtual bool getTime(double & t, 
		       int hypothesis)=0;

  /// Return the time of the observation by hypothesis
  virtual bool getObservationTime(double & t, 
				  int hypothesis)=0;

  /// Obtain state by parameter and ID
  virtual bool getStateByID(Matrix & val,
			    const string & param,
			    ulong ID)=0;

  /// Return the time of the observation by ID
  virtual bool getTimeByID(double & t, 
			   ulong ID)=0;

  /// Return the time of the observation by ID
  virtual bool getObservationTimeByID(double & t, 
				      ulong ID)=0;

  //------------------------------------------------------------------------
  /// Return a unique ID of the hypothesis
  virtual bool getIDFromHypothesis(ulong & ID, 
				   int hypothesis)=0;

  /// Return the hypothesis associated with the unique ID
  virtual bool getHypothesisFromID(int & hypothesis,
  				   ulong ID)=0;
};

#endif
