trajectory.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2004 Etienne Lachance
3 
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 Report problems and direct all questions to:
20 
21 email: etienne.lachance@polymtl.ca or richard.gourdeau@polymtl.ca
22 
23 Reference:
24 
25 [1] J. Angeles, Fundamentals of Robotic Mechanical Systems: Theory, Methods and Algorithms,
26  Springer-Verlag, Mechanical Engineering Series, 1997, ISBN: 0-387-94540-7.
27 
28 [2] E.B. Dam, M. Koch and M. Lillholm, "Quaternions, Interpolation and Animation",
29  tech report of University of Copenhagen, number: DIKU-TR-98/5, 1998.
30 
31 -------------------------------------------------------------------------------
32 Revision_history:
33 
34 2004/05/22: Etienne Lachance
35  -Added class Trajectory_Select.
36 
37 2004/07/01: Etienne Lachance
38  -Added doxygen documentation.
39 
40 2004/07/01: Ethan Tira-Thompson
41  -Added support for newmat's use_namespace #define, using ROBOOP namespace
42 
43 2005/11/06: Etienne Lachance
44  - No need to provide a copy constructor and the assignment operator
45  (operator=) for Spl_Quaternion, Spl_Cubic and Spl_path classes. Instead we
46  use the one provide by the compiler.
47 -------------------------------------------------------------------------------
48 */
49 
50 
51 #ifndef TRAJECTORY_H
52 #define TRAJECTORY_H
53 
59 static const char header_trajectory_rcsid[] = "$Id: trajectory.h,v 1.10 2006/05/16 19:24:26 gourdeau Exp $";
61 
62 
63 #ifdef _MSC_VER // Microsoft
64 //#include <string.h>
65 //#include <iostream.h>
66 #pragma warning (disable:4786) /* Disable decorated name truncation warnings */
67 #endif
68 //#include <string>
69 //#include <iostream>
70 
71 //#include <fstream>
72 #include <sstream>
73 #include <map>
74 #include "quaternion.h"
75 #include "utils.h"
76 
77 #ifdef use_namespace
78 namespace ROBOOP {
79  using namespace NEWMAT;
80 #endif
81 
82 #define K_ZER0 1
83 #define BAD_DATA -1
84 #define EXTRAPOLLATION -2
85 #define NOT_IN_RANGE -3
86 
91 class Spl_cubic
92 {
93 public:
94  Spl_cubic(){};
95  Spl_cubic(const Matrix & pts);
96  short interpolating(const Real t, ColumnVector & s);
97  short first_derivative(const Real t, ColumnVector & ds);
98  short second_derivative(const Real t, ColumnVector & dds);
99 private:
100  int nb_path;
101  Matrix
102  Ak, Bk, Ck, Dk;
104  bool bad_data;
105 };
106 
107 
108 #define NONE 0
109 #define JOINT_SPACE 1
110 #define CARTESIAN_SPACE 2
111 
113 typedef std::map< Real, ColumnVector, less< Real > > point_map;
114 
115 
120 class Spl_path : public Spl_cubic
121 {
122 public:
124  Spl_path(const std::string & filename);
125  Spl_path(const Matrix & x);
126  short p(const Real time, ColumnVector & p);
127  short p_pdot(const Real time, ColumnVector & p, ColumnVector & pdot);
128  short p_pdot_pddot(const Real time, ColumnVector & p, ColumnVector & pdot,
129  ColumnVector & pdotdot);
130  short get_type(){ return type; }
131  double get_final_time(){ return final_time; }
132 
133 private:
134  short type;
135  double final_time;
136 };
137 
138 
140 typedef std::map< Real, Quaternion, less< Real > > quat_map;
141 
142 
148 {
149 public:
151  Spl_Quaternion(const std::string & filename);
152  Spl_Quaternion(const quat_map & quat);
153  short quat(const Real t, Quaternion & s);
154  short quat_w(const Real t, Quaternion & s, ColumnVector & w);
155 private:
156  quat_map quat_data;
157 };
158 
159 
165 {
166 public:
168  Trajectory_Select(const std::string & filename);
169  Trajectory_Select & operator=(const Trajectory_Select & x);
170 
171  void set_trajectory(const std::string & filename);
172 
173  short type;
176 private:
178 };
179 
180 #ifdef use_namespace
181 }
182 #endif
183 
184 #endif
Quaternion class definition.
Definition: quaternion.h:92
short type
Cartesian or joint space.
Definition: trajectory.h:173
static const char header_trajectory_rcsid[]
RCS/CVS version.
Definition: trajectory.h:60
double get_final_time()
Definition: trajectory.h:131
quat_map quat_data
Data at control points.
Definition: trajectory.h:156
short type
Cartesian space or joint space.
Definition: trajectory.h:134
RowVector tk
Time at control points.
Definition: trajectory.h:103
double Real
Definition: include.h:307
Trajectory class selection.
Definition: trajectory.h:164
Utility header file.
Spl_path path
Spl_path instance.
Definition: trajectory.h:174
Matrix Dk
Definition: trajectory.h:102
int nb_path
Number of path, i.e: path in x,y,z nb_path=3.
Definition: trajectory.h:100
double final_time
Spline final time.
Definition: trajectory.h:135
Cubic quaternions spline.
Definition: trajectory.h:147
Cartesian or joint space trajectory.
Definition: trajectory.h:120
Spl_Quaternion path_quat
Spl_Quaternion instance.
Definition: trajectory.h:175
bool quaternion_active
Using Spl_Quaternion.
Definition: trajectory.h:177
The usual rectangular matrix.
Definition: newmat.h:625
std::map< Real, Quaternion, less< Real > > quat_map
Data at control points.
Definition: trajectory.h:140
Quaternion class.
short get_type()
Definition: trajectory.h:130
std::map< Real, ColumnVector, less< Real > > point_map
Data at control points.
Definition: trajectory.h:113
Row vector.
Definition: newmat.h:953
Column vector.
Definition: newmat.h:1008
Natural cubic splines class.
Definition: trajectory.h:91
bool bad_data
Status flag.
Definition: trajectory.h:104


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:17