orocos_kdl
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,
108  };
109 
113  {}
114 
115  virtual ~SolverI()
116  {}
117 
119  virtual int getError() const { return error; }
120 
125  virtual const char* strError(const int error) const
126  {
127  if (E_NOERROR == error) return "No error";
128  else if (E_NO_CONVERGE == error) return "Failed to converge";
129  else if (E_UNDEFINED == error) return "Undefined value";
130  else if (E_DEGRADED == error) return "Converged but degraded solution";
131  else if (E_NOT_UP_TO_DATE == error) return "Internal data structures not up to date with Chain";
132  else if (E_SIZE_MISMATCH == error) return "The size of the input does not match the internal state";
133  else if (E_MAX_ITERATIONS_EXCEEDED == error) return "The maximum number of iterations is exceeded";
134  else if (E_OUT_OF_RANGE == error) return "The requested index is out of range";
135  else if (E_NOT_IMPLEMENTED == error) return "The requested function is not yet implemented";
136  else if (E_SVD_FAILED == error) return "SVD failed";
137  else return "UNKNOWN ERROR";
138  }
139 
145  virtual void updateInternalDataStructures() = 0;
146 
147 protected:
149  int error;
150 };
151 
152 } // namespaces
153 
154 #endif
KDL::SolverI::updateInternalDataStructures
virtual void updateInternalDataStructures()=0
KDL::SolverI::strError
virtual const char * strError(const int error) const
Definition: solveri.hpp:125
KDL::SolverI::~SolverI
virtual ~SolverI()
Definition: solveri.hpp:115
KDL::SolverI::E_NO_CONVERGE
@ E_NO_CONVERGE
Failed to converge.
Definition: solveri.hpp:93
KDL::SolverI::E_NOT_UP_TO_DATE
@ E_NOT_UP_TO_DATE
Chain size changed.
Definition: solveri.hpp:97
KDL::SolverI::E_NOT_IMPLEMENTED
@ E_NOT_IMPLEMENTED
Not yet implemented.
Definition: solveri.hpp:105
KDL
Definition: kukaLWR_DHnew.cpp:25
KDL::SolverI::E_MAX_ITERATIONS_EXCEEDED
@ E_MAX_ITERATIONS_EXCEEDED
Maximum number of iterations exceeded.
Definition: solveri.hpp:101
KDL::SolverI::E_OUT_OF_RANGE
@ E_OUT_OF_RANGE
Requested index out of range.
Definition: solveri.hpp:103
KDL::SolverI::E_SIZE_MISMATCH
@ E_SIZE_MISMATCH
Input size does not match internal state.
Definition: solveri.hpp:99
KDL::SolverI::E_UNDEFINED
@ E_UNDEFINED
Undefined value (e.g. computed a NAN, or tan(90 degrees) )
Definition: solveri.hpp:95
KDL::SolverI::E_SVD_FAILED
@ E_SVD_FAILED
Internal svd calculation failed.
Definition: solveri.hpp:107
KDL::SolverI::E_DEGRADED
@ E_DEGRADED
Converged but degraded solution (e.g. WDLS with psuedo-inverse singular)
Definition: solveri.hpp:89
KDL::SolverI::getError
virtual int getError() const
Return the latest error.
Definition: solveri.hpp:119
KDL::SolverI
Definition: solveri.hpp:84
KDL::SolverI::SolverI
SolverI()
Initialize latest error to E_NOERROR.
Definition: solveri.hpp:111
KDL::SolverI::E_NOERROR
@ E_NOERROR
No error.
Definition: solveri.hpp:91
KDL::SolverI::error
int error
Latest error, initialized to E_NOERROR in constructor.
Definition: solveri.hpp:149