Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00026
00027 #ifndef SVHCURRENTSETTINGS_H
00028 #define SVHCURRENTSETTINGS_H
00029
00030 #include <icl_comm/ByteOrderConversion.h>
00031
00032 namespace driver_svh {
00033
00037 struct SVHCurrentSettings
00038 {
00040 float wmn;
00042 float wmx;
00044 float ky;
00046 float dt;
00048 float imn;
00050 float imx;
00052 float kp;
00054 float ki;
00056 float umn;
00058 float umx;
00059
00061 bool operator == (const SVHCurrentSettings& other) const
00062 {
00063 return
00064 (wmn == other.wmn
00065 && wmx == other.wmx
00066 && ky == other.ky
00067 && dt == other.dt
00068 && imn == other.imn
00069 && imx == other.imx
00070 && kp == other.kp
00071 && ki == other.ki
00072 && umn == other.umn
00073 && umx == other.umx
00074 );
00075 }
00076
00081 SVHCurrentSettings(const std::vector<float>& cur_settings)
00082 {
00083 size_t size = cur_settings.size();
00084
00085
00086 wmn = (size > 0) ? cur_settings[0] : 0.0;
00087 wmx = (size > 1) ? cur_settings[1] : 0.0;
00088 ky = (size > 2) ? cur_settings[2] : 0.0;
00089 dt = (size > 3) ? cur_settings[3] : 0.0;
00090 imn = (size > 4) ? cur_settings[4] : 0.0;
00091 imx = (size > 5) ? cur_settings[5] : 0.0;
00092 kp = (size > 6) ? cur_settings[6] : 0.0;
00093 ki = (size > 7) ? cur_settings[7] : 0.0;
00094 umn = (size > 8) ? cur_settings[8] : 0.0;
00095 umx = (size > 9) ? cur_settings[9] : 0.0;
00096 }
00097
00111 SVHCurrentSettings(const float& wmn,const float& wmx,const float& ky,const float& dt,const float& imn,
00112 const float& imx,const float& kp,const float& ki,const float& umn,const float& umx):
00113 wmn(wmn),wmx(wmx),ky (ky),dt (dt),imn(imn), imx(imx), kp (kp), ki (ki), umn(umn), umx(umx)
00114 {}
00115
00119 SVHCurrentSettings():
00120 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)
00121 {}
00122
00123
00124 };
00125
00127 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHCurrentSettings& data)
00128 {
00129 ab << data.wmn
00130 << data.wmx
00131 << data.ky
00132 << data.dt
00133 << data.imn
00134 << data.imx
00135 << data.kp
00136 << data.ki
00137 << data.umn
00138 << data.umx;
00139 return ab;
00140 }
00141
00143 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHCurrentSettings& data)
00144 {
00145 ab >> data.wmn
00146 >> data.wmx
00147 >> data.ky
00148 >> data.dt
00149 >> data.imn
00150 >> data.imx
00151 >> data.kp
00152 >> data.ki
00153 >> data.umn
00154 >> data.umx;
00155 return ab;
00156
00157 return ab;
00158 }
00159
00161 inline std::ostream& operator << (std::ostream& o, const SVHCurrentSettings& cs)
00162 {
00163 o << "wmn "<< cs.wmn << " "
00164 << "wmx "<< cs.wmx << " "
00165 << "ky " << cs.ky << " "
00166 << "dt " << cs.dt << " "
00167 << "imn "<< cs.imn << " "
00168 << "imx "<< cs.imx << " "
00169 << "kp " << cs.kp << " "
00170 << "ki " << cs.ki << " "
00171 << "umn "<< cs.umn << " "
00172 << "umx "<< cs.umx << " "
00173 << std::endl;
00174 return o;
00175 }
00176
00177
00178 }
00179 #endif // SVHCURRENTSETTINGS_H