| 1 | /*************************************************************************** |
| 2 | tag: Erwin Aertbelien Mon Jan 10 16:38:38 CET 2005 velocityprofile_trap.h |
| 3 | |
| 4 | velocityprofile_trap.h - description |
| 5 | ------------------- |
| 6 | begin : Mon January 10 2005 |
| 7 | copyright : (C) 2005 Erwin Aertbelien |
| 8 | email : [email protected] |
| 9 | |
| 10 | *************************************************************************** |
| 11 | * This library is free software; you can redistribute it and/or * |
| 12 | * modify it under the terms of the GNU Lesser General Public * |
| 13 | * License as published by the Free Software Foundation; either * |
| 14 | * version 2.1 of the License, or (at your option) any later version. * |
| 15 | * * |
| 16 | * This library is distributed in the hope that it will be useful, * |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 19 | * Lesser General Public License for more details. * |
| 20 | * * |
| 21 | * You should have received a copy of the GNU Lesser General Public * |
| 22 | * License along with this library; if not, write to the Free Software * |
| 23 | * Foundation, Inc., 59 Temple Place, * |
| 24 | * Suite 330, Boston, MA 02111-1307 USA * |
| 25 | * * |
| 26 | ***************************************************************************/ |
| 27 | |
| 28 | |
| 29 | /***************************************************************************** |
| 30 | * \author |
| 31 | * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven |
| 32 | * |
| 33 | * \version |
| 34 | * ORO_Geometry V0.2 |
| 35 | * |
| 36 | * \par History |
| 37 | * - $log$ |
| 38 | * |
| 39 | * \par Release |
| 40 | * $Id: velocityprofile_trap.h,v 1.1.1.1.2.5 2003/07/24 13:26:15 psoetens Exp $ |
| 41 | * $Name: $ |
| 42 | ****************************************************************************/ |
| 43 | |
| 44 | #ifndef KDL_MOTION_VELOCITYPROFILE_TRAP_H |
| 45 | #define KDL_MOTION_VELOCITYPROFILE_TRAP_Hcxx . . $ `orocos_kdl/src/velocityprofile_trap.hpp:45:9`! |
| 46 | |
| 47 | #include "velocityprofile.hpp"cxx . . $ `<file>/orocos_kdl/src/velocityprofile.hpp`/ |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | namespace KDLcxx . . $ KDL/ { |
| 53 | |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * A Trapezoidal VelocityProfile implementation. |
| 58 | * @ingroup Motion |
| 59 | */ |
| 60 | class VelocityProfile_Trapcxx . . $ KDL/VelocityProfile_Trap# : public VelocityProfilecxx . . $ KDL/VelocityProfile# |
| 61 | { |
| 62 | // For "running" a motion profile : |
| 63 | double a1cxx . . $ KDL/VelocityProfile_Trap#a1.,a2cxx . . $ KDL/VelocityProfile_Trap#a2.,a3cxx . . $ KDL/VelocityProfile_Trap#a3.; // coef. from ^0 -> ^2 of first part |
| 64 | double b1cxx . . $ KDL/VelocityProfile_Trap#b1.,b2cxx . . $ KDL/VelocityProfile_Trap#b2.,b3cxx . . $ KDL/VelocityProfile_Trap#b3.; // of 2nd part |
| 65 | double c1cxx . . $ KDL/VelocityProfile_Trap#c1.,c2cxx . . $ KDL/VelocityProfile_Trap#c2.,c3cxx . . $ KDL/VelocityProfile_Trap#c3.; // of 3rd part |
| 66 | double durationcxx . . $ KDL/VelocityProfile_Trap#duration.; |
| 67 | double t1cxx . . $ KDL/VelocityProfile_Trap#t1.,t2cxx . . $ KDL/VelocityProfile_Trap#t2.; |
| 68 | |
| 69 | // specification of the motion profile : |
| 70 | double maxvelcxx . . $ KDL/VelocityProfile_Trap#maxvel.; |
| 71 | double maxacccxx . . $ KDL/VelocityProfile_Trap#maxacc.; |
| 72 | double startposcxx . . $ KDL/VelocityProfile_Trap#startpos.; |
| 73 | double endposcxx . . $ KDL/VelocityProfile_Trap#endpos.; |
| 74 | public: |
| 75 | |
| 76 | VelocityProfile_Trapcxx . . $ KDL/VelocityProfile_Trap#VelocityProfile_Trap(bc12c9ec15586e6a).(double _maxvel=0,double _maxacc=0); |
| 77 | // constructs motion profile class with <maxvel> and <maxacc> as parameters of the |
| 78 | // trajectory. |
| 79 | |
| 80 | virtual void SetProfilecxx . . $ KDL/VelocityProfile_Trap#SetProfile(bc12c9ec15586e6a).(double pos1,double pos2); |
| 81 | |
| 82 | virtual void SetProfileDurationcxx . . $ KDL/VelocityProfile_Trap#SetProfileDuration(98dd472ac7e5c3d4).( |
| 83 | double pos1,double pos2,double newduration |
| 84 | ); |
| 85 | |
| 86 | /** Compute trapezoidal profile at a given fraction of max velocity |
| 87 | @param pos1 Position to start from |
| 88 | @param pos2 Position to end at |
| 89 | @param newvelocity Fraction of max velocity to use during the |
| 90 | non-ramp, flat-velocity part of the profile. |
| 91 | @param KDL::epsilon <= newvelocity <= 1.0 (forcibly clamped to |
| 92 | this range internally) |
| 93 | */ |
| 94 | virtual void SetProfileVelocitycxx . . $ KDL/VelocityProfile_Trap#SetProfileVelocity(98dd472ac7e5c3d4).( |
| 95 | double pos1,double pos2,double newvelocity |
| 96 | ); |
| 97 | |
| 98 | virtual void SetMaxcxx . . $ KDL/VelocityProfile_Trap#SetMax(bc12c9ec15586e6a).(double _maxvel,double _maxacc); |
| 99 | virtual double Durationcxx . . $ KDL/VelocityProfile_Trap#Duration(21b6c25e127938e2).() const; |
| 100 | virtual double Poscxx . . $ KDL/VelocityProfile_Trap#Pos(7e3a3c6b59947c6d).(double time) const; |
| 101 | virtual double Velcxx . . $ KDL/VelocityProfile_Trap#Vel(7e3a3c6b59947c6d).(double time) const; |
| 102 | virtual double Acccxx . . $ KDL/VelocityProfile_Trap#Acc(7e3a3c6b59947c6d).(double time) const; |
| 103 | virtual void Writecxx . . $ KDL/VelocityProfile_Trap#Write(490063bd7e6d8d5d).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) const; |
| 104 | virtual VelocityProfilecxx . . $ KDL/VelocityProfile#* Clonecxx . . $ KDL/VelocityProfile_Trap#Clone(2d6fabc53dd14ca3).() const; |
| 105 | // returns copy of current VelocityProfile object. (virtual constructor) |
| 106 | virtual ~cxx . . $ KDL/VelocityProfile_Trap#`~VelocityProfile_Trap`(ced63f7c635d850d).VelocityProfile_Trapcxx . . $ KDL/VelocityProfile_Trap#(); |
| 107 | }; |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | /* Niet OK |
| 115 | class VelocityProfile_Trap : public VelocityProfile { |
| 116 | double maxvel; |
| 117 | double maxacc; |
| 118 | double _t1,_t2,_T,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10; |
| 119 | |
| 120 | void PrepTraj(double p1,double v1,double p2,double v2, |
| 121 | double acc,double vel,double t1,double t2,double T); |
| 122 | // Internal method. Sets the parameters <_t1>,..<c10> with the given |
| 123 | // arguments. |
| 124 | public: |
| 125 | VelocityProfile_Trap(double _maxvel,double _maxacc): |
| 126 | maxvel(_maxvel),maxacc(_maxacc) {} |
| 127 | // constructs motion profile class with max velocity <maxvel>, |
| 128 | // and max acceleration <maxacc> as parameter of the |
| 129 | // trajectory. |
| 130 | |
| 131 | void SetProfile(double pos1,double pos2); |
| 132 | virtual void SetProfileDuration(double pos1,double pos2,double duration); |
| 133 | virtual double Duration() ; |
| 134 | virtual double Pos(double time); |
| 135 | virtual double Vel(double time); |
| 136 | }; |
| 137 | */ |
| 138 | |
| 139 | } |
| 140 | |
| 141 | |
| 142 | #endif |