SVHPositionSettings.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of the SCHUNK SVH Driver suite.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
12 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
13 //
14 // -- END LICENSE BLOCK ------------------------------------------------
15 
16 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 #ifndef SVHPOSITIONSETTINGS_H
28 #define SVHPOSITIONSETTINGS_H
29 
30 #include <icl_comm/ByteOrderConversion.h>
31 
32 namespace driver_svh {
33 
38 {
39 public:
41  float wmn;
43  float wmx;
45  float dwmx;
47  float ky;
49  float dt;
51  float imn;
53  float imx;
55  float kp;
57  float ki;
59  float kd;
60 
62  bool operator == (const SVHPositionSettings& other) const
63  {
64  return
65  (wmn == other.wmn
66  && wmx == other.wmx
67  && dwmx == other.dwmx
68  && ky == other.ky
69  && dt == other.dt
70  && imn == other.imn
71  && imx == other.imx
72  && kp == other.kp
73  && ki == other.ki
74  && kd == other.kd);
75  }
76 
81  SVHPositionSettings(const std::vector<float>& pos_settings)
82  {
83  size_t size = pos_settings.size();
84 
85  wmn = (size > 0) ? pos_settings[0] : 0.0;
86  wmx = (size > 1) ? pos_settings[1] : 0.0;
87  dwmx = (size > 2) ? pos_settings[2] : 0.0;
88  ky = (size > 3) ? pos_settings[3] : 0.0;
89  dt = (size > 4) ? pos_settings[4] : 0.0;
90  imn = (size > 5) ? pos_settings[5] : 0.0;
91  imx = (size > 6) ? pos_settings[6] : 0.0;
92  kp = (size > 7) ? pos_settings[7] : 0.0;
93  ki = (size > 8) ? pos_settings[8] : 0.0;
94  kd = (size > 9) ? pos_settings[9] : 0.0;
95  }
96 
97 
98 
112  SVHPositionSettings(const float& wmn,const float& wmx,const float& dwmx,const float& ky,const float& dt,
113  const float& imn,const float& imx,const float& kp,const float& ki,const float& kd):
114  wmn(wmn),wmx(wmx),dwmx(dwmx),ky (ky),dt (dt),imn(imn), imx(imx), kp (kp), ki (ki), kd(kd)
115  {}
116 
121  wmn(0.0),wmx(0.0),dwmx(0.0),ky (0.0), dt (0.0), imn(0.0), imx(0.0), kp (0.0), ki (0.0), kd(0.0)
122  {}
123 
124 };
125 
127 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHPositionSettings& data)
128 {
129  ab << data.wmn
130  << data.wmx
131  << data.dwmx
132  << data.ky
133  << data.dt
134  << data.imn
135  << data.imx
136  << data.kp
137  << data.ki
138  << data.kd;
139  return ab;
140 }
141 
143 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHPositionSettings& data)
144 {
145  ab >> data.wmn
146  >> data.wmx
147  >> data.dwmx
148  >> data.ky
149  >> data.dt
150  >> data.imn
151  >> data.imx
152  >> data.kp
153  >> data.ki
154  >> data.kd;
155  return ab;
156 }
157 
159 inline std::ostream& operator << (std::ostream& o, const SVHPositionSettings& ps)
160 {
161  o << "wmn " << ps.wmn << " "
162  << "wmx " << ps.wmx << " "
163  << "dwmx "<< ps.dwmx << " "
164  << "ky " << ps.ky << " "
165  << "dt " << ps.dt << " "
166  << "imn " << ps.imn << " "
167  << "imx " << ps.imx << " "
168  << "kp " << ps.kp << " "
169  << "ki " << ps.ki << " "
170  << "kd " << ps.kd << " "
171  << std::endl;
172  return o;
173 }
174 
175 
176 
177 
178 
179 }
180 
181 #endif // SVHPOSITIONSETTINGS_H
float wmx
Reference signal maximum value.
float dt
Time base of controller.
icl_comm::ArrayBuilder & operator>>(icl_comm::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
SVHPositionSettings(const float &wmn, const float &wmx, const float &dwmx, const float &ky, const float &dt, const float &imn, const float &imx, const float &kp, const float &ki, const float &kd)
SVHPositionSettings Constructs a new positition settings object to configure the position controller ...
SVHPositionSettings()
SVHPositionSettings Defaault constructor. Intitializes everything to zero.
float dwmx
Reference signal delta maximum threshold.
icl_comm::ArrayBuilder & operator<<(icl_comm::ArrayBuilder &ab, const SVHControlCommand &data)
float wmn
Reference signal minimum value.
bool operator==(const SVHPositionSettings &other) const
Compares two SVHPositionsetting objects.
The SVHPositionSettings save the position controller paramters for a single motor.
float imn
Integral windup minimum value.
float imx
Integral windup maximum value.
SVHPositionSettings(const std::vector< float > &pos_settings)
SVHPositionSettings Construct positions settings from a plain vector if the Vector is smaler than 10 ...
float ky
Measurement scaling.


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Mon Jun 10 2019 15:04:59