1 /*************************************************************************** 2 tag: Erwin Aertbelien Mon Jan 10 16:38:38 CET 2005 error.h 3 4 error.h - description 5 ------------------- 6 begin : Mon January 10 2005 7 copyright : (C) 2005 Erwin Aertbelien 8 email : erwin.aertbelien@mech.kuleuven.ac.be 9 10 *************************************************************************** 11 * This library is free software; you can redistribute it and/or * 12 * modify it under the terms of the GNU Lesser General Public * 13 * License as published by the Free Software Foundation; either * 14 * version 2.1 of the License, or (at your option) any later version. * 15 * * 16 * This library is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 19 * Lesser General Public License for more details. * 20 * * 21 * You should have received a copy of the GNU Lesser General Public * 22 * License along with this library; if not, write to the Free Software * 23 * Foundation, Inc., 51 Franklin Street, * 24 * Fifth Floor, Boston, MA 02110-1301, USA. * 25 * * 26 ***************************************************************************/ 27 28 29 /***************************************************************************** 30 * \file 31 * Defines the exception classes that can be thrown 32 * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven 33 * 34 * \version 35 * ORO_Geometry V0.2 36 * 37 * \par History 38 * - $log$ 39 * 40 * \par Release 41 * $Name: $ 42 ****************************************************************************/ 43 #ifndef ERROR_H_84822 // to make it unique, a random number 44 #define ERROR_H_84822 45 46 #include "utility.h" 47 #include <string> 48 49 namespace KDL { 50 51 /** 52 * Base class for errors generated by ORO_Geometry 53 */ 54 class Error { 55 public: 56 /** Returns a description string describing the error. 57 * the returned pointer only guaranteed to exists as long as 58 * the Error object exists. 59 */ ~Error()60 virtual ~Error() {} Description()61 virtual const char* Description() const {return "Unspecified Error\n";} 62 GetType()63 virtual int GetType() const {return 0;} 64 }; 65 66 67 class Error_IO : public Error { 68 std::string msg; 69 int typenr; 70 public: msg(_msg)71 Error_IO(const std::string& _msg="Unspecified I/O Error",int typenr=0):msg(_msg) {} Description()72 virtual const char* Description() const {return msg.c_str();} GetType()73 virtual int GetType() const {return typenr;} 74 }; 75 class Error_BasicIO : public Error_IO {}; 76 class Error_BasicIO_File : public Error_BasicIO { 77 public: Description()78 virtual const char* Description() const {return "Error while reading stream";} GetType()79 virtual int GetType() const {return 1;} 80 }; 81 class Error_BasicIO_Exp_Delim : public Error_BasicIO { 82 public: Description()83 virtual const char* Description() const {return "Expected Delimiter not encountered";} GetType()84 virtual int GetType() const {return 2;} 85 }; 86 class Error_BasicIO_Not_A_Space : public Error_BasicIO { 87 public: Description()88 virtual const char* Description() const {return "Expected space,tab or newline not encountered";} GetType()89 virtual int GetType() const {return 3;} 90 }; 91 class Error_BasicIO_Unexpected : public Error_BasicIO { 92 public: Description()93 virtual const char* Description() const {return "Unexpected character";} GetType()94 virtual int GetType() const {return 4;} 95 }; 96 97 class Error_BasicIO_ToBig : public Error_BasicIO { 98 public: Description()99 virtual const char* Description() const {return "Word that is read out of stream is bigger than maxsize";} GetType()100 virtual int GetType() const {return 5;} 101 }; 102 103 class Error_BasicIO_Not_Opened : public Error_BasicIO { 104 public: Description()105 virtual const char* Description() const {return "File cannot be opened";} GetType()106 virtual int GetType() const {return 6;} 107 }; 108 class Error_FrameIO : public Error_IO {}; 109 class Error_Frame_Vector_Unexpected_id : public Error_FrameIO { 110 public: Description()111 virtual const char* Description() const {return "Unexpected identifier, expecting a vector (explicit or ZERO)";} GetType()112 virtual int GetType() const {return 101;} 113 }; 114 class Error_Frame_Frame_Unexpected_id : public Error_FrameIO { 115 public: Description()116 virtual const char* Description() const {return "Unexpected identifier, expecting a Frame (explicit or DH)";} GetType()117 virtual int GetType() const {return 102;} 118 }; 119 class Error_Frame_Rotation_Unexpected_id : public Error_FrameIO { 120 public: Description()121 virtual const char* Description() const {return "Unexpected identifier, expecting a Rotation (explicit or EULERZYX, EULERZYZ, RPY,ROT,IDENTITY)";} GetType()122 virtual int GetType() const {return 103;} 123 }; 124 class Error_ChainIO : public Error {}; 125 class Error_Chain_Unexpected_id : public Error_ChainIO { 126 public: Description()127 virtual const char* Description() const {return "Unexpected identifier, expecting TRANS or ROT";} GetType()128 virtual int GetType() const {return 201;} 129 }; 130 //! Error_Redundancy indicates an error that occured during solving for redundancy. 131 class Error_RedundancyIO:public Error_IO {}; 132 class Error_Redundancy_Illegal_Resolutiontype : public Error_RedundancyIO { 133 public: Description()134 virtual const char* Description() const {return "Illegal Resolutiontype is used in I/O with ResolutionTask";} GetType()135 virtual int GetType() const {return 301;} 136 }; 137 class Error_Redundancy:public Error {}; 138 class Error_Redundancy_Unavoidable : public Error_Redundancy { 139 public: Description()140 virtual const char* Description() const {return "Joint limits cannot be avoided";} GetType()141 virtual int GetType() const {return 1002;} 142 }; 143 class Error_Redundancy_Low_Manip: public Error_Redundancy { 144 public: Description()145 virtual const char* Description() const {return "Manipulability is very low";} GetType()146 virtual int GetType() const {return 1003;} 147 }; 148 class Error_MotionIO : public Error {}; 149 class Error_MotionIO_Unexpected_MotProf : public Error_MotionIO { 150 public: Description()151 virtual const char* Description() const { return "Wrong keyword while reading motion profile";} GetType()152 virtual int GetType() const {return 2001;} 153 }; 154 class Error_MotionIO_Unexpected_Traj : public Error_MotionIO { 155 public: Description()156 virtual const char* Description() const { return "Trajectory type keyword not known";} GetType()157 virtual int GetType() const {return 2002;} 158 }; 159 160 class Error_MotionPlanning : public Error {}; 161 162 class Error_MotionPlanning_Circle_ToSmall : public Error_MotionPlanning { 163 public: Description()164 virtual const char* Description() const { return "Circle : radius is to small";} GetType()165 virtual int GetType() const {return 3001;} 166 }; 167 168 class Error_MotionPlanning_Circle_No_Plane : public Error_MotionPlanning { 169 public: Description()170 virtual const char* Description() const { return "Circle : Plane for motion is not properly defined";} GetType()171 virtual int GetType() const {return 3002;} 172 }; 173 174 class Error_MotionPlanning_Incompatible: public Error_MotionPlanning { 175 public: Description()176 virtual const char* Description() const { return "Acceleration of a rectangular velocityprofile cannot be used";} GetType()177 virtual int GetType() const {return 3003;} 178 }; 179 180 class Error_MotionPlanning_Not_Feasible: public Error_MotionPlanning { 181 public: Description()182 virtual const char* Description() const { return "Motion Profile with requested parameters is not feasible";} GetType()183 virtual int GetType() const {return 3004;} 184 }; 185 186 class Error_MotionPlanning_Not_Applicable: public Error_MotionPlanning { 187 public: Description()188 virtual const char* Description() const { return "Method is not applicable for this derived object";} GetType()189 virtual int GetType() const {return 3004;} 190 }; 191 //! Abstract subclass of all errors that can be thrown by Adaptive_Integrator 192 class Error_Integrator : public Error {}; 193 194 //! Error_Stepsize_Underflow is thrown if the stepsize becomes to small 195 class Error_Stepsize_Underflow : public Error_Integrator { 196 public: Description()197 virtual const char* Description() const { return "Stepsize Underflow";} GetType()198 virtual int GetType() const {return 4001;} 199 }; 200 201 //! Error_To_Many_Steps is thrown if the number of steps needed to 202 //! integrate to the desired accuracy becomes to big. 203 class Error_To_Many_Steps : public Error_Integrator { 204 public: Description()205 virtual const char* Description() const { return "To many steps"; } GetType()206 virtual int GetType() const {return 4002;} 207 }; 208 209 //! Error_Stepsize_To_Small is thrown if the stepsize becomes to small 210 class Error_Stepsize_To_Small : public Error_Integrator { 211 public: Description()212 virtual const char* Description() const { return "Stepsize to small"; } GetType()213 virtual int GetType() const {return 4003;} 214 }; 215 216 class Error_Criterium : public Error {}; 217 218 class Error_Criterium_Unexpected_id: public Error_Criterium { 219 public: Description()220 virtual const char* Description() const { return "Unexpected identifier while reading a criterium"; } GetType()221 virtual int GetType() const {return 5001;} 222 }; 223 224 class Error_Limits : public Error {}; 225 226 class Error_Limits_Unexpected_id: public Error_Limits { 227 public: Description()228 virtual const char* Description() const { return "Unexpected identifier while reading a jointlimits"; } GetType()229 virtual int GetType() const {return 6001;} 230 }; 231 232 233 class Error_Not_Implemented: public Error { 234 public: Description()235 virtual const char* Description() const { return "The requested object/method/function is not implemented"; } GetType()236 virtual int GetType() const {return 7000;} 237 }; 238 239 240 241 } 242 243 #endif 244