velocityprofile.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Erwin Aertbelien  Mon May 10 19:10:36 CEST 2004  velocityprofile.cxx
00003 
00004                         velocityprofile.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: velocityprofile.cpp,v 1.1.1.1.2.3 2003/02/24 13:13:06 psoetens Exp $
00039  *              $Name:  $
00040  ****************************************************************************/
00041 
00042 
00043 #include "utilities/error.h"
00044 #include "utilities/error_stack.h"
00045 #include "velocityprofile_rect.hpp"
00046 #include "velocityprofile_dirac.hpp"
00047 #include "velocityprofile_trap.hpp"
00048 #include "velocityprofile_traphalf.hpp"
00049 #include <string.h>
00050 
00051 namespace KDL {
00052 
00053 using namespace std;
00054 
00055 VelocityProfile* VelocityProfile::Read(istream& is) {
00056         IOTrace("VelocityProfile::Read");
00057         char storage[25];
00058         EatWord(is,"[",storage,sizeof(storage));
00059         Eat(is,'[');
00060         if (strcmp(storage,"DIRACVEL")==0) {
00061                 Eat(is,']');
00062                 IOTracePop();
00063                 return new VelocityProfile_Dirac();
00064         } else if (strcmp(storage,"CONSTVEL")==0) {
00065                 double vel;
00066                 is >> vel;
00067                 Eat(is,']');
00068                 IOTracePop();
00069                 return new VelocityProfile_Rectangular(vel);
00070         } else if (strcmp(storage,"TRAPEZOIDAL")==0) {
00071                 double maxvel;
00072                 double maxacc;
00073                 is >> maxvel;
00074                 Eat(is,',');
00075                 is >> maxacc;
00076                 Eat(is,']');
00077                 IOTracePop();
00078                 return new VelocityProfile_Trap(maxvel,maxacc);
00079         } else if (strcmp(storage,"TRAPEZOIDALHALF")==0) {
00080                 double maxvel;
00081                 double maxacc;
00082                 is >> maxvel;
00083                 Eat(is,',');
00084                 is >> maxacc;
00085                 Eat(is,',');
00086                 bool starting;
00087                 is >> starting;
00088                 Eat(is,']');
00089                 IOTracePop();
00090                 return new VelocityProfile_TrapHalf(maxvel,maxacc,starting);
00091         }
00092         else {
00093                 throw Error_MotionIO_Unexpected_MotProf();
00094         }
00095     return 0;
00096 }
00097 
00098 
00099 
00100 }


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