Robot/App/kdl_cp/Segment.cpp

Go to the documentation of this file.
00001 // Version: 1.0
00002 // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
00003 // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
00004 // URL: http://www.orocos.org/kdl
00005 
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019 
00020 #include "segment.hpp"
00021 
00022 namespace KDL {
00023 
00024     Segment::Segment(const std::string& _name, const Joint& _joint, const Frame& _f_tip, const RigidBodyInertia& _I):
00025         name(_name),
00026         joint(_joint),I(_I),
00027         f_tip(_joint.pose(0).Inverse() * _f_tip)
00028     {
00029     }
00030 
00031     Segment::Segment(const Joint& _joint, const Frame& _f_tip, const RigidBodyInertia& _I):
00032         name("NoName"),
00033         joint(_joint),I(_I),
00034         f_tip(_joint.pose(0).Inverse() * _f_tip)
00035     {
00036     }
00037 
00038     Segment::Segment(const Segment& in):
00039         name(in.name),joint(in.joint),I(in.I),
00040         f_tip(in.f_tip)
00041     {
00042     }
00043 
00044     Segment& Segment::operator=(const Segment& arg)
00045     {
00046         name=arg.name;
00047         joint=arg.joint;
00048         I=arg.I;
00049         f_tip=arg.f_tip;
00050         return *this;
00051     }
00052 
00053     Segment::~Segment()
00054     {
00055     }
00056 
00057     Frame Segment::pose(const double& q)const
00058     {
00059         return joint.pose(q)*f_tip;
00060     }
00061 
00062     Twist Segment::twist(const double& q, const double& qdot)const
00063     {
00064         return joint.twist(qdot).RefPoint(joint.pose(q).M * f_tip.p);
00065     }
00066 
00067 }//end of namespace KDL
00068 

Generated on Wed Nov 23 19:00:37 2011 for FreeCAD by  doxygen 1.6.1