SVHCurrentSettings.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 SVHCURRENTSETTINGS_H
28 #define SVHCURRENTSETTINGS_H
29 
30 #include <icl_comm/ByteOrderConversion.h>
31 
32 namespace driver_svh {
33 
38 {
40  float wmn;
42  float wmx;
44  float ky;
46  float dt;
48  float imn;
50  float imx;
52  float kp;
54  float ki;
56  float umn;
58  float umx;
59 
61  bool operator == (const SVHCurrentSettings& other) const
62  {
63  return
64  (wmn == other.wmn
65  && wmx == other.wmx
66  && ky == other.ky
67  && dt == other.dt
68  && imn == other.imn
69  && imx == other.imx
70  && kp == other.kp
71  && ki == other.ki
72  && umn == other.umn
73  && umx == other.umx
74  );
75  }
76 
81  SVHCurrentSettings(const std::vector<float>& cur_settings)
82  {
83  size_t size = cur_settings.size();
84 
85  // is there a nicer way to do this? Please tell me if there is :)
86  wmn = (size > 0) ? cur_settings[0] : 0.0;
87  wmx = (size > 1) ? cur_settings[1] : 0.0;
88  ky = (size > 2) ? cur_settings[2] : 0.0;
89  dt = (size > 3) ? cur_settings[3] : 0.0;
90  imn = (size > 4) ? cur_settings[4] : 0.0;
91  imx = (size > 5) ? cur_settings[5] : 0.0;
92  kp = (size > 6) ? cur_settings[6] : 0.0;
93  ki = (size > 7) ? cur_settings[7] : 0.0;
94  umn = (size > 8) ? cur_settings[8] : 0.0;
95  umx = (size > 9) ? cur_settings[9] : 0.0;
96  }
97 
111  SVHCurrentSettings(const float& wmn,const float& wmx,const float& ky,const float& dt,const float& imn,
112  const float& imx,const float& kp,const float& ki,const float& umn,const float& umx):
113  wmn(wmn),wmx(wmx),ky (ky),dt (dt),imn(imn), imx(imx), kp (kp), ki (ki), umn(umn), umx(umx)
114  {}
115 
120  wmn(0.0),wmx(0.0),ky (0.0), dt (0.0), imn(0.0), imx(0.0), kp (0.0), ki (0.0), umn(0.0), umx(0.0)
121  {}
122 
123 
124 };
125 
127 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHCurrentSettings& data)
128 {
129  ab << data.wmn
130  << data.wmx
131  << data.ky
132  << data.dt
133  << data.imn
134  << data.imx
135  << data.kp
136  << data.ki
137  << data.umn
138  << data.umx;
139  return ab;
140 }
141 
143 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHCurrentSettings& data)
144 {
145  ab >> data.wmn
146  >> data.wmx
147  >> data.ky
148  >> data.dt
149  >> data.imn
150  >> data.imx
151  >> data.kp
152  >> data.ki
153  >> data.umn
154  >> data.umx;
155  return ab;
156 
157  return ab;
158 }
159 
161 inline std::ostream& operator << (std::ostream& o, const SVHCurrentSettings& cs)
162 {
163  o << "wmn "<< cs.wmn << " "
164  << "wmx "<< cs.wmx << " "
165  << "ky " << cs.ky << " "
166  << "dt " << cs.dt << " "
167  << "imn "<< cs.imn << " "
168  << "imx "<< cs.imx << " "
169  << "kp " << cs.kp << " "
170  << "ki " << cs.ki << " "
171  << "umn "<< cs.umn << " "
172  << "umx "<< cs.umx << " "
173  << std::endl;
174  return o;
175 }
176 
177 
178 }
179 #endif // SVHCURRENTSETTINGS_H
float wmn
Reference signal minimum value.
SVHCurrentSettings(const float &wmn, const float &wmx, const float &ky, const float &dt, const float &imn, const float &imx, const float &kp, const float &ki, const float &umn, const float &umx)
SVHCurrentSettings Constructs a new current settings object to configure the current controller of a ...
float umn
Output limiter min.
SVHCurrentSettings(const std::vector< float > &cur_settings)
SVHCurrentSettings Construct current settings from a plain vector if the Vector is smaler than 10 val...
float umx
Output limiter max.
The SVHCurrentSettings save the current controller paramters for a single motor.
SVHCurrentSettings()
SVHCurrentSettings Default constructor, initalizes everything to zero.
float imn
Integral windup minimum value.
icl_comm::ArrayBuilder & operator>>(icl_comm::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
float wmx
Reference signal maximum value.
float ky
measurement scaling
icl_comm::ArrayBuilder & operator<<(icl_comm::ArrayBuilder &ab, const SVHControlCommand &data)
float dt
time base of controller
float kp
Proportional gain.
float imx
Integral windup maximum value.
bool operator==(const SVHCurrentSettings &other) const
Compares two SVHCurrentSettings objects.


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