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 Path* Trajectory_Segment::GetPath()
00063 {
00064     return geom;
00065 }
00066 
00067 VelocityProfile* Trajectory_Segment::GetProfile()
00068 {
00069     return motprof;
00070 }
00071 
00072 double Trajectory_Segment::Duration() const
00073 {
00074         return motprof->Duration();
00075 }
00076 
00077 Frame Trajectory_Segment::Pos(double time) const
00078 {
00079         return geom->Pos(motprof->Pos(time));
00080 }
00081 
00082 Twist Trajectory_Segment::Vel(double time) const
00083 {
00084         return geom->Vel(motprof->Pos(time),motprof->Vel(time));
00085 }
00086 
00087 Twist Trajectory_Segment::Acc(double time) const
00088 {
00089         return geom->Acc(motprof->Pos(time),motprof->Vel(time),motprof->Acc(time));
00090 }
00091 
00092 
00093 void Trajectory_Segment::Write(std::ostream& os) const
00094 {
00095         os << "SEGMENT[ " << std::endl;
00096         os << "  ";geom->Write(os);os << std::endl;
00097         os << "  ";motprof->Write(os);os << std::endl;
00098         os << "]";
00099 }
00100 
00101 Trajectory_Segment::~Trajectory_Segment()
00102 {
00103     if (aggregate)
00104         {
00105             delete motprof;
00106             delete geom;
00107         }
00108 }
00109 
00110 }

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