LoLGMDExtricateSimple.H

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/control/LoLGMDExtricateSimple.H
00003    \brief A behaviour for getting the robot unstuck using the raw LGMD
00004    spikes and a simple, reactive approach in conjunction with in-place
00005    turns as steering commands instead of "vector-style" turn commands.
00006 
00007    This file defines a class that implements a reactive obstacle
00008    avoidance behaviour that uses raw LGMD spikes as its input. The
00009    behaviour's output consists of steering commands that stop and spin
00010    the robot away from approaching obstacles rather than veer it away
00011    while it moves.
00012 */
00013 
00014 // //////////////////////////////////////////////////////////////////// //
00015 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00016 // by the University of Southern California (USC) and the iLab at USC.  //
00017 // See http://iLab.usc.edu for information about this project.          //
00018 // //////////////////////////////////////////////////////////////////// //
00019 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00020 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00021 // in Visual Environments, and Applications'' by Christof Koch and      //
00022 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00023 // pending; application number 09/912,225 filed July 23, 2001; see      //
00024 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00025 // //////////////////////////////////////////////////////////////////// //
00026 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00027 //                                                                      //
00028 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00029 // redistribute it and/or modify it under the terms of the GNU General  //
00030 // Public License as published by the Free Software Foundation; either  //
00031 // version 2 of the License, or (at your option) any later version.     //
00032 //                                                                      //
00033 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00034 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00035 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00036 // PURPOSE.  See the GNU General Public License for more details.       //
00037 //                                                                      //
00038 // You should have received a copy of the GNU General Public License    //
00039 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00040 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00041 // Boston, MA 02111-1307 USA.                                           //
00042 // //////////////////////////////////////////////////////////////////// //
00043 //
00044 // Primary maintainer for this file: mviswana usc edu
00045 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/control/LoLGMDExtricateSimple.H $
00046 // $Id: LoLGMDExtricateSimple.H 13813 2010-08-21 05:36:12Z mviswana $
00047 //
00048 
00049 #ifndef LOBOT_LGMD_EXTRICATE_SIMPLE_DOT_H
00050 #define LOBOT_LGMD_EXTRICATE_SIMPLE_DOT_H
00051 
00052 //------------------------------ HEADERS --------------------------------
00053 
00054 // lobot headers
00055 #include "Robots/LoBot/control/LoBehavior.H"
00056 #include "Robots/LoBot/misc/factory.hh"
00057 
00058 //----------------------------- NAMESPACE -------------------------------
00059 
00060 namespace lobot {
00061 
00062 //------------------------- CLASS DEFINITION ----------------------------
00063 
00064 /**
00065    \class lobot::LGMDExtricateSimple
00066 
00067    \brief A behaviour for moving the robot away from obstacles by
00068    stopping and spinning it in the direction of least LGMD spiking.
00069 
00070    This class implements a behaviour that uses raw LGMD spikes to move
00071    lobot away from obstacles obstructing its path. What we mean by "raw"
00072    here is that this behaviour does not process the LGMD spikes in any
00073    way (e.g., time-to-impact state estimation or signal processing of any
00074    kind).
00075 
00076    Instead, the behaviour simply scans the LGMD array and spins the robot
00077    to make it face the direction corresponding to minimal spiking
00078    activity.
00079 */
00080 class LGMDExtricateSimple : public Behavior {
00081    // Prevent copy and assignment
00082    LGMDExtricateSimple(const LGMDExtricateSimple&) ;
00083    LGMDExtricateSimple& operator=(const LGMDExtricateSimple&) ;
00084 
00085    // Handy type to have around in a derived class
00086    typedef Behavior base ;
00087 
00088    // Boilerplate code to make the generic factory design pattern work
00089    friend  class subfactory<LGMDExtricateSimple, base> ;
00090    typedef register_factory<LGMDExtricateSimple, base> my_factory ;
00091    static  my_factory register_me ;
00092 
00093    /// In each iteration, the lgmd_extricate_simple behaviour issues both
00094    /// a drive and a turn command. This structure is a convenient way to
00095    /// hold both these commands together in one place.
00096    struct Command {
00097       int drive ;
00098       int turn  ;
00099 
00100       Command() ;
00101    } ;
00102 
00103    /// This data member holds the behaviour's most recent drive and turn
00104    /// commands. Useful for visualization.
00105    Command m_cmd ;
00106 
00107    /// A private constructor because behaviours are instantiated with an
00108    /// object factory and not directly by clients.
00109    LGMDExtricateSimple() ;
00110 
00111    /// Things to do/check before regular action processing kicks in.
00112    void pre_run() ;
00113 
00114    /// This method implements the behaviour's extrication strategy. As
00115    /// mentioned earlier, it works by spinning the robot to face the
00116    /// direction corresponding to minimal LGMD spiking activity.
00117    void action() ;
00118 
00119    /// Visualization routine to aid with development and debugging.
00120    void render_me() ;
00121 
00122    /// Clean-up.
00123    ~LGMDExtricateSimple() ;
00124 } ;
00125 
00126 //-----------------------------------------------------------------------
00127 
00128 } // end of namespace encapsulating this file's definitions
00129 
00130 #endif
00131 
00132 /* So things look consistent in everyone's emacs... */
00133 /* Local Variables: */
00134 /* indent-tabs-mode: nil */
00135 /* End: */
Generated on Sun May 8 08:41:22 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3