00001 // Copyright (C) 2009 Ruben Smits <ruben dot smits at mech dot kuleuven dot be> 00002 00003 // Version: 1.0 00004 // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> 00005 // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> 00006 // URL: http://www.orocos.org/kdl 00007 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Lesser General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2.1 of the License, or (at your option) any later version. 00012 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Lesser General Public License for more details. 00017 00018 // You should have received a copy of the GNU Lesser General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 00022 #pragma once 00023 00024 #include "treeidsolver.hpp" 00025 00026 namespace KDL{ 00039 class TreeIdSolver_RNE : public TreeIdSolver{ 00040 public: 00046 TreeIdSolver_RNE(const Tree& tree,Vector grav); 00047 ~TreeIdSolver_RNE(){}; 00048 00059 int CartToJnt(const JntArray &q, const JntArray &q_dot, const JntArray &q_dotdot, const Wrenches& f_ext,JntArray &torques); 00060 int CartToJnt(const std::vector<double> &q, const std::vector<double> &q_dot, const std::vector<double> &q_dotdot, const Wrenches& f_ext,JntArray &torques); 00061 00062 00063 private: 00064 struct Entry{ 00065 Frame X; 00066 Twist S; 00067 Twist v; 00068 Twist a; 00069 Wrench f; 00070 Wrench f_ext; 00071 }; 00072 struct JntEntry{ 00073 int idx; 00074 double torque; 00075 }; 00076 00077 00078 00079 00080 Tree tree; 00081 std::string root_name; 00082 //std::map<std::string, Frame> X; 00083 //std::map<std::string, Twist> S; 00084 //std::map<std::string, Twist> v; 00085 //std::map<std::string, Twist> a; 00086 //std::map<std::string, Wrench> f; 00087 //std::map<std::string, Wrench> f_ext_map; 00088 //much faster not to have to look up each individual element 00089 //better to group the variables together and only have one lookup 00090 //before was nearly 25% to look up each individually 00091 std::map<std::string, Entry> db; 00092 std::map<std::string, JntEntry> jntdb; 00093 00094 //std::map<std::string, double> torque_map; /// takes in joint names 00095 //std::map<std::string, int> name2idx; 00096 Twist ag; 00097 }; 00098 }