/usr/include/kdl/chainiksolvervel_pinv.hpp is in liborocos-kdl-dev 1.3.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef KDL_CHAIN_IKSOLVERVEL_PINV_HPP
#define KDL_CHAIN_IKSOLVERVEL_PINV_HPP
#include "chainiksolver.hpp"
#include "chainjnttojacsolver.hpp"
#include "utilities/svd_HH.hpp"
namespace KDL
{
/**
* Implementation of a inverse velocity kinematics algorithm based
* on the generalize pseudo inverse to calculate the velocity
* transformation from Cartesian to joint space of a general
* KDL::Chain. It uses a svd-calculation based on householders
* rotations.
*
* @ingroup KinematicFamily
*/
class ChainIkSolverVel_pinv : public ChainIkSolverVel
{
public:
static const int E_SVD_FAILED = -100; //! Child SVD failed
/// solution converged but (pseudo)inverse is singular
static const int E_CONVERGE_PINV_SINGULAR = +100;
/**
* Constructor of the solver
*
* @param chain the chain to calculate the inverse velocity
* kinematics for
* @param eps if a singular value is below this value, its
* inverse is set to zero, default: 0.00001
* @param maxiter maximum iterations for the svd calculation,
* default: 150
*
*/
explicit ChainIkSolverVel_pinv(const Chain& chain,double eps=0.00001,int maxiter=150);
~ChainIkSolverVel_pinv();
/**
* Find an output joint velocity \a qdot_out, given a starting joint pose
* \a q_init and a desired cartesian velocity \a v_in
*
* @return
* E_NOERROR=solution converged to <eps in maxiter
* E_SVD_FAILED=SVD computation failed
* E_CONVERGE_PINV_SINGULAR=solution converged but (pseudo)inverse is singular
*
* @note if E_CONVERGE_PINV_SINGULAR returned then converged and can
* continue motion, but have degraded solution
*
* @note If E_SVD_FAILED returned, then getSvdResult() returns the error code
* from the SVD algorithm.
*/
virtual int CartToJnt(const JntArray& q_in, const Twist& v_in, JntArray& qdot_out);
/**
* not (yet) implemented.
*
*/
virtual int CartToJnt(const JntArray& q_init, const FrameVel& v_in, JntArrayVel& q_out){return -1;};
/**
* Retrieve the number of singular values of the jacobian that are < eps;
* if the number of near zero singular values is > jac.col()-jac.row(),
* then the jacobian pseudoinverse is singular
*/
unsigned int getNrZeroSigmas()const {return nrZeroSigmas;};
/**
* Retrieve the latest return code from the SVD algorithm
* @return 0 if CartToJnt() not yet called, otherwise latest SVD result code.
*/
int getSVDResult()const {return svdResult;};
/// @copydoc KDL::SolverI::strError()
virtual const char* strError(const int error) const;
private:
const Chain chain;
ChainJntToJacSolver jnt2jac;
Jacobian jac;
SVD_HH svd;
std::vector<JntArray> U;
JntArray S;
std::vector<JntArray> V;
JntArray tmp;
double eps;
int maxiter;
unsigned int nrZeroSigmas;
int svdResult;
};
}
#endif
|