LoLGMDExtricateVFF.H

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/control/LoLGMDExtricateVFF.H
00003    \brief A behaviour for getting the robot unstuck using the raw LGMD
00004    spikes and a virtual force field.
00005 
00006    This file defines a class that implements the virtual force field
00007    concept for moving lobot away from obstacles using raw LGMD spikes.
00008    What we mean by "raw" here is that this behaviour does not process the
00009    LGMD spikes in any way (e.g., time-to-impact state estimation or
00010    signal processing of any kind). Instead, the behaviour considers a
00011    spike rate threshold. When the spike rate for a locust exceeds this
00012    threshold, it is converted to a repulsive force along the direction in
00013    which that locust is looking. Similarly, spike rates below the
00014    threshold become attractive forces along their respective directions.
00015    The attractive and repulsive forces are then combined to produce a
00016    vector that is used to decide on an appropriate steering command.
00017 */
00018 
00019 // //////////////////////////////////////////////////////////////////// //
00020 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00021 // by the University of Southern California (USC) and the iLab at USC.  //
00022 // See http://iLab.usc.edu for information about this project.          //
00023 // //////////////////////////////////////////////////////////////////// //
00024 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00025 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00026 // in Visual Environments, and Applications'' by Christof Koch and      //
00027 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00028 // pending; application number 09/912,225 filed July 23, 2001; see      //
00029 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00030 // //////////////////////////////////////////////////////////////////// //
00031 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00032 //                                                                      //
00033 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00034 // redistribute it and/or modify it under the terms of the GNU General  //
00035 // Public License as published by the Free Software Foundation; either  //
00036 // version 2 of the License, or (at your option) any later version.     //
00037 //                                                                      //
00038 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00039 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00040 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00041 // PURPOSE.  See the GNU General Public License for more details.       //
00042 //                                                                      //
00043 // You should have received a copy of the GNU General Public License    //
00044 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00045 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00046 // Boston, MA 02111-1307 USA.                                           //
00047 // //////////////////////////////////////////////////////////////////// //
00048 //
00049 // Primary maintainer for this file: mviswana usc edu
00050 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/control/LoLGMDExtricateVFF.H $
00051 // $Id: LoLGMDExtricateVFF.H 13813 2010-08-21 05:36:12Z mviswana $
00052 //
00053 
00054 #ifndef LOBOT_LGMD_EXTRICATE_VFF_DOT_H
00055 #define LOBOT_LGMD_EXTRICATE_VFF_DOT_H
00056 
00057 //------------------------------ HEADERS --------------------------------
00058 
00059 // lobot headers
00060 #include "Robots/LoBot/control/LoBehavior.H"
00061 #include "Robots/LoBot/misc/LoVector.H"
00062 #include "Robots/LoBot/misc/factory.hh"
00063 
00064 // Standard C++ headers
00065 #include <vector>
00066 #include <utility>
00067 
00068 //----------------------------- NAMESPACE -------------------------------
00069 
00070 namespace lobot {
00071 
00072 //------------------------- CLASS DEFINITION ----------------------------
00073 
00074 /**
00075    \class lobot::LGMDExtricateVFF
00076 
00077    \brief A behaviour for moving the robot away from obstacles by
00078    applying a virtual force field comprised of repulsive and attractive
00079    forces based on the raw LGMD inputs.
00080 
00081    This class implements a behaviour designed to move lobot away from
00082    obstacles obstructing its path by applying the virtual force field
00083    concept using raw LGMD spikes. What we mean by "raw" here is that this
00084    behaviour does not process the LGMD spikes in any way (e.g.,
00085    time-to-impact state estimation or signal processing of any kind).
00086 
00087    Instead, the behaviour considers a user-specified spike rate
00088    threshold. When the spike rate for a locust exceeds this threshold, it
00089    is converted to a repulsive force along the direction in which that
00090    locust is looking. Similarly, spike rates below the threshold become
00091    attractive forces along their respective directions. The attractive
00092    and repulsive forces are then combined to produce a vector that is
00093    used to decide on an appropriate steering command.
00094 */
00095 class LGMDExtricateVFF : public Behavior {
00096    // Prevent copy and assignment
00097    LGMDExtricateVFF(const LGMDExtricateVFF&) ;
00098    LGMDExtricateVFF& operator=(const LGMDExtricateVFF&) ;
00099 
00100    // Handy type to have around in a derived class
00101    typedef Behavior base ;
00102 
00103    // Boilerplate code to make the generic factory design pattern work
00104    friend  class subfactory<LGMDExtricateVFF, base> ;
00105    typedef register_factory<LGMDExtricateVFF, base> my_factory ;
00106    static  my_factory register_me ;
00107 
00108    /// This behaviour works by computing a virtual repulsive force for
00109    /// each locust whose LGMD spike rate exceeds some preconfigured
00110    /// threshold and an attractive force for each locust whose LGMD spike
00111    /// rate falls below the same threshold. The resulting total force
00112    /// exerted on the robot is then used to drive and steer the robot
00113    /// away from obstacles.
00114    ///
00115    /// These data members are used to keep track of the attractive,
00116    /// repulsive and total force vectors.
00117    ///
00118    /// DEVNOTE: Actually, we only need to remember these forces for
00119    /// visualization purposes.
00120    Vector m_attractive, m_repulsive, m_total_force ;
00121 
00122    /// In each iteration, this behaviour issues both a drive and a turn
00123    /// command. This structure is a convenient way to hold both these
00124    /// commands together in one place.
00125    struct Command {
00126       int drive ;
00127       int turn  ;
00128 
00129       Command() ;
00130    } ;
00131 
00132    /// This data member holds the most recent commands issued by this
00133    /// behaviour. Useful for visualization.
00134    Command m_cmd ;
00135 
00136    /// A private constructor because behaviours are instantiated with an
00137    /// object factory and not directly by clients.
00138    LGMDExtricateVFF() ;
00139 
00140    /// Things to do/check before regular action processing kicks in.
00141    void pre_run() ;
00142 
00143    /// This method implements the behaviour's extrication strategy. As
00144    /// mentioned earlier, it works by determining the sum of attractive
00145    /// and repulsive forces that are computed using LGMD spike rates and
00146    /// a threshold.
00147    void action() ;
00148 
00149    /// Visualization routine to aid with development and debugging.
00150    void render_me() ;
00151 
00152    /// Clean-up.
00153    ~LGMDExtricateVFF() ;
00154 } ;
00155 
00156 //-----------------------------------------------------------------------
00157 
00158 } // end of namespace encapsulating this file's definitions
00159 
00160 #endif
00161 
00162 /* So things look consistent in everyone's emacs... */
00163 /* Local Variables: */
00164 /* indent-tabs-mode: nil */
00165 /* End: */
Generated on Sun May 8 08:41:22 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3