LoMonitorDZone.H

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/control/LoMonitorDZone.H
00003    \brief A behaviour for monitoring the robot's danger zone and taking
00004    one of several possible actions as per the user's configuration.
00005 */
00006 
00007 // //////////////////////////////////////////////////////////////////// //
00008 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00009 // by the University of Southern California (USC) and the iLab at USC.  //
00010 // See http://iLab.usc.edu for information about this project.          //
00011 // //////////////////////////////////////////////////////////////////// //
00012 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00013 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00014 // in Visual Environments, and Applications'' by Christof Koch and      //
00015 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00016 // pending; application number 09/912,225 filed July 23, 2001; see      //
00017 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00018 // //////////////////////////////////////////////////////////////////// //
00019 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00020 //                                                                      //
00021 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00022 // redistribute it and/or modify it under the terms of the GNU General  //
00023 // Public License as published by the Free Software Foundation; either  //
00024 // version 2 of the License, or (at your option) any later version.     //
00025 //                                                                      //
00026 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00027 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00028 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00029 // PURPOSE.  See the GNU General Public License for more details.       //
00030 //                                                                      //
00031 // You should have received a copy of the GNU General Public License    //
00032 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00033 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00034 // Boston, MA 02111-1307 USA.                                           //
00035 // //////////////////////////////////////////////////////////////////// //
00036 //
00037 // Primary maintainer for this file: mviswana usc edu
00038 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/control/LoMonitorDZone.H $
00039 // $Id: LoMonitorDZone.H 14040 2010-09-24 17:55:23Z mviswana $
00040 //
00041 
00042 #ifndef LOBOT_MONITOR_DANGER_ZONE_BEHAVIOUR_DOT_H
00043 #define LOBOT_MONITOR_DANGER_ZONE_BEHAVIOUR_DOT_H
00044 
00045 //------------------------------ HEADERS --------------------------------
00046 
00047 // lobot headers
00048 #include "Robots/LoBot/control/LoBehavior.H"
00049 #include "Robots/LoBot/misc/factory.hh"
00050 
00051 // Standard C++ headers
00052 #include <vector>
00053 
00054 //----------------------------- NAMESPACE -------------------------------
00055 
00056 namespace lobot {
00057 
00058 //------------------------- CLASS DEFINITION ----------------------------
00059 
00060 /**
00061    \class lobot::MonitorDZone
00062    \brief A behaviour for monitoring the robot's danger zone and taking
00063    one of several possible actions depending on the user's config
00064    settings.
00065 
00066    This class implements a behaviour that monitors the danger zone and
00067    takes some user-specified action after it has been penetrated for at
00068    least some predetermined period. The supported actions are:
00069 
00070       - pause the robot and let user figure out how to proceed
00071       - spin by a random amount
00072       - quit the Robolocust controller application
00073 */
00074 class MonitorDZone : public Behavior {
00075    // Prevent copy and assignment
00076    MonitorDZone(const MonitorDZone&) ;
00077    MonitorDZone& operator=(const MonitorDZone&) ;
00078 
00079    // Handy type to have around in a derived class
00080    typedef Behavior base ;
00081 
00082    // Boilerplate code to make the generic factory design pattern work
00083    friend  class subfactory<MonitorDZone, base> ;
00084    typedef register_factory<MonitorDZone, base> my_factory ;
00085    static  my_factory register_me ;
00086 
00087    /// This variable keeps track of when the danger zone was penetrated.
00088    long long m_time ;
00089 
00090    /// A private constructor because behaviours are instantiated with an
00091    /// object factory and not directly by clients.
00092    MonitorDZone() ;
00093 
00094    /// This method provides the body of the behaviour's main loop.
00095    void action() ;
00096 
00097    /// This method resets the danger zone penetration time stamp.
00098    void reset() ;
00099 
00100    /// Clean-up.
00101    ~MonitorDZone() ;
00102 } ;
00103 
00104 //-----------------------------------------------------------------------
00105 
00106 } // end of namespace encapsulating this file's definitions
00107 
00108 #endif
00109 
00110 /* So things look consistent in everyone's emacs... */
00111 /* Local Variables: */
00112 /* indent-tabs-mode: nil */
00113 /* End: */
Generated on Sun May 8 08:05:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3