| 1 | /*************************************************************************** |
| 2 | tag: Erwin Aertbelien Mon Jan 10 16:38:38 CET 2005 velocityprofile_traphalf.h |
| 3 | |
| 4 | velocityprofile_traphalf.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_traphalf.h,v 1.1.1.1.2.4 2003/07/24 13:26:15 psoetens Exp $ |
| 41 | * $Name: $ |
| 42 | * \par Status |
| 43 | * Experimental |
| 44 | ****************************************************************************/ |
| 45 | |
| 46 | #ifndef KDL_MOTION_VELOCITYPROFILE_TRAPHALF_H |
| 47 | #define KDL_MOTION_VELOCITYPROFILE_TRAPHALF_Hcxx . . $ `orocos_kdl/src/velocityprofile_traphalf.hpp:47:9`! |
| 48 | |
| 49 | #include "velocityprofile.hpp"cxx . . $ `<file>/orocos_kdl/src/velocityprofile.hpp`/ |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | namespace KDLcxx . . $ KDL/ { |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * A 'Half' Trapezoidal VelocityProfile. A constructor flag |
| 59 | * indicates if the calculated profile should be starting |
| 60 | * or ending. |
| 61 | * @ingroup Motion |
| 62 | */ |
| 63 | class VelocityProfile_TrapHalfcxx . . $ KDL/VelocityProfile_TrapHalf# : public VelocityProfilecxx . . $ KDL/VelocityProfile# |
| 64 | { |
| 65 | // For "running" a motion profile : |
| 66 | double a1cxx . . $ KDL/VelocityProfile_TrapHalf#a1.,a2cxx . . $ KDL/VelocityProfile_TrapHalf#a2.,a3cxx . . $ KDL/VelocityProfile_TrapHalf#a3.; // coef. from ^0 -> ^2 of first part |
| 67 | double b1cxx . . $ KDL/VelocityProfile_TrapHalf#b1.,b2cxx . . $ KDL/VelocityProfile_TrapHalf#b2.,b3cxx . . $ KDL/VelocityProfile_TrapHalf#b3.; // of 2nd part |
| 68 | double c1cxx . . $ KDL/VelocityProfile_TrapHalf#c1.,c2cxx . . $ KDL/VelocityProfile_TrapHalf#c2.,c3cxx . . $ KDL/VelocityProfile_TrapHalf#c3.; // of 3rd part |
| 69 | double durationcxx . . $ KDL/VelocityProfile_TrapHalf#duration.; |
| 70 | double t1cxx . . $ KDL/VelocityProfile_TrapHalf#t1.,t2cxx . . $ KDL/VelocityProfile_TrapHalf#t2.; |
| 71 | |
| 72 | double startposcxx . . $ KDL/VelocityProfile_TrapHalf#startpos.; |
| 73 | double endposcxx . . $ KDL/VelocityProfile_TrapHalf#endpos.; |
| 74 | |
| 75 | // Persistent state : |
| 76 | double maxvelcxx . . $ KDL/VelocityProfile_TrapHalf#maxvel.; |
| 77 | double maxacccxx . . $ KDL/VelocityProfile_TrapHalf#maxacc.; |
| 78 | bool startingcxx . . $ KDL/VelocityProfile_TrapHalf#starting.; |
| 79 | |
| 80 | void PlanProfile1cxx . . $ KDL/VelocityProfile_TrapHalf#PlanProfile1(bc12c9ec15586e6a).(double v,double a); |
| 81 | void PlanProfile2cxx . . $ KDL/VelocityProfile_TrapHalf#PlanProfile2(bc12c9ec15586e6a).(double v,double a); |
| 82 | public: |
| 83 | |
| 84 | /** |
| 85 | * \param maxvel maximal velocity of the motion profile (positive) |
| 86 | * \param maxacc maximal acceleration of the motion profile (positive) |
| 87 | * \param starting this value is true when initial velocity is zero |
| 88 | * and ending velocity is maxvel, is false for the reverse |
| 89 | */ |
| 90 | VelocityProfile_TrapHalfcxx . . $ KDL/VelocityProfile_TrapHalf#VelocityProfile_TrapHalf(182e02013ed1ed11).(double _maxvel=0,double _maxacc=0,bool _starting=true); |
| 91 | |
| 92 | void SetMaxcxx . . $ KDL/VelocityProfile_TrapHalf#SetMax(182e02013ed1ed11).(double _maxvel,double _maxacc,bool _starting); |
| 93 | |
| 94 | /** |
| 95 | * Plans a 'Half' Trapezoidal VelocityProfile between pos1 and pos2. |
| 96 | * If the distance is too short between pos1 and pos2, |
| 97 | * only the acceleration phase is set and the max velocity is not reached. |
| 98 | * |
| 99 | * \param pos1 Starting position |
| 100 | * \param pos2 Ending position |
| 101 | * |
| 102 | * Can throw a Error_MotionPlanning_Not_Feasible |
| 103 | */ |
| 104 | virtual void SetProfilecxx . . $ KDL/VelocityProfile_TrapHalf#SetProfile(bc12c9ec15586e6a).(double pos1,double pos2); |
| 105 | |
| 106 | /** |
| 107 | * Can be used to prolong the profile, there are two possible outcomes: in a first |
| 108 | * phase the acceleration is lowered as such that the end position and maximum velocity |
| 109 | * are reached at the given duration (newduration). In this case there is an acceleration part and a constant velocity part, |
| 110 | * when this reaches a minimum acceleration value at which the constant part disappears, the motion is stalled, |
| 111 | * in this case their is a non-motion part and an acceleration part. |
| 112 | * |
| 113 | *\param pos1 starting position |
| 114 | *\param pos2 ending position |
| 115 | *\param newduration the desired duration, if it is lower than the minimum duration, the minimum duration will be used instead of the given duration. |
| 116 | */ |
| 117 | virtual void SetProfileDurationcxx . . $ KDL/VelocityProfile_TrapHalf#SetProfileDuration(98dd472ac7e5c3d4).( |
| 118 | double pos1,double pos2,double newduration |
| 119 | ); |
| 120 | |
| 121 | virtual double Durationcxx . . $ KDL/VelocityProfile_TrapHalf#Duration(21b6c25e127938e2).() const; |
| 122 | virtual double Poscxx . . $ KDL/VelocityProfile_TrapHalf#Pos(7e3a3c6b59947c6d).(double time) const; |
| 123 | virtual double Velcxx . . $ KDL/VelocityProfile_TrapHalf#Vel(7e3a3c6b59947c6d).(double time) const; |
| 124 | virtual double Acccxx . . $ KDL/VelocityProfile_TrapHalf#Acc(7e3a3c6b59947c6d).(double time) const; |
| 125 | virtual void Writecxx . . $ KDL/VelocityProfile_TrapHalf#Write(490063bd7e6d8d5d).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) const; |
| 126 | virtual VelocityProfilecxx . . $ KDL/VelocityProfile#* Clonecxx . . $ KDL/VelocityProfile_TrapHalf#Clone(2d6fabc53dd14ca3).() const; |
| 127 | |
| 128 | virtual ~cxx . . $ KDL/VelocityProfile_TrapHalf#`~VelocityProfile_TrapHalf`(ced63f7c635d850d).VelocityProfile_TrapHalfcxx . . $ KDL/VelocityProfile_TrapHalf#(); |
| 129 | }; |
| 130 | |
| 131 | |
| 132 | |
| 133 | } |
| 134 | |
| 135 | |
| 136 | #endif |