orocos_kdl
trajectory.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Erwin Aertbelien Mon May 10 19:10:36 CEST 2004 trajectory.cxx
3 
4  trajectory.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.cpp,v 1.1.1.1.2.4 2003/07/18 14:58:36 psoetens Exp $
39  * $Name: $
40  ****************************************************************************/
41 
42 
43 #include "utilities/error.h"
44 #include "utilities/error_stack.h"
45 #include "utilities/scoped_ptr.hpp"
46 #include "trajectory.hpp"
47 #include "path.hpp"
48 #include "trajectory_segment.hpp"
49 
50 #include <memory>
51 #include <cstring>
52 
53 
54 namespace KDL {
55 
56 Trajectory* Trajectory::Read(std::istream& is) {
57  IOTrace("Trajectory::Read");
58  char storage[64];
59  EatWord(is,"[",storage,sizeof(storage));
60  Eat(is,'[');
61  if (strcmp(storage,"SEGMENT")==0) {
62  IOTrace("SEGMENT");
63  scoped_ptr<Path> geom( Path::Read(is) );
64  scoped_ptr<VelocityProfile> motprof( VelocityProfile::Read(is) );
65  EatEnd(is,']');
66  IOTracePop();
67  IOTracePop();
68  return new Trajectory_Segment(geom.release(),motprof.release());
69  } else {
70  throw Error_MotionIO_Unexpected_Traj();
71  }
72  return NULL; // just to avoid the warning;
73 }
74 
75 }
KDL::Path::Read
static Path * Read(std::istream &is)
Definition: path.cpp:98
std::strcmp
T strcmp(T... args)
cstring
KDL::Trajectory::Read
static Trajectory * Read(std::istream &is)
Definition: trajectory.cpp:94
KDL::VelocityProfile::Read
static VelocityProfile * Read(std::istream &is)
Definition: velocityprofile.cpp:91
KDL
Definition: kukaLWR_DHnew.cpp:25
scoped_ptr.hpp
trajectory_segment.hpp
KDL::IOTrace
void IOTrace(const std::string &description)
Definition: error_stack.cxx:46
error.h
trajectory.hpp
KDL::EatEnd
void EatEnd(std::istream &is, int delim)
Definition: utility_io.cxx:137
memory
KDL::IOTracePop
void IOTracePop()
pops a description of the IO-stack
Definition: error_stack.cxx:51
KDL::EatWord
void EatWord(std::istream &is, const char *delim, char *storage, int maxsize)
Definition: utility_io.cxx:197
error_stack.h
KDL::Eat
void Eat(std::istream &is, int delim)
Definition: utility_io.cxx:123
path.hpp
std::istream