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 #ifndef _REFVALSJS_PTP_H_
00019 #define _REFVALSJS_PTP_H_
00020
00021 #include "RefVal_JS.h"
00022 #include <cmath>
00023 #include <iostream>
00024
00025
00026 class RefValJS_PTP : public RefVal_JS
00027 {
00028 public:
00029 RefValJS_PTP(const std::vector<double>& start, const std::vector<double>& ziel, double v_rad_s, double a_rad_s2);
00030
00031 virtual std::vector<double> r(double s) const;
00032 virtual double s(double t) const;
00033
00034 virtual std::vector<double> dr_ds(double s) const;
00035 virtual double ds_dt(double t) const;
00036
00037 double getTotalTime() const { std::cout << m_T1 << "\n"; return m_T1 + m_T2 + m_T3; }
00038
00039 protected:
00040 double norm(const std::vector<double>& j);
00041 double norm_max(const std::vector<double>& j);
00042 double norm_sqr(const std::vector<double>& j);
00043 double norm_weighted(const std::vector<double>& j);
00044
00045 std::vector<double> m_start;
00046 std::vector<double> m_ziel;
00047 std::vector<double> m_direction;
00048
00049 double m_length;
00050
00051 double m_v_rad_s;
00052 double m_a_rad_s2;
00053
00054 double m_T1;
00055 double m_T2;
00056 double m_T3;
00057
00058 double m_sa1;
00059 double m_sv2;
00060 double m_sa3;
00061
00062 static const double weigths[];
00063
00064 };
00065
00066 inline double RefValJS_PTP::norm(const std::vector<double>& j)
00067 {
00068
00069 return norm_weighted(j);
00070 }
00071
00072 inline double RefValJS_PTP::norm_max(const std::vector<double>& j)
00073 {
00074 double max = j.at(0);
00075 for (unsigned int i = 0; i<j.size(); i++)
00076 {
00077 if(j.at(i) < max)
00078 max = j.at(i);
00079 }
00080 return max;
00081 }
00082
00083 inline double RefValJS_PTP::norm_sqr(const std::vector<double>& j)
00084 {
00085 double l = 0;
00086 for (unsigned int i = 0; i < j.size(); i++)
00087 {
00088 l += j[i] * j[i];
00089 }
00090 return sqrt(l);
00091 }
00092
00093 inline double RefValJS_PTP::norm_weighted(const std::vector<double>& j)
00094 {
00095 double l = 0;
00096 if ( j.size() == 7 )
00097 {
00098 for (unsigned int i = 0; i < j.size(); i++)
00099 {
00100 l += j[i]* weigths[i] * j[i] * weigths[i];
00101 }
00102 }
00103 else
00104 {
00105 for (unsigned int i = 0; i < j.size(); i++)
00106 {
00107 l += j[i] * j[i];
00108 }
00109 }
00110 return sqrt(l);
00111 }
00112
00113
00114 #endif
00115