RefValJS_PTP.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _REFVALSJS_PTP_H_
19 #define _REFVALSJS_PTP_H_
20 
21 #include "RefVal_JS.h"
22 #include <cmath>
23 #include <iostream>
24 
25 
26 class RefValJS_PTP : public RefVal_JS
27 {
28  public:
29  RefValJS_PTP(const std::vector<double>& start, const std::vector<double>& ziel, double v_rad_s, double a_rad_s2);
30 
31  virtual std::vector<double> r(double s) const;
32  virtual double s(double t) const;
33 
34  virtual std::vector<double> dr_ds(double s) const;
35  virtual double ds_dt(double t) const;
36 
37  double getTotalTime() const { std::cout << m_T1 << "\n"; return m_T1 + m_T2 + m_T3; }
38 
39  protected:
40  double norm(const std::vector<double>& j);
41  double norm_max(const std::vector<double>& j);
42  double norm_sqr(const std::vector<double>& j);
43  double norm_weighted(const std::vector<double>& j);
44 
45  std::vector<double> m_start;
46  std::vector<double> m_ziel;
47  std::vector<double> m_direction;
48 
49  double m_length;
50 
51  double m_v_rad_s;
52  double m_a_rad_s2;
53 
54  double m_T1; // Dauer der Phase konst. Beschl.
55  double m_T2; // Dauer der Phase konst. Geschw.
56  double m_T3; // Dauer der Phase konst. Verzög.
57 
58  double m_sa1; // "Beschl." des Wegparameters s in Phase 1
59  double m_sv2; // "Geschw." des Wegparameters s in Phase 2
60  double m_sa3; // "Verzög." des Wegparameters s in Phase 3
61 
62  static const double weigths[];
63 
64 };
65 
66 inline double RefValJS_PTP::norm(const std::vector<double>& j)
67 {
68  // which norm should be used?
69  return norm_weighted(j);
70 }
71 
72 inline double RefValJS_PTP::norm_max(const std::vector<double>& j)
73 {
74  double max = j.at(0);
75  for (unsigned int i = 0; i<j.size(); i++)
76  {
77  if(j.at(i) < max)
78  max = j.at(i);
79  }
80  return max;
81 }
82 
83 inline double RefValJS_PTP::norm_sqr(const std::vector<double>& j)
84 {
85  double l = 0;
86  for (unsigned int i = 0; i < j.size(); i++)
87  {
88  l += j[i] * j[i];
89  }
90  return sqrt(l);
91 }
92 
93 inline double RefValJS_PTP::norm_weighted(const std::vector<double>& j)
94 {
95  double l = 0;
96  if ( j.size() == 7 )
97  {
98  for (unsigned int i = 0; i < j.size(); i++)
99  {
100  l += j[i]* weigths[i] * j[i] * weigths[i];
101  }
102  }
103  else
104  {
105  for (unsigned int i = 0; i < j.size(); i++)
106  {
107  l += j[i] * j[i];
108  }
109  }
110  return sqrt(l);
111 }
112 
113 
114 #endif
115 
ROSCPP_DECL void start()
virtual std::vector< double > dr_ds(double s) const
virtual double s(double t) const
RefValJS_PTP(const std::vector< double > &start, const std::vector< double > &ziel, double v_rad_s, double a_rad_s2)
std::vector< double > m_start
Definition: RefValJS_PTP.h:45
double norm(const std::vector< double > &j)
Definition: RefValJS_PTP.h:66
double norm_weighted(const std::vector< double > &j)
Definition: RefValJS_PTP.h:93
double m_length
Definition: RefValJS_PTP.h:49
double getTotalTime() const
Definition: RefValJS_PTP.h:37
std::vector< double > m_ziel
Definition: RefValJS_PTP.h:46
double m_sa1
Definition: RefValJS_PTP.h:58
static const double weigths[]
Definition: RefValJS_PTP.h:62
virtual std::vector< double > r(double s) const
double m_sv2
Definition: RefValJS_PTP.h:59
double m_v_rad_s
Definition: RefValJS_PTP.h:51
std::vector< double > m_direction
Definition: RefValJS_PTP.h:47
virtual double ds_dt(double t) const
double norm_sqr(const std::vector< double > &j)
Definition: RefValJS_PTP.h:83
double m_a_rad_s2
Definition: RefValJS_PTP.h:52
double norm_max(const std::vector< double > &j)
Definition: RefValJS_PTP.h:72
double m_sa3
Definition: RefValJS_PTP.h:60


cob_trajectory_controller
Author(s): Alexander Bubeck
autogenerated on Thu Apr 8 2021 02:39:55