trajectory_segment.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Erwin Aertbelien Mon May 10 19:10:36 CEST 2004 trajectory_segment.cxx
3 
4  trajectory_segment.cxx - description
5  -------------------
6  begin : Mon May 10 2004
7  copyright : (C) 2004 Erwin Aertbelien
8  email : erwin.aertbelien@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  * \author
29  * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven
30  *
31  * \version
32  * ORO_Geometry V0.2
33  *
34  * \par History
35  * - $log$
36  *
37  * \par Release
38  * $Id: trajectory_segment.cpp,v 1.1.1.1.2.7 2003/07/23 16:44:26 psoetens Exp $
39  * $Name: $
40  ****************************************************************************/
41 
42 
43 #include "trajectory_segment.hpp"
44 
45 
46 namespace KDL {
47 
48 
49 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, bool _aggregate):
50  motprof(_motprof),geom(_geom), aggregate(_aggregate)
51 {
52  // assume everything is set or at least check if Duration() != 0
53 }
54 
55 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, double _duration, bool _aggregate):
56  motprof(_motprof),geom(_geom), aggregate(_aggregate)
57 {
58  // the duration was specified so assume motprof not yet set.
59  motprof->SetProfileDuration(0, geom->PathLength(), _duration);
60 }
61 
62 
64 {
65  return motprof->Duration();
66 }
67 
68 Frame Trajectory_Segment::Pos(double time) const
69 {
70  return geom->Pos(motprof->Pos(time));
71 }
72 
73 Twist Trajectory_Segment::Vel(double time) const
74 {
75  return geom->Vel(motprof->Pos(time),motprof->Vel(time));
76 }
77 
78 Twist Trajectory_Segment::Acc(double time) const
79 {
80  return geom->Acc(motprof->Pos(time),motprof->Vel(time),motprof->Acc(time));
81 }
82 
83 
84 void Trajectory_Segment::Write(std::ostream& os) const
85 {
86  os << "SEGMENT[ " << std::endl;
87  os << " ";geom->Write(os);os << std::endl;
88  os << " ";motprof->Write(os);os << std::endl;
89  os << "]";
90 }
91 
93 {
94  if (aggregate)
95  {
96  delete motprof;
97  delete geom;
98  }
99 }
101  return geom;
102 }
103 
105  return motprof;
106 }
107 
108 
109 }
virtual Frame Pos(double time) const
virtual void Write(std::ostream &os) const =0
virtual double Duration() const
virtual double Pos(double time) const =0
virtual VelocityProfile * GetProfile()
virtual Twist Acc(double s, double sd, double sdd) const =0
virtual Frame Pos(double s) const =0
virtual void SetProfileDuration(double pos1, double pos2, double duration)=0
represents both translational and rotational velocities.
Definition: frames.hpp:720
virtual Twist Vel(double s, double sd) const =0
virtual Twist Vel(double time) const
Trajectory_Segment(Path *_geom, VelocityProfile *_motprof, bool _aggregate=true)
virtual void Write(std::ostream &os)=0
virtual double Acc(double time) const =0
virtual double Duration() const =0
virtual double Vel(double time) const =0
represents a frame transformation in 3D space (rotation + translation)
Definition: frames.hpp:570
virtual double PathLength()=0
virtual void Write(std::ostream &os) const
virtual Twist Acc(double time) const


orocos_kdl
Author(s):
autogenerated on Sat Jun 15 2019 19:07:36