KDL 1.5.1
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
20namespace KDL {
21
85{
86public:
87 enum {
107 E_SVD_FAILED = -8
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
146
147protected:
149 int error;
150};
151
152} // namespaces
153
154#endif
Solver interface supporting storage and description of the latest error.
Definition: solveri.hpp:85
virtual int getError() const
Return the latest error.
Definition: solveri.hpp:119
virtual void updateInternalDataStructures()=0
Update the internal data structures.
SolverI()
Initialize latest error to E_NOERROR.
Definition: solveri.hpp:111
int error
Latest error, initialized to E_NOERROR in constructor.
Definition: solveri.hpp:149
@ E_DEGRADED
Converged but degraded solution (e.g. WDLS with psuedo-inverse singular)
Definition: solveri.hpp:89
@ E_MAX_ITERATIONS_EXCEEDED
Maximum number of iterations exceeded.
Definition: solveri.hpp:101
@ E_NOT_UP_TO_DATE
Chain size changed.
Definition: solveri.hpp:97
@ E_UNDEFINED
Undefined value (e.g. computed a NAN, or tan(90 degrees) )
Definition: solveri.hpp:95
@ E_SIZE_MISMATCH
Input size does not match internal state.
Definition: solveri.hpp:99
@ E_NOT_IMPLEMENTED
Not yet implemented.
Definition: solveri.hpp:105
@ E_NOERROR
No error.
Definition: solveri.hpp:91
@ E_NO_CONVERGE
Failed to converge.
Definition: solveri.hpp:93
@ E_SVD_FAILED
Internal svd calculation failed.
Definition: solveri.hpp:107
@ E_OUT_OF_RANGE
Requested index out of range.
Definition: solveri.hpp:103
virtual ~SolverI()
Definition: solveri.hpp:115
virtual const char * strError(const int error) const
Return a description of the latest error.
Definition: solveri.hpp:125
Definition: articulatedbodyinertia.cpp:26