00001 /*!@file Robots2/Beobot2/Navigation/Gist_Navigation/Gist_Navigation.H Ice Module to Log data */ 00002 // //////////////////////////////////////////////////////////////////// // 00003 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00004 // University of Southern California (USC) and the iLab at USC. // 00005 // See http://iLab.usc.edu for information about this project. // 00006 // //////////////////////////////////////////////////////////////////// // 00007 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00008 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00009 // in Visual Environments, and Applications'' by Christof Koch and // 00010 // Laurent Itti, California Institute of Technology, 2001 (patent // 00011 // pending; application number 09/912,225 filed July 23, 2001; see // 00012 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00013 // //////////////////////////////////////////////////////////////////// // 00014 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00015 // // 00016 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00017 // redistribute it and/or modify it under the terms of the GNU General // 00018 // Public License as published by the Free Software Foundation; either // 00019 // version 2 of the License, or (at your option) any later version. // 00020 // // 00021 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00022 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00023 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00024 // PURPOSE. See the GNU General Public License for more details. // 00025 // // 00026 // You should have received a copy of the GNU General Public License // 00027 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00028 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00029 // Boston, MA 02111-1307 USA. // 00030 // //////////////////////////////////////////////////////////////////// // 00031 // 00032 // Primary maintainer for this file: Christian Siagian <siagian@usc.edu> 00033 // $HeadURL: svn://ilab.usc.edu/trunk/saliency/src/Robots/Beobot2/Navigation/Gist_Navigation/Gist_Navigation.H 00034 // $Id: Gist_Navigation.H 12962 2010-03-06 02:13:53Z irock $ 00035 // 00036 00037 #include "Component/ModelComponent.H" 00038 #include "Component/ModelParam.H" 00039 00040 #include "Robots/RobotBrain/RobotBrainComponent.H" 00041 #include "Util/Timer.H" 00042 00043 #include "Ice/RobotBrainObjects.ice.H" 00044 #include "Ice/RobotSimEvents.ice.H" 00045 #include <IceUtil/Thread.h> 00046 00047 #include "Robots/Beobot2/BeoCommon.H" 00048 00049 #include "Media/FrameSeries.H" 00050 00051 #include "Image/Image.H" 00052 #include "GUI/SimpleMeter.H" 00053 00054 #include "Neuro/GistEstimatorFFT.H" 00055 #include "Gist/FFN.H" 00056 00057 #include <vector> 00058 00059 #ifndef GIST_NAVIGATIONI_H 00060 #define GIST_NAVIGATIONI_H 00061 00062 typedef struct _RegionInformation 00063 { 00064 uint start; 00065 uint end; 00066 00067 float minDistance; 00068 uint minIndex; 00069 } 00070 RegionInformation; 00071 00072 class Gist_Navigation : public RobotBrainComponent 00073 { 00074 public: 00075 00076 Gist_Navigation(OptionManager& mgr, 00077 const std::string& descrName = "Gist_Navigation", 00078 const std::string& tagName = "Gist_Navigation"); 00079 00080 ~Gist_Navigation(); 00081 00082 virtual void evolve(); 00083 00084 //! Get a message 00085 virtual void updateMessage 00086 (const RobotSimEvents::EventMessagePtr& eMsg, 00087 const Ice::Current&); 00088 00089 virtual void registerTopics(); 00090 00091 void start1(); 00092 00093 private: 00094 Image<float> normalize(Image<float> img); 00095 00096 Beobot2::MotorCommand computeGist_Navigation(); 00097 00098 void updateMotor(double tran,double rot); 00099 00100 void drawState(); 00101 00102 void initFFN(); 00103 00104 Image<PixRGB<byte> > itsCurrImg; 00105 Image<PixRGB<byte> > itsProcImg; 00106 Image<float> itsNormalizedProcImg; 00107 00108 Image<double> itsFftFeatures; 00109 00110 IceUtil::Mutex its_Curr_Img_mutex; //!< locking log filename 00111 IceUtil::Mutex its_Curr_Mtr_mutex; //!< locking log filename 00112 00113 nub::soft_ref<GistEstimatorFFT> itsFftComputer; 00114 nub::soft_ref<OutputFrameSeries> itsOfs; 00115 Image<PixRGB<byte> > itsDispImg; 00116 00117 rutz::shared_ptr<FeedForwardNetwork> itsFfn; 00118 Image<double> itsPcaIcaVector; 00119 Image<double> itsFfnResults; 00120 00121 Timer itsTimer; 00122 int itsCurrImgID; 00123 int itsPrevProcImgID; 00124 double itsRcTransSpeed; 00125 double itsRcRotSpeed; 00126 int itsRemoteMode; 00127 00128 bool itsTrainMode; 00129 Image<double> itsNNrotCommand; 00130 Image<double> itsRCrotCommand; 00131 00132 }; 00133 00134 #endif 00135 00136 00137 // ###################################################################### 00138 /* So things look consistent in everyone's emacs... */ 00139 /* Local Variables: */ 00140 /* indent-tabs-mode: nil */ 00141 /* End: */