RefValJS_PTP.h
Go to the documentation of this file.
00001 /********************************************************************
00002  *                                                                  *
00003  *                        RefValJS_PTP                              *
00004  *                                                                  *
00005  ********************************************************************/
00006  
00007 #ifndef _REFVALSJS_PTP_H_
00008 #define _REFVALSJS_PTP_H_
00009 
00010 #include "RefVal_JS.h"
00011 #include <cmath>
00012 #include <iostream>
00013 
00014  
00015 class RefValJS_PTP : public RefVal_JS
00016 {
00017         public:
00018                 RefValJS_PTP(const std::vector<double>& start, const std::vector<double>& ziel, double v_rad_s, double a_rad_s2);
00019                 
00020                 virtual std::vector<double> r(double s) const;
00021                 virtual double s(double t) const;
00022 
00023                 virtual std::vector<double> dr_ds(double s) const;
00024                 virtual double ds_dt(double t) const;
00025                 
00026                 double getTotalTime() const { std::cout << m_T1 << "\n"; return m_T1 + m_T2 + m_T3; }
00027                 
00028         protected:
00029                 double norm(const std::vector<double>& j);
00030                 double norm_max(const std::vector<double>& j);
00031                 double norm_sqr(const std::vector<double>& j);
00032                 double norm_weighted(const std::vector<double>& j);
00033         
00034                 std::vector<double> m_start;
00035                 std::vector<double> m_ziel;
00036                 std::vector<double> m_direction;
00037                 
00038                 double m_length;
00039                 
00040                 double m_v_rad_s;
00041                 double m_a_rad_s2;
00042                 
00043                 double m_T1;    // Dauer der Phase konst. Beschl.
00044                 double m_T2;    // Dauer der Phase konst. Geschw.
00045                 double m_T3;    // Dauer der Phase konst. Verzög.
00046                 
00047                 double m_sa1;   // "Beschl." des Wegparameters s in Phase 1
00048                 double m_sv2;   // "Geschw." des Wegparameters s in Phase 2
00049                 double m_sa3;   // "Verzög." des Wegparameters s in Phase 3
00050                 
00051                 static const double weigths[];
00052                 
00053 };
00054 
00055 inline double RefValJS_PTP::norm(const std::vector<double>& j)
00056 {
00057         // which norm should be used?
00058         return norm_weighted(j);
00059 }
00060 
00061 inline double RefValJS_PTP::norm_max(const std::vector<double>& j)
00062 {
00063         double max = j.at(0);
00064         for     (unsigned int i = 0; i<j.size(); i++)
00065         {
00066                 if(j.at(i) < max)
00067                         max = j.at(i);
00068         }
00069         return max;
00070 }
00071 
00072 inline double RefValJS_PTP::norm_sqr(const std::vector<double>& j)
00073 {
00074         double l = 0;
00075         for (unsigned int i = 0; i < j.size(); i++)
00076         {
00077                 l += j[i] * j[i];
00078         }
00079         return sqrt(l);
00080 }
00081 
00082 inline double RefValJS_PTP::norm_weighted(const std::vector<double>& j)
00083 {
00084         double l = 0;
00085         if ( j.size() == 7 )
00086         {
00087                 for (unsigned int i = 0; i < j.size(); i++)
00088                 {
00089                         l += j[i]* weigths[i] * j[i] * weigths[i];
00090                 }
00091         }
00092         else
00093         {
00094                 for (unsigned int i = 0; i < j.size(); i++)
00095                 {
00096                         l += j[i] * j[i];
00097                 }
00098         }
00099         return sqrt(l);
00100 }
00101 
00102 
00103 #endif
00104 


cob_trajectory_controller
Author(s): Alexander Bubeck
autogenerated on Tue Mar 3 2015 15:12:41