00001 /** 00002 \file Robots/LoBot/control/LoVFH.H 00003 \brief A behaviour for driving and steering the robot based on a 00004 repulsive vector field. 00005 00006 This file defines a class that implements the vector field histogram 00007 concept for guiding the robot. 00008 */ 00009 00010 // //////////////////////////////////////////////////////////////////// // 00011 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00012 // by the University of Southern California (USC) and the iLab at USC. // 00013 // See http://iLab.usc.edu for information about this project. // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00016 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00017 // in Visual Environments, and Applications'' by Christof Koch and // 00018 // Laurent Itti, California Institute of Technology, 2001 (patent // 00019 // pending; application number 09/912,225 filed July 23, 2001; see // 00020 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00021 // //////////////////////////////////////////////////////////////////// // 00022 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00023 // // 00024 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00025 // redistribute it and/or modify it under the terms of the GNU General // 00026 // Public License as published by the Free Software Foundation; either // 00027 // version 2 of the License, or (at your option) any later version. // 00028 // // 00029 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00030 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00031 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00032 // PURPOSE. See the GNU General Public License for more details. // 00033 // // 00034 // You should have received a copy of the GNU General Public License // 00035 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00036 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00037 // Boston, MA 02111-1307 USA. // 00038 // //////////////////////////////////////////////////////////////////// // 00039 // 00040 // Primary maintainer for this file: Manu Viswanathan <mviswana at usc dot edu> 00041 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/control/LoVFH.H $ 00042 // $Id: LoVFH.H 12581 2010-01-16 01:57:40Z mviswana $ 00043 // 00044 00045 #ifndef LOBOT_VECTOR_FIELD_HISTOGRAM_BEHAVIOUR_DOT_H 00046 #define LOBOT_VECTOR_FIELD_HISTOGRAM_BEHAVIOUR_DOT_H 00047 00048 //------------------------------ HEADERS -------------------------------- 00049 00050 // lobot headers 00051 #include "Robots/LoBot/control/LoBehavior.H" 00052 //#include "Robots/LoBot/control/LoTurnArbiter.H" 00053 00054 #include "Robots/LoBot/misc/factory.hh" 00055 #include "Robots/LoBot/misc/singleton.hh" 00056 00057 //----------------------------- NAMESPACE ------------------------------- 00058 00059 namespace lobot { 00060 00061 //------------------------- CLASS DEFINITION ---------------------------- 00062 00063 /** 00064 \class lobot::VFH 00065 \brief A behaviour for driving and steering the robot based on a 00066 repulsive vector field. 00067 00068 This class implements a simple behaviour that uses the vector field 00069 histogram concept for robot guidance. 00070 */ 00071 class VFH : public Behavior { 00072 // Prevent copy and assignment 00073 VFH(const VFH&) ; 00074 VFH& operator=(const VFH&) ; 00075 00076 // Handy type to have around in a derived class 00077 typedef Behavior base ; 00078 00079 // Boilerplate code to make the generic factory design pattern work 00080 friend class subfactory<VFH, base> ; 00081 typedef register_factory<VFH, base> my_factory ; 00082 static my_factory register_me ; 00083 00084 /// To aid with development and debugging, this behaviour supports a 00085 /// visualization callback, which needs the most recent vote so that 00086 /// it can perform the proper visualization. 00087 //TurnArbiter::Vote m_vote ; 00088 00089 /// A private constructor because behaviours are instantiated with an 00090 /// object factory and not directly by clients. 00091 VFH() ; 00092 00093 /// Some things to do before commencing regular action processing. 00094 void pre_run() ; 00095 00096 /// This method provides the body of the behaviour's main loop. 00097 void action() ; 00098 00099 /// Visualization routines to aid with development and debugging. 00100 void render() ; 00101 00102 /// Clean-up. 00103 ~VFH() ; 00104 00105 /// This inner class encapsulates various parameters that can be used 00106 /// to tweak different aspects of the VFH behaviour. 00107 class Params : public singleton<Params> { 00108 00109 /// Private constructor because this is a singleton. 00110 Params() ; 00111 00112 // Boilerplate code to make generic singleton design pattern work 00113 friend class singleton<Params> ; 00114 00115 public: 00116 /// Accessing the various parameters. 00117 //@{ 00118 //@} 00119 00120 /// Clean-up. 00121 ~Params() ; 00122 } ; 00123 } ; 00124 00125 //----------------------------------------------------------------------- 00126 00127 } // end of namespace encapsulating this file's definitions 00128 00129 #endif 00130 00131 /* So things look consistent in everyone's emacs... */ 00132 /* Local Variables: */ 00133 /* indent-tabs-mode: nil */ 00134 /* End: */