Blender V2.61 - r43446

segment.cpp

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