EyeHeadControllers.H

Go to the documentation of this file.
00001 /*!@file Neuro/EyeHeadControllers.H Eye/Head controllers */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/EyeHeadControllers.H $
00035 // $Id: EyeHeadControllers.H 10725 2009-02-02 01:12:31Z itti $
00036 //
00037 
00038 #ifndef NEURO_EYEHEADCONTROLLERS_H_DEFINED
00039 #define NEURO_EYEHEADCONTROLLERS_H_DEFINED
00040 
00041 #include "Neuro/EyeHeadController.H"
00042 #include "Neuro/SaccadeControllers.H"
00043 #include "Neuro/SaccadeControllerConfigurator.H"
00044 #include "Simulation/SimEvents.H"
00045 
00046 #include <vector>
00047 
00048 class EyeTrace;
00049 
00050 // ######################################################################
00051 //! Stub eye/head controller
00052 /*! No-op implementation -- never makes a decision, no matter what eye
00053   and head SaccadeControllers it may hold. */
00054 
00055 class StubEyeHeadController : public EyeHeadController
00056 {
00057 public:
00058   //! Constructor
00059   StubEyeHeadController(OptionManager& mgr);
00060 
00061   //! Destructor
00062   virtual ~StubEyeHeadController();
00063 };
00064 
00065 // ######################################################################
00066 //! Simple eye/head controller
00067 /*! This fairly trivial controller uses two independent
00068   SaccadeController objects to move the eye and the head. There is
00069   basically no interaction between the two controllers, beyond the
00070   fact that covert attention feeds to the eye, which then generates
00071   overt attention shifts, which are fed to the head. */
00072 class SimpleEyeHeadController : public EyeHeadController
00073 {
00074 public:
00075   //! Constructor. See the base classes for parameters.
00076   SimpleEyeHeadController(OptionManager& mgr);
00077 
00078   //! Destructor
00079   virtual ~SimpleEyeHeadController();
00080 
00081 protected:
00082   //! Callback for every clock tick
00083   SIMCALLBACK_DECLARE(SimpleEyeHeadController, SimEventClockTick);
00084 
00085   nub::ref<SaccadeControllerEyeConfigurator> itsSCCeye;   //!< eye SCC
00086   nub::ref<SaccadeControllerHeadConfigurator> itsSCChead; //!< head SCC
00087 
00088   nub::soft_ref<SaccadeController> itsSCeye; //!< shortcut
00089   nub::soft_ref<SaccadeController> itsSChead; //!< shortcut
00090 
00091   virtual void start1(); //!< get started
00092 };
00093 
00094 // ######################################################################
00095 //! EyeTracker eye/head controller
00096 /*! This conroller contains one or more EyeTrackerSaccadeController
00097   objects. It can hence be used to run a simulation in conjunction
00098   with some already-available human/monkey/other eye-tracking
00099   traces. Typically this would be used in conjunction with
00100   SimulationViewerEyeMvt. */
00101 class EyeTrackerEyeHeadController : public EyeHeadController
00102 {
00103 public:
00104   //! Constructor. See the base classes for parameters.
00105   EyeTrackerEyeHeadController(OptionManager& mgr);
00106 
00107   //! Destructor
00108   virtual ~EyeTrackerEyeHeadController();
00109 
00110 protected:
00111   //! Callback for every clock tick
00112   SIMCALLBACK_DECLARE(EyeTrackerEyeHeadController, SimEventClockTick);
00113 
00114   virtual void start1(); //!< get started
00115   OModelParam<std::string> itsConfig; //!< our config string
00116   std::vector<rutz::shared_ptr<EyeTrace> > itsEyeTrace; //!< our eye traces
00117   std::vector<size_t> itsEyeSample; //!< eye sample number for each tracker
00118 };
00119 
00120 
00121 // ######################################################################
00122 //! Realistic rhesus monkey eye/head controller
00123 /*! This is a hack based on Nitin's old MonkeySaccadeController but
00124   decoupling eye and head (so that the head minds its own business
00125   without influencing the eye). Not as realistic in the details, but
00126   the end result is the same. In addition to having plug-in eye and
00127   head saccade controllers, we here have an additional built-in
00128   ThresholdSaccadeController which is used to detect when the eye is
00129   stable.  */
00130 class MonkeyEyeHeadController : public EyeHeadController
00131 {
00132 public:
00133   //! Constructor
00134   MonkeyEyeHeadController(OptionManager& mgr);
00135 
00136   //! Destructor
00137   virtual ~MonkeyEyeHeadController();
00138 
00139   //! Receive a new percept (e.g., winner from saliency map)
00140   virtual void setPercept(const WTAwinner& fix, SimEventQueue& q);
00141 
00142 protected:
00143   //! Callback for every clock tick
00144   SIMCALLBACK_DECLARE(MonkeyEyeHeadController, SimEventClockTick);
00145 
00146   OModelParam<SimTime> itsBlinkWait; //!< wait time before a blink
00147   OModelParam<SimTime> itsBlinkDur;  //!< blink duration
00148   OModelParam<float> itsOdist;
00149 
00150 private:
00151   nub::ref<SpatialMetrics> itsMetrics; //!< metrics that depend on input size
00152   nub::ref<ThresholdSaccadeController> itsTSC;
00153   SimTime lastsbt; // time of end of last saccade/blink
00154   SimTime blinkt;  // time of start of current blink
00155 
00156   // compute amplitude of head displacement. All angles in degrees
00157   double headAmplitude(const double curreye, const double currhead,
00158                        const double target);
00159 };
00160 
00161 
00162 
00163 // ######################################################################
00164 /* So things look consistent in everyone's emacs... */
00165 /* Local Variables: */
00166 /* mode: c++ */
00167 /* indent-tabs-mode: nil */
00168 /* End: */
00169 
00170 #endif // NEURO_EYEHEADCONTROLLERS_H_DEFINED
Generated on Sun May 8 08:41:03 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3