velocityprofile_dirac.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon May 10 19:10:36 CEST 2004 velocityprofile_dirac.cxx
3 
4  velocityprofile_dirac.cxx - description
5  -------------------
6  begin : Mon May 10 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
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 #include "utilities/error.h"
30 
31 namespace KDL {
32 
33 
35  double pos1,
36  double pos2
37  )
38  {
39  p1 = pos1;
40  p2 = pos2;
41  t = 0;
42  }
43 
45  SetProfileDuration(double pos1,double pos2,double duration)
46  {
47  SetProfile(pos1,pos2);
48  t = duration;
49  }
50 
52  return t;
53  }
54 
55  double VelocityProfile_Dirac::Pos(double time) const {
56  if ( t == 0 ) {
57  return time <= 0 ? p1 : p2;
58  } else if (time < 0) {
59  return p1;
60  } else if (time <= t) {
61  return p1 + (( p2 - p1)/t)*time;
62  } else {
63  return p2;
64  }
65  }
66 
67  double VelocityProfile_Dirac::Vel(double time) const {
68  if ( t == 0 )
69  {
71  }
72  else
73  if ( 0 < time && time < t )
74  return (p2-p1) / t;
75  return 0;
76  }
77 
78  double VelocityProfile_Dirac::Acc(double time) const {
80  return 0;
81  }
82 
83 
84  void VelocityProfile_Dirac::Write(std::ostream& os) const {
85  os << "DIRACVEL[ ]";
86  }
87 
88 
89 
90 }
91 
virtual void Write(std::ostream &os) const
virtual double Duration() const
void SetProfile(double pos1, double pos2)
virtual double Vel(double time) const
virtual double Pos(double time) const
virtual double Acc(double time) const
virtual void SetProfileDuration(double pos1, double pos2, double duration)


orocos_kdl
Author(s):
autogenerated on Thu Apr 13 2023 02:19:14