| 1 | // Copyright (C) 2009 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>cxx . . $ `<file>/orocos_kdl/src/chainidsolver_recursive_newton_euler.hpp`/ |
| 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_IKSOLVER_RECURSIVE_NEWTON_EULER_HPP |
| 23 | #define KDL_CHAIN_IKSOLVER_RECURSIVE_NEWTON_EULER_HPPcxx . . $ `orocos_kdl/src/chainidsolver_recursive_newton_euler.hpp:23:9`! |
| 24 | |
| 25 | #include "chainidsolver.hpp"cxx . . $ `<file>/orocos_kdl/src/chainidsolver.hpp`/ |
| 26 | |
| 27 | namespace KDLcxx . . $ KDL/{ |
| 28 | /** |
| 29 | * \brief Recursive newton euler inverse dynamics solver |
| 30 | * |
| 31 | * The algorithm implementation is based on the book "Rigid Body |
| 32 | * Dynamics Algorithms" of Roy Featherstone, 2008 |
| 33 | * (ISBN:978-0-387-74314-1) See page 96 for the pseudo-code. |
| 34 | * |
| 35 | * It calculates the torques for the joints, given the motion of |
| 36 | * the joints (q,qdot,qdotdot), external forces on the segments |
| 37 | * (expressed in the segments reference frame) and the dynamical |
| 38 | * parameters of the segments. |
| 39 | */ |
| 40 | class ChainIdSolver_RNEcxx . . $ KDL/ChainIdSolver_RNE# : public ChainIdSolvercxx . . $ KDL/ChainIdSolver#{ |
| 41 | public: |
| 42 | /** |
| 43 | * Constructor for the solver, it will allocate all the necessary memory |
| 44 | * \param chain The kinematic chain to calculate the inverse dynamics for, an internal copy will be made. |
| 45 | * \param grav The gravity vector to use during the calculation. |
| 46 | */ |
| 47 | ChainIdSolver_RNEcxx . . $ KDL/ChainIdSolver_RNE#ChainIdSolver_RNE(e0e787c933b84241).(const Chaincxx . . $ KDL/Chain#& chain,Vectorcxx . . $ KDL/Vector# grav); |
| 48 | ~cxx . . $ KDL/ChainIdSolver_RNE#`~ChainIdSolver_RNE`(ced63f7c635d850d).ChainIdSolver_RNEcxx . . $ KDL/ChainIdSolver_RNE#(){}; |
| 49 | |
| 50 | /** |
| 51 | * Function to calculate from Cartesian forces to joint torques. |
| 52 | * Input parameters; |
| 53 | * \param q The current joint positions |
| 54 | * \param q_dot The current joint velocities |
| 55 | * \param q_dotdot The current joint accelerations |
| 56 | * \param f_ext The external forces (no gravity) on the segments |
| 57 | * Output parameters: |
| 58 | * \param torques the resulting torques for the joints |
| 59 | */ |
| 60 | int CartToJntcxx . . $ KDL/ChainIdSolver_RNE#CartToJnt(82414e73a13f645f).(const JntArraycxx . . $ KDL/JntArray# &q, const JntArraycxx . . $ KDL/JntArray# &q_dot, const JntArraycxx . . $ KDL/JntArray# &q_dotdot, const Wrenchescxx . . $ KDL/Wrenches#& f_ext,JntArraycxx . . $ KDL/JntArray# &torques); |
| 61 | |
| 62 | /// @copydoc KDL::SolverI::updateInternalDataStructures |
| 63 | virtual void updateInternalDataStructurescxx . . $ KDL/ChainIdSolver_RNE#updateInternalDataStructures(49f6e7a06ebc5aa8).(); |
| 64 | |
| 65 | private: |
| 66 | const Chaincxx . . $ KDL/Chain#& chaincxx . . $ KDL/ChainIdSolver_RNE#chain.; |
| 67 | unsigned int njcxx . . $ KDL/ChainIdSolver_RNE#nj.; |
| 68 | unsigned int nscxx . . $ KDL/ChainIdSolver_RNE#ns.; |
| 69 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Framecxx . . $ KDL/Frame#> Xcxx . . $ KDL/ChainIdSolver_RNE#X.; |
| 70 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Twistcxx . . $ KDL/Twist#> Scxx . . $ KDL/ChainIdSolver_RNE#S.; |
| 71 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Twistcxx . . $ KDL/Twist#> vcxx . . $ KDL/ChainIdSolver_RNE#v.; |
| 72 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Twistcxx . . $ KDL/Twist#> acxx . . $ KDL/ChainIdSolver_RNE#a.; |
| 73 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Wrenchcxx . . $ KDL/Wrench#> fcxx . . $ KDL/ChainIdSolver_RNE#f.; |
| 74 | Twistcxx . . $ KDL/Twist# agcxx . . $ KDL/ChainIdSolver_RNE#ag.; |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | #endif |