LoBumpCounter.H

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/control/LoBumpCounter.H
00003    \brief A simple behaviour to log each low-level bump sensor event.
00004 
00005    This file defines a class that implements a very simple behaviour
00006    whose sole job is to log each low-level bump sensor event to the
00007    Robolocust metrics log. The intent here is to be able to keep track of
00008    all "catastrophic" failures of the LGMD-based extrication algorithms,
00009    viz., when they do not detect obstacles in time and allow the robot to
00010    physically bump into things.
00011 */
00012 
00013 // //////////////////////////////////////////////////////////////////// //
00014 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00015 // by the University of Southern California (USC) and the iLab at USC.  //
00016 // See http://iLab.usc.edu for information about this project.          //
00017 // //////////////////////////////////////////////////////////////////// //
00018 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00019 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00020 // in Visual Environments, and Applications'' by Christof Koch and      //
00021 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00022 // pending; application number 09/912,225 filed July 23, 2001; see      //
00023 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00024 // //////////////////////////////////////////////////////////////////// //
00025 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00026 //                                                                      //
00027 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00028 // redistribute it and/or modify it under the terms of the GNU General  //
00029 // Public License as published by the Free Software Foundation; either  //
00030 // version 2 of the License, or (at your option) any later version.     //
00031 //                                                                      //
00032 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00033 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00034 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00035 // PURPOSE.  See the GNU General Public License for more details.       //
00036 //                                                                      //
00037 // You should have received a copy of the GNU General Public License    //
00038 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00039 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00040 // Boston, MA 02111-1307 USA.                                           //
00041 // //////////////////////////////////////////////////////////////////// //
00042 //
00043 // Primary maintainer for this file: mviswana usc edu
00044 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/control/LoBumpCounter.H $
00045 // $Id: LoBumpCounter.H 13786 2010-08-13 00:26:38Z mviswana $
00046 //
00047 
00048 #ifndef LOBOT_BUMP_COUNTER_BEHAVIOUR_DOT_H
00049 #define LOBOT_BUMP_COUNTER_BEHAVIOUR_DOT_H
00050 
00051 //------------------------------ HEADERS --------------------------------
00052 
00053 // lobot headers
00054 #include "Robots/LoBot/control/LoBehavior.H"
00055 #include "Robots/LoBot/io/LoRobot.H"
00056 #include "Robots/LoBot/misc/factory.hh"
00057 
00058 //----------------------------- NAMESPACE -------------------------------
00059 
00060 namespace lobot {
00061 
00062 //------------------------- CLASS DEFINITION ----------------------------
00063 
00064 /**
00065    \class lobot::BumpCounter
00066    \brief A behaviour for "counting" bump events.
00067 
00068    This class implements a behaviour that logs all low-level bump sensor
00069    events to the Robolocust metrics log so that, at the end of a
00070    run/experiment, we can tell how many times and where all the
00071    LGMD-based (and, potentially, other) behaviours failed to get the
00072    robot to avoid obstacles.
00073 
00074    NOTE: This behaviour does not vote for any motor actions or perform
00075    any visualization.
00076 */
00077 class BumpCounter : public Behavior {
00078    // Prevent copy and assignment
00079    BumpCounter(const BumpCounter&) ;
00080    BumpCounter& operator=(const BumpCounter&) ;
00081 
00082    // Handy type to have around in a derived class
00083    typedef Behavior base ;
00084 
00085    // Boilerplate code to make the generic factory design pattern work
00086    friend  class subfactory<BumpCounter, base> ;
00087    typedef register_factory<BumpCounter, base> my_factory ;
00088    static  my_factory register_me ;
00089 
00090    /// A private constructor because behaviours are instantiated with an
00091    /// object factory and not directly by clients.
00092    BumpCounter() ;
00093 
00094    /// Some things to do before commencing regular action processing.
00095    void pre_run() ;
00096 
00097    /// This is the callback function for the low-level updates of the
00098    /// robot's bump sensors.
00099    static void sensor_hook(const Robot::Sensors&, unsigned long client_data) ;
00100 
00101    /// This method triggers the SLAM update using the latest control and
00102    /// sensor inputs. It is called by the run function, which takes care
00103    /// of the necessary signaling/synchronization with the main thread.
00104    void action() ;
00105 } ;
00106 
00107 //-----------------------------------------------------------------------
00108 
00109 } // end of namespace encapsulating this file's definitions
00110 
00111 #endif
00112 
00113 /* So things look consistent in everyone's emacs... */
00114 /* Local Variables: */
00115 /* indent-tabs-mode: nil */
00116 /* End: */
Generated on Sun May 8 08:41:22 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3