00001 /** 00002 \file Robots/LoBot/ui/LoLaserVizFlat.H 00003 \brief Visualizer that "flattens" the LRF data. 00004 00005 This file defines a class that implements a drawable for visualizing 00006 the laser range finder's measurement data in "flat" or Cartesian mode, 00007 i.e., the LRF data is "unrolled" from its usual polar form and 00008 displayed as a 2D line graph with the y-axis showing the distance 00009 readings and the x-axis being the angular directions along which the 00010 LRF makes its measurements. 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/ui/LoLaserVizFlat.H $ 00045 // $Id: LoLaserVizFlat.H 12859 2010-02-18 03:34:52Z mviswana $ 00046 // 00047 00048 #ifndef LOBOT_LRF_VISUALIZER_FLAT_DOT_H 00049 #define LOBOT_LRF_VISUALIZER_FLAT_DOT_H 00050 00051 //------------------------------ HEADERS -------------------------------- 00052 00053 // lobot headers 00054 #include "Robots/LoBot/ui/LoDrawable.H" 00055 #include "Robots/LoBot/io/LoLaserRangeFinder.H" 00056 00057 #include "Robots/LoBot/misc/LoTypes.H" 00058 #include "Robots/LoBot/misc/singleton.hh" 00059 00060 //----------------------------- NAMESPACE ------------------------------- 00061 00062 namespace lobot { 00063 00064 //------------------------- CLASS DEFINITION ---------------------------- 00065 00066 /** 00067 \class lobot::LaserVizFlat 00068 \brief A drawable for visualizing laser range finder data. 00069 00070 This class uses OpenGL to visualize the Hokuyo laser range finder's 00071 distance measurements. Instead of the usual polar form in which LRF 00072 data is often visualized, this visualizer is used to "flattens" the 00073 LRF measurements and show them in Cartesian form as a kind of 2D line 00074 graph. 00075 00076 The x-axis of this graph is used for the angular directions supported 00077 by the LRF. The center of this axis is for zero degrees, or straight 00078 ahead, and the left and right of the axis's center are for angles to 00079 the left and right respectively. 00080 00081 The y-axis of the graph is used for the distance readings. 00082 */ 00083 class LaserVizFlat : public Drawable { 00084 /// Since this drawable is used to visualize LRF data, it makes sense 00085 /// for it to keep handy a reference to an LRF object. 00086 const LaserRangeFinder* m_lrf ; 00087 00088 public: 00089 /// Initialization. 00090 LaserVizFlat(const LaserRangeFinder*) ; 00091 00092 /// Clean-up. 00093 ~LaserVizFlat() ; 00094 00095 private: 00096 /// This method renders the latest measurements obtained from the 00097 /// laser range finder. 00098 void render_me() ; 00099 00100 /// This inner class encapsulates various parameters that can be used 00101 /// to tweak different aspects of the LRF and behaviours' 00102 /// visualization. 00103 class Params : public singleton<Params> { 00104 /// The location and size of the LRF visualizer (within the 00105 /// Robolocust main window). 00106 Drawable::Geometry m_geometry ; 00107 00108 /// Color for the line graph used to show the laser range finder 00109 /// distance measurements. 00110 /// 00111 /// NOTE: This setting actually uses the laser_viz section's 00112 /// measurements_color option rather than having a separate option 00113 /// in the laser_viz_flat section of the config file. 00114 GLColor m_color ; 00115 00116 /// Private constructor because this is a singleton. 00117 Params() ; 00118 friend class singleton<Params> ; 00119 00120 public: 00121 /// Accessing the various parameters 00122 //@{ 00123 static const Drawable::Geometry& geometry() { 00124 return instance().m_geometry ; 00125 } 00126 static const GLColor& color() {return instance().m_color ;} 00127 //@} 00128 00129 /// Clean-up 00130 ~Params() ; 00131 } ; 00132 } ; 00133 00134 //----------------------------------------------------------------------- 00135 00136 } // end of namespace encapsulating this file's definitions 00137 00138 #endif 00139 00140 /* So things look consistent in everyone's emacs... */ 00141 /* Local Variables: */ 00142 /* indent-tabs-mode: nil */ 00143 /* End: */