00001 /*************************************************************************** 00002 tag: Erwin Aertbelien Mon Jan 10 16:38:38 CET 2005 velocityprofile_rect.h 00003 00004 velocityprofile_rect.h - description 00005 ------------------- 00006 begin : Mon January 10 2005 00007 copyright : (C) 2005 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 00029 /***************************************************************************** 00030 * \author 00031 * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven 00032 * 00033 * \version 00034 * ORO_Geometry V0.2 00035 * 00036 * \par History 00037 * - $log$ 00038 * 00039 * \par Release 00040 * $Id: velocityprofile_rect.h,v 1.1.1.1.2.4 2003/07/24 13:26:15 psoetens Exp $ 00041 * $Name: $ 00042 ****************************************************************************/ 00043 00044 #ifndef MOTIONPROFILE_RECT_H 00045 #define MOTIONPROFILE_RECT_H 00046 00047 #include "velocityprofile.hpp" 00048 00049 00050 namespace KDL { 00056 class VelocityProfile_Rectangular : public VelocityProfile 00057 // Defines a rectangular velocityprofile. 00058 // (i.e. constant velocity) 00059 { 00060 double d,p,v; 00061 public: 00062 double maxvel; 00063 00064 VelocityProfile_Rectangular(double _maxvel=0): 00065 maxvel(_maxvel) {} 00066 // constructs motion profile class with <maxvel> as parameter of the 00067 // trajectory. 00068 00069 void SetMax( double _maxvel ); 00070 void SetProfile(double pos1,double pos2); 00071 virtual void SetProfileDuration( 00072 double pos1,double pos2,double duration); 00073 virtual double Duration() const; 00074 virtual double Pos(double time) const; 00075 virtual double Vel(double time) const; 00076 virtual double Acc(double time) const; 00077 virtual void Write(std::ostream& os) const; 00078 virtual VelocityProfile* Clone() const{ 00079 VelocityProfile_Rectangular* res = new VelocityProfile_Rectangular(maxvel); 00080 res->SetProfileDuration( p, p+v*d, d ); 00081 return res; 00082 } 00083 // returns copy of current VelocityProfile object. (virtual constructor) 00084 virtual ~VelocityProfile_Rectangular() {} 00085 }; 00086 00087 } 00088 00089 00090 #endif