Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef TRAJECTORY_H
00052 #define TRAJECTORY_H
00053
00059
00060 static const char header_trajectory_rcsid[] = "$Id: trajectory.h,v 1.10 2006/05/16 19:24:26 gourdeau Exp $";
00061
00062
00063 #ifdef _MSC_VER // Microsoft
00064
00065
00066 #pragma warning (disable:4786)
00067 #endif
00068
00069
00070
00071
00072 #include <sstream>
00073 #include <map>
00074 #include "quaternion.h"
00075 #include "utils.h"
00076
00077 #ifdef use_namespace
00078 namespace ROBOOP {
00079 using namespace NEWMAT;
00080 #endif
00081
00082 #define K_ZER0 1
00083 #define BAD_DATA -1
00084 #define EXTRAPOLLATION -2
00085 #define NOT_IN_RANGE -3
00086
00091 class Spl_cubic
00092 {
00093 public:
00094 Spl_cubic(){};
00095 Spl_cubic(const Matrix & pts);
00096 short interpolating(const Real t, ColumnVector & s);
00097 short first_derivative(const Real t, ColumnVector & ds);
00098 short second_derivative(const Real t, ColumnVector & dds);
00099 private:
00100 int nb_path;
00101 Matrix
00102 Ak, Bk, Ck, Dk;
00103 RowVector tk;
00104 bool bad_data;
00105 };
00106
00107
00108 #define NONE 0
00109 #define JOINT_SPACE 1
00110 #define CARTESIAN_SPACE 2
00111
00113 typedef std::map< Real, ColumnVector, less< Real > > point_map;
00114
00115
00120 class Spl_path : public Spl_cubic
00121 {
00122 public:
00123 Spl_path():Spl_cubic(){};
00124 Spl_path(const std::string & filename);
00125 Spl_path(const Matrix & x);
00126 short p(const Real time, ColumnVector & p);
00127 short p_pdot(const Real time, ColumnVector & p, ColumnVector & pdot);
00128 short p_pdot_pddot(const Real time, ColumnVector & p, ColumnVector & pdot,
00129 ColumnVector & pdotdot);
00130 short get_type(){ return type; }
00131 double get_final_time(){ return final_time; }
00132
00133 private:
00134 short type;
00135 double final_time;
00136 };
00137
00138
00140 typedef std::map< Real, Quaternion, less< Real > > quat_map;
00141
00142
00147 class Spl_Quaternion
00148 {
00149 public:
00150 Spl_Quaternion(){}
00151 Spl_Quaternion(const std::string & filename);
00152 Spl_Quaternion(const quat_map & quat);
00153 short quat(const Real t, Quaternion & s);
00154 short quat_w(const Real t, Quaternion & s, ColumnVector & w);
00155 private:
00156 quat_map quat_data;
00157 };
00158
00159
00164 class Trajectory_Select
00165 {
00166 public:
00167 Trajectory_Select();
00168 Trajectory_Select(const std::string & filename);
00169 Trajectory_Select & operator=(const Trajectory_Select & x);
00170
00171 void set_trajectory(const std::string & filename);
00172
00173 short type;
00174 Spl_path path;
00175 Spl_Quaternion path_quat;
00176 private:
00177 bool quaternion_active;
00178 };
00179
00180 #ifdef use_namespace
00181 }
00182 #endif
00183
00184 #endif