error.h 9.2 KB

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