orocos_kdl
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 
63 double Trajectory_Segment::Duration() const
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 
92 Trajectory_Segment::~Trajectory_Segment()
93 {
94  if (aggregate)
95  {
96  delete motprof;
97  delete geom;
98  }
99 }
100 Path* Trajectory_Segment::GetPath() {
101  return geom;
102 }
103 
104 VelocityProfile* Trajectory_Segment::GetProfile() {
105  return motprof;
106 }
107 
108 
109 }
KDL
Definition: kukaLWR_DHnew.cpp:25
KDL::VelocityProfile
Definition: velocityprofile.hpp:101
std::ostream
trajectory_segment.hpp
KDL::Trajectory_Segment::Trajectory_Segment
Trajectory_Segment(Path *_geom, VelocityProfile *_motprof, bool _aggregate=true)
Definition: trajectory_segment.cpp:87
std::endl
T endl(T... args)
KDL::Path
Definition: path.hpp:96