00001 // Copyright (C) 2007 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 00023 #ifndef KDL_SEGMENT_HPP 00024 #define KDL_SEGMENT_HPP 00025 00026 #include "frames.hpp" 00027 #include "rigidbodyinertia.hpp" 00028 #include "joint.hpp" 00029 #include <vector> 00030 00031 namespace KDL { 00032 00046 class Segment { 00047 friend class Chain; 00048 private: 00049 std::string name; 00050 Joint joint; 00051 RigidBodyInertia I; 00052 Frame f_tip; 00053 00054 public: 00065 explicit Segment(const std::string& name, const Joint& joint=Joint(Joint::None), const Frame& f_tip=Frame::Identity(),const RigidBodyInertia& I = RigidBodyInertia::Zero()); 00075 explicit Segment(const Joint& joint=Joint(Joint::None), const Frame& f_tip=Frame::Identity(),const RigidBodyInertia& I = RigidBodyInertia::Zero()); 00076 Segment(const Segment& in); 00077 Segment& operator=(const Segment& arg); 00078 00079 virtual ~Segment(); 00080 00088 Frame pose(const double& q)const; 00100 Twist twist(const double& q,const double& qdot)const; 00101 00108 const std::string& getName()const 00109 { 00110 return name; 00111 } 00118 const Joint& getJoint()const 00119 { 00120 return joint; 00121 } 00128 const RigidBodyInertia& getInertia()const 00129 { 00130 return I; 00131 } 00138 void setInertia(const RigidBodyInertia& Iin) 00139 { 00140 this->I=Iin; 00141 } 00142 00149 Frame getFrameToTip()const 00150 { 00151 00152 return joint.pose(0)*f_tip; 00153 } 00154 00155 }; 00156 }//end of namespace KDL 00157 00158 #endif