KDL  1.3.0
solveri.hpp
Go to the documentation of this file.
1 // Copyright (C) 2013 Stephen Roderick <kiwi dot net at mac dot com>
2 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef __SOLVERI_HPP
18 #define __SOLVERI_HPP
19 
20 namespace KDL {
21 
84 class SolverI
85 {
86 public:
87  enum {
89  E_DEGRADED = +1,
91  E_NOERROR = 0,
96  };
97 
99  SolverI() :
101  {}
102 
103  virtual ~SolverI()
104  {}
105 
107  virtual int getError() const { return error; }
108 
113  virtual const char* strError(const int error) const
114  {
115  if (E_NOERROR == error) return "No error";
116  else if (E_NO_CONVERGE == error) return "Failed to converge";
117  else return "UNKNOWN ERROR";
118  }
119 
120 protected:
122  int error;
123 };
124 
125 } // namespaces
126 
127 #endif
No error.
Definition: solveri.hpp:91
virtual int getError() const
Return the latest error.
Definition: solveri.hpp:107
virtual const char * strError(const int error) const
Return a description of the latest error.
Definition: solveri.hpp:113
Solver interface supporting storage and description of the latest error.
Definition: solveri.hpp:84
Failed to converge.
Definition: solveri.hpp:93
Undefined value (e.g. computed a NAN, or tan(90 degrees) )
Definition: solveri.hpp:95
Converged but degraded solution (e.g. WDLS with psuedo-inverse singular)
Definition: solveri.hpp:89
Definition: articulatedbodyinertia.cpp:28
SolverI()
Initialize latest error to E_NOERROR.
Definition: solveri.hpp:99
virtual ~SolverI()
Definition: solveri.hpp:103
int error
Latest error, initialized to E_NOERROR in constructor.
Definition: solveri.hpp:122