00001 /** 00002 \file Robots/LoBot/misc/LoExcept.H 00003 00004 \brief Various exceptions thrown by different pieces of 00005 Lobot/Robolocust. 00006 */ 00007 00008 // //////////////////////////////////////////////////////////////////// // 00009 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00010 // by the University of Southern California (USC) and the iLab at USC. // 00011 // See http://iLab.usc.edu for information about this project. // 00012 // //////////////////////////////////////////////////////////////////// // 00013 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00014 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00015 // in Visual Environments, and Applications'' by Christof Koch and // 00016 // Laurent Itti, California Institute of Technology, 2001 (patent // 00017 // pending; application number 09/912,225 filed July 23, 2001; see // 00018 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00019 // //////////////////////////////////////////////////////////////////// // 00020 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00023 // redistribute it and/or modify it under the terms of the GNU General // 00024 // Public License as published by the Free Software Foundation; either // 00025 // version 2 of the License, or (at your option) any later version. // 00026 // // 00027 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00028 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00029 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00030 // PURPOSE. See the GNU General Public License for more details. // 00031 // // 00032 // You should have received a copy of the GNU General Public License // 00033 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00034 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00035 // Boston, MA 02111-1307 USA. // 00036 // //////////////////////////////////////////////////////////////////// // 00037 // 00038 // Primary maintainer for this file: mviswana usc edu 00039 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/misc/LoExcept.H $ 00040 // $Id: LoExcept.H 13967 2010-09-18 08:00:07Z mviswana $ 00041 // 00042 00043 #ifndef LOBOT_EXCEPTIONS_DOT_H 00044 #define LOBOT_EXCEPTIONS_DOT_H 00045 00046 //------------------------------ HEADERS -------------------------------- 00047 00048 // Standard C++ headers 00049 #include <stdexcept> 00050 #include <string> 00051 00052 //----------------------------- NAMESPACE ------------------------------- 00053 00054 namespace lobot { 00055 00056 //---------------------------- ERROR CODES ------------------------------ 00057 00058 /* 00059 ************************************************************************ 00060 * * 00061 * DEVNOTE: Steps for adding a new error * 00062 * ------------------------------------- * 00063 * 1. Add an enum for the new error code here. * 00064 * * 00065 * 2. Add a #defined string for the new error in LoExcept.C. * 00066 * * 00067 * 3. Add an initializer for the new error in the constructor of the * 00068 * private messages class defined in LoExcept.C. * 00069 * * 00070 * 4. If required, add a new exception struct in the next section of * 00071 * this file and define its constructor in LoExcept.C. * 00072 * * 00073 ************************************************************************ 00074 */ 00075 enum 00076 { 00077 // Dependency/library issues 00078 MISSING_PTHREAD = 1, 00079 MISSING_LIBDC1394, 00080 MISSING_FFMPEG, 00081 MISSING_OPENCV, 00082 MISSING_OPENGL, 00083 MISSING_GLEW, 00084 MISSING_LIBURG, 00085 MISSING_LIBDEVIL, 00086 MISSING_LIBGSL, 00087 00088 // Thread related errors 00089 THREAD_CREATION_FAILURE, 00090 MUTEX_INIT_ERROR, 00091 COND_INIT_ERROR, 00092 RWLOCK_INIT_ERROR, 00093 RWLOCK_RDLOCK_FAILED, 00094 RWLOCK_WRLOCK_FAILED, 00095 00096 // FireWire bus problems 00097 INIT_PROBLEM, 00098 NO_CAMERAS, 00099 HIGHEST_NODE, 00100 00101 // Camera problems 00102 CAMERA_NODES_FREED, 00103 BAD_CAMERA_NODE_INDEX, 00104 SETUP_FAILED, 00105 START_TRANSMISSION_FAILED, 00106 00107 // Video I/O 00108 MPEG_FILES_NOT_FOUND, 00109 NO_VIDEOSTREAM_SOURCE, 00110 NO_COMPOSITOR_SOURCES, 00111 00112 // Laser range finder errors 00113 LRF_CONNECTION_FAILURE, 00114 LRF_DATA_RETRIEVAL_FAILURE, 00115 NO_LRF_SOURCE, 00116 00117 // I/O errors 00118 SERIAL_PORT_INIT_ERROR, 00119 SERIAL_PORT_BAD_ARG, 00120 SERIAL_PORT_READ_ERROR, 00121 SERIAL_PORT_WRITE_ERROR, 00122 00123 // Motor errors 00124 MOTOR_READ_FAILURE, 00125 IN_PLACE_TURNS_NOT_SUPPORTED, 00126 00127 // Incorrect command line options and configuration settings 00128 BAD_OPTION, 00129 NO_SUCH_CONFIG_FILE, 00130 CONFIG_FILE_SYNTAX_ERROR, 00131 CONFIG_FILE_MEMORY_ERROR, 00132 BAD_GEOMETRY_SPEC, 00133 MISSING_CMDLINE_ARGS, 00134 BAD_RESULTS_SPECS, 00135 00136 // Unknown models/algorithms 00137 UNKNOWN_LOCUST_MODEL, 00138 UNKNOWN_BEHAVIOR, 00139 UNKNOWN_ROBOT_PLATFORM, 00140 00141 // DAMN arbiter errors 00142 ARBITER_NOT_RUNNING, 00143 UNSUPPORTED_TURN_DIRECTION, 00144 00145 // Behaviour related errors 00146 MOTOR_SYSTEM_MISSING, 00147 LASER_RANGE_FINDER_MISSING, 00148 MAPPING_DISABLED, 00149 BOGUS_LOW_LEVEL_ODOMETRY, 00150 NO_GOALS, 00151 00152 // Assorted errors 00153 DANGER_ZONE_LRF_NOT_SETUP, 00154 NO_INPUT_SOURCE, 00155 NOT_ENOUGH_LOCUSTS, 00156 PARTICLE_INDEX_OUT_OF_BOUNDS, 00157 OPENGL_FBO_INIT_ERROR, 00158 GLEW_INIT_ERROR, 00159 OPENCV_IMAGE_INIT_ERROR, 00160 SIGNALS_MASK_SETUP_FAILURE, 00161 SIGWAIT_FAILED, 00162 LOGIC_ERROR, 00163 BROKEN_FEATURE, 00164 } ; 00165 00166 //------------------------- EXCEPTION CLASSES --------------------------- 00167 00168 // Base for all lobot exceptions 00169 class uhoh : public std::runtime_error { 00170 protected: 00171 int m_code ; 00172 uhoh(int code, const std::string& msg) ; 00173 public: 00174 int code() const throw() {return m_code ;} 00175 } ; 00176 00177 // Missing libraries 00178 struct missing_libs : public uhoh { 00179 missing_libs(int code) ; 00180 } ; 00181 00182 // Thread related errors 00183 struct thread_error : public uhoh { 00184 thread_error(int code) ; 00185 } ; 00186 00187 // 1394 bus errors 00188 struct bus_error : public uhoh { 00189 bus_error(int code) ; 00190 } ; 00191 00192 // Camera init errors 00193 struct camera_error : public uhoh { 00194 camera_error(int code) ; 00195 } ; 00196 00197 // Video I/O errors 00198 struct vstream_error : public uhoh { 00199 vstream_error(int code) ; 00200 } ; 00201 00202 // Laser range finder errors 00203 struct lrf_error : public uhoh { 00204 lrf_error(int code) ; 00205 } ; 00206 00207 // I/O errors 00208 struct io_error : public uhoh { 00209 io_error(int code) ; 00210 } ; 00211 00212 // Motor errors 00213 struct motor_error : public uhoh { 00214 motor_error(int code) ; 00215 } ; 00216 00217 // Incorrect command line options and configuration settings 00218 struct customization_error : public uhoh { 00219 customization_error(int code) ; 00220 } ; 00221 00222 // Unknown locust models, integration algorithms, etc. 00223 struct unknown_model : public uhoh { 00224 unknown_model(int code) ; 00225 } ; 00226 00227 // Arbiter errors 00228 struct arbiter_error : public uhoh { 00229 arbiter_error(int code) ; 00230 } ; 00231 00232 // Behaviour errors 00233 struct behavior_error : public uhoh { 00234 behavior_error(int code) ; 00235 } ; 00236 00237 // Miscellaneous errors 00238 struct misc_error : public uhoh { 00239 misc_error(int code) ; 00240 } ; 00241 00242 //----------------------------------------------------------------------- 00243 00244 } // end of namespace encapsulating this file's definitions 00245 00246 #endif 00247 00248 /* So things look consistent in everyone's emacs... */ 00249 /* Local Variables: */ 00250 /* indent-tabs-mode: nil */ 00251 /* End: */