SVHPositionSettings.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of the SCHUNK SVH Driver suite.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
00012 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00013 //
00014 // -- END LICENSE BLOCK ------------------------------------------------
00015 
00016 //----------------------------------------------------------------------
00026 //----------------------------------------------------------------------
00027 #ifndef SVHPOSITIONSETTINGS_H
00028 #define SVHPOSITIONSETTINGS_H
00029 
00030 #include <icl_comm/ByteOrderConversion.h>
00031 
00032 namespace driver_svh {
00033 
00037 struct SVHPositionSettings
00038 {
00039 public:
00041   float wmn;
00043   float wmx;
00045   float dwmx;
00047   float ky;
00049   float dt;
00051   float imn;
00053   float imx;
00055   float kp;
00057   float ki;
00059   float kd;
00060 
00062   bool operator == (const SVHPositionSettings& other) const
00063   {
00064     return
00065       (wmn == other.wmn
00066        && wmx == other.wmx
00067        && dwmx == other.dwmx
00068        && ky == other.ky
00069        && dt == other.dt
00070        && imn == other.imn
00071        && imx == other.imx
00072        && kp == other.kp
00073        && ki == other.ki
00074        && kd == other.kd);
00075   }
00076 
00081   SVHPositionSettings(const std::vector<float>& pos_settings)
00082   {
00083     size_t size = pos_settings.size();
00084 
00085     wmn = (size > 0) ? pos_settings[0] : 0.0;
00086     wmx = (size > 1) ? pos_settings[1] : 0.0;
00087     dwmx = (size > 2) ? pos_settings[2] : 0.0;
00088     ky  = (size > 3) ? pos_settings[3] : 0.0;
00089     dt  = (size > 4) ? pos_settings[4] : 0.0;
00090     imn = (size > 5) ? pos_settings[5] : 0.0;
00091     imx = (size > 6) ? pos_settings[6] : 0.0;
00092     kp  = (size > 7) ? pos_settings[7] : 0.0;
00093     ki  = (size > 8) ? pos_settings[8] : 0.0;
00094     kd  = (size > 9) ? pos_settings[9] : 0.0;
00095   }
00096 
00097 
00098 
00112   SVHPositionSettings(const float& wmn,const float& wmx,const float& dwmx,const float& ky,const float& dt,
00113                       const float& imn,const float& imx,const float& kp,const float& ki,const float& kd):
00114     wmn(wmn),wmx(wmx),dwmx(dwmx),ky (ky),dt (dt),imn(imn), imx(imx), kp (kp), ki (ki), kd(kd)
00115   {}
00116 
00120   SVHPositionSettings():
00121     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)
00122   {}
00123 
00124 };
00125 
00127 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHPositionSettings& data)
00128 {
00129   ab << data.wmn
00130      << data.wmx
00131      << data.dwmx
00132      << data.ky
00133      << data.dt
00134      << data.imn
00135      << data.imx
00136      << data.kp
00137      << data.ki
00138      << data.kd;
00139   return ab;
00140 }
00141 
00143 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHPositionSettings& data)
00144 {
00145   ab >> data.wmn
00146      >> data.wmx
00147      >> data.dwmx
00148      >> data.ky
00149      >> data.dt
00150      >> data.imn
00151      >> data.imx
00152      >> data.kp
00153      >> data.ki
00154      >> data.kd;
00155   return ab;
00156 }
00157 
00159 inline std::ostream& operator << (std::ostream& o, const SVHPositionSettings& ps)
00160 {
00161   o << "wmn " << ps.wmn << " "
00162     << "wmx " << ps.wmx << " "
00163     << "dwmx "<< ps.dwmx << " "
00164     << "ky "  << ps.ky  << " "
00165     << "dt "  << ps.dt  << " "
00166     << "imn " << ps.imn << " "
00167     << "imx " << ps.imx << " "
00168     << "kp "  << ps.kp  << " "
00169     << "ki "  << ps.ki  << " "
00170     << "kd "  << ps.kd << " "
00171     << std::endl;
00172   return o;
00173 }
00174 
00175 
00176 
00177 
00178 
00179 }
00180 
00181 #endif // SVHPOSITIONSETTINGS_H


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19