| 1 | // Copyright (C) 2007-2008 Ruben Smits <ruben dot smits at mech dot kuleuven dot be> |
| 2 | // Copyright (C) 2008 Mikael Mayer |
| 3 | // Copyright (C) 2008 Julia Jesse |
| 4 | |
| 5 | // Version: 1.0 |
| 6 | // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> |
| 7 | // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> |
| 8 | // URL: http://www.orocos.org/kdl |
| 9 | |
| 10 | // This library is free software; you can redistribute it and/or |
| 11 | // modify it under the terms of the GNU Lesser General Public |
| 12 | // License as published by the Free Software Foundation; either |
| 13 | // version 2.1 of the License, or (at your option) any later version. |
| 14 | |
| 15 | // This library is distributed in the hope that it will be useful, |
| 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | // Lesser General Public License for more details. |
| 19 | |
| 20 | // You should have received a copy of the GNU Lesser General Public |
| 21 | // License along with this library; if not, write to the Free Software |
| 22 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 | |
| 24 | #ifndef KDLCHAINIKSOLVERPOS_NR_JL_HPP |
| 25 | #define KDLCHAINIKSOLVERPOS_NR_JL_HPP |
| 26 | |
| 27 | #include "chainiksolver.hpp" |
| 28 | #include "chainfksolver.hpp" |
| 29 | |
| 30 | namespace KDL { |
| 31 | |
| 32 | /** |
| 33 | * Implementation of a general inverse position kinematics |
| 34 | * algorithm based on Newton-Raphson iterations to calculate the |
| 35 | * position transformation from Cartesian to joint space of a general |
| 36 | * KDL::Chain. Takes joint limits into account. |
| 37 | * |
| 38 | * @ingroup KinematicFamily |
| 39 | */ |
| 40 | class ChainIkSolverPos_NR_JL : public ChainIkSolverPos |
| 41 | { |
| 42 | public: |
| 43 | /** |
| 44 | * Constructor of the solver, it needs the chain, a forward |
| 45 | * position kinematics solver and an inverse velocity |
| 46 | * kinematics solver for that chain. |
| 47 | * |
| 48 | * @param chain the chain to calculate the inverse position for |
| 49 | * @param q_min the minimum joint positions |
| 50 | * @param q_max the maximum joint positions |
| 51 | * @param fksolver a forward position kinematics solver |
| 52 | * @param iksolver an inverse velocity kinematics solver |
| 53 | * @param maxiter the maximum Newton-Raphson iterations, |
| 54 | * default: 100 |
| 55 | * @param eps the precision for the position, used to end the |
| 56 | * iterations, default: epsilon (defined in kdl.hpp) |
| 57 | * |
| 58 | * @return |
| 59 | */ |
| 60 | ChainIkSolverPos_NR_JL(const Chain& chain,const JntArray& q_min, const JntArray& q_max, ChainFkSolverPos& fksolver,ChainIkSolverVel& iksolver,unsigned int maxiter=100,double eps=1e-6); |
| 61 | ~ChainIkSolverPos_NR_JL(); |
| 62 | |
| 63 | virtual int CartToJnt(const JntArray& q_init, const Frame& p_in, JntArray& q_out); |
| 64 | |
| 65 | private: |
| 66 | const Chain chain; |
| 67 | JntArray q_min; |
| 68 | JntArray q_max; |
| 69 | ChainIkSolverVel& iksolver; |
| 70 | ChainFkSolverPos& fksolver; |
| 71 | JntArray delta_q; |
| 72 | unsigned int maxiter; |
| 73 | double eps; |
| 74 | |
| 75 | Frame f; |
| 76 | Twist delta_twist; |
| 77 | |
| 78 | }; |
| 79 | |
| 80 | } |
| 81 | |
| 82 | #endif |