trajectory_segment.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Erwin Aertbelien  Mon May 10 19:10:36 CEST 2004  trajectory_segment.cxx
00003 
00004                         trajectory_segment.cxx -  description
00005                            -------------------
00006     begin                : Mon May 10 2004
00007     copyright            : (C) 2004 Erwin Aertbelien
00008     email                : erwin.aertbelien@mech.kuleuven.ac.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place,                                    *
00024  *   Suite 330, Boston, MA  02111-1307  USA                                *
00025  *                                                                         *
00026  ***************************************************************************/
00027 /*****************************************************************************
00028  *  \author
00029  *      Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven
00030  *
00031  *  \version
00032  *              ORO_Geometry V0.2
00033  *
00034  *      \par History
00035  *              - $log$
00036  *
00037  *      \par Release
00038  *              $Id: trajectory_segment.cpp,v 1.1.1.1.2.7 2003/07/23 16:44:26 psoetens Exp $
00039  *              $Name:  $
00040  ****************************************************************************/
00041 
00042 
00043 #include "trajectory_segment.hpp"
00044 
00045 
00046 namespace KDL {
00047 
00048 
00049 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, bool _aggregate):
00050         motprof(_motprof),geom(_geom), aggregate(_aggregate)
00051 {
00052     // assume everything is set or at least check if Duration() != 0
00053 }
00054 
00055 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, double _duration, bool _aggregate):
00056         motprof(_motprof),geom(_geom), aggregate(_aggregate)
00057 {
00058     // the duration was specified so assume motprof not yet set.
00059     motprof->SetProfileDuration(0, geom->PathLength(), _duration);
00060 }
00061 
00062 
00063 double Trajectory_Segment::Duration() const
00064 {
00065         return motprof->Duration();
00066 }
00067 
00068 Frame Trajectory_Segment::Pos(double time) const
00069 {
00070         return geom->Pos(motprof->Pos(time));
00071 }
00072 
00073 Twist Trajectory_Segment::Vel(double time) const
00074 {
00075         return geom->Vel(motprof->Pos(time),motprof->Vel(time));
00076 }
00077 
00078 Twist Trajectory_Segment::Acc(double time) const
00079 {
00080         return geom->Acc(motprof->Pos(time),motprof->Vel(time),motprof->Acc(time));
00081 }
00082 
00083 
00084 void Trajectory_Segment::Write(std::ostream& os) const
00085 {
00086         os << "SEGMENT[ " << std::endl;
00087         os << "  ";geom->Write(os);os << std::endl;
00088         os << "  ";motprof->Write(os);os << std::endl;
00089         os << "]";
00090 }
00091 
00092 Trajectory_Segment::~Trajectory_Segment()
00093 {
00094     if (aggregate)
00095         {
00096             delete motprof;
00097             delete geom;
00098         }
00099 }
00100 Path* Trajectory_Segment::GetPath() {
00101         return geom;
00102 }
00103 
00104 VelocityProfile* Trajectory_Segment::GetProfile() {
00105         return motprof;
00106 }
00107 
00108 
00109 }


orocos_kdl
Author(s): Ruben Smits, Erwin Aertbelien, Orocos Developers
autogenerated on Sat Dec 28 2013 17:17:25