Debian Codegraph @

src/Mod/Robot/App/kdl_cp/chainiksolvervel_pinv_nso.hpp

raw symbols SCIP
1 // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
2
3 // Version: 1.0
4 // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
5 // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
6 // URL: http://www.orocos.org/kdl
7
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
22 #ifndef KDL_CHAIN_IKSOLVERVEL_PINV_NSO_HPP
23 #define KDL_CHAIN_IKSOLVERVEL_PINV_NSO_HPP
24
25 #include "chainiksolver.hpp"
26 #include "chainjnttojacsolver.hpp"
27 #include <Eigen/Core>
28
29 namespace KDL
30 {
31
32 // FIXME: seems this class is unused/unmaintained/unfinished for several years
33 // it supposed to be either fixer or removed
34
35 /**
36 * Implementation of a inverse velocity kinematics algorithm based
37 * on the generalize pseudo inverse to calculate the velocity
38 * transformation from Cartesian to joint space of a general
39 * KDL::Chain. It uses a svd-calculation based on householders
40 * rotations.
41 *
42 * In case of a redundant robot this solver optimizes the following criterium:
43 * g=0.5*sum(weight*(Desired_joint_positions - actual_joint_positions))^2 as described in
44 * A. Liegeois. Automatic supervisory control of the configuration and
45 * behavior of multibody mechanisms. IEEE Transactions on Systems, Man, and
46 * Cybernetics, 7(12):868–871, 1977
47 *
48 * @ingroup KinematicFamily
49 */
50 class ChainIkSolverVel_pinv_nso : public ChainIkSolverVel
51 {
52 public:
53 /**
54 * Constructor of the solver
55 *
56 * @param chain the chain to calculate the inverse velocity
57 * kinematics for
58 * @param opt_pos the desired positions of the chain used by to resolve the redundancy
59 * @param weights the weights applied in the joint space
60 * @param eps if a singular value is below this value, its
61 * inverse is set to zero, default: 0.00001
62 * @param maxiter maximum iterations for the svd calculation,
63 * default: 150
64 * @param alpha the null-space velocity gain
65 *
66 */
67
68 // FIXME: alpha is int but is initialized with a float value.
69 ChainIkSolverVel_pinv_nso(const Chain& chain, JntArray opt_pos, JntArray weights, double eps=0.00001,int maxiter=150, double alpha = 0.25);
70 explicit ChainIkSolverVel_pinv_nso(const Chain& chain, double eps=0.00001,int maxiter=150, double alpha = 0.25);
71 ~ChainIkSolverVel_pinv_nso();
72
73 virtual int CartToJnt(const JntArray& q_in, const Twist& v_in, JntArray& qdot_out);
74 /**
75 * not (yet) implemented.
76 *
77 */
78 virtual int CartToJnt(const JntArray& /*q_init*/, const FrameVel& /*v_in*/, JntArrayVel& /*q_out*/){return -1;};
79
80 /**
81 *Set joint weights for optimization criterion
82 *
83 *@param weights the joint weights
84 *
85 */
86 virtual int setWeights(const JntArray &weights);
87
88 /**
89 *Set optimal joint positions
90 *
91 *@param opt_pos optimal joint positions
92 *
93 */
94 virtual int setOptPos(const JntArray &opt_pos);
95
96 /**
97 *Set null space velocity gain
98 *
99 *@param alpha NUllspace velocity cgain
100 *
101 */
102 virtual int setAlpha(const double alpha);
103
104 private:
105 const Chain chain;
106 ChainJntToJacSolver jnt2jac;
107 unsigned int nj;
108 Jacobian jac;
109 Eigen::MatrixXd U;
110 Eigen::VectorXd S;
111 Eigen::VectorXd Sinv;
112 Eigen::MatrixXd V;
113 Eigen::VectorXd tmp;
114 Eigen::VectorXd tmp2;
115 double eps;
116 int maxiter;
117
118 double alpha;
119 JntArray weights;
120 JntArray opt_pos;
121 };
122 }
123 #endif
124