Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00027
00028
00029 #ifndef SVHHOMESETTINGS_H
00030 #define SVHHOMESETTINGS_H
00031
00032 namespace driver_svh {
00033
00035 struct SVHHomeSettings
00036 {
00038 int direction;
00040 float minimumOffset;
00042 float maximumOffset;
00044 float idlePosition;
00049 float rangeRad;
00051 float resetCurrentFactor;
00052
00056 SVHHomeSettings():
00057 direction(+1),
00058 minimumOffset(0.0),
00059 maximumOffset(0.0),
00060 idlePosition(0.0),
00061 rangeRad(0.0),
00062 resetCurrentFactor(0.5)
00063 {}
00064
00073 SVHHomeSettings(const int &direction_,const float &minimumOffset_,const float &maximumOffset_,const float &idlePosition_,const float &rangeRad_,const float &resetCurrentFactor_):
00074 minimumOffset(minimumOffset_),
00075 maximumOffset(maximumOffset_),
00076 idlePosition(idlePosition_),
00077 rangeRad(rangeRad_),
00078 resetCurrentFactor(resetCurrentFactor_)
00079 {
00080
00081 direction = direction_ < 0 ? -1 : +1;
00082
00083 resetCurrentFactor = std::max(std::min(resetCurrentFactor,1.0f),0.0f);
00084
00085 }
00086
00091 SVHHomeSettings(const std::vector<float> & home_settings)
00092 {
00093
00094 size_t size = home_settings.size();
00095 float temp_direction = 0.0;
00096
00097 temp_direction = (size > 0) ? home_settings[0] : 0.0;
00098 direction = temp_direction < 0.0 ? -1 : +1;
00099
00100 minimumOffset = (size > 1) ? home_settings[1] : 0.0;
00101 maximumOffset = (size > 2) ? home_settings[2] : 0.0;
00102 idlePosition = (size > 3) ? home_settings[3] : 0.0;
00103 rangeRad = (size > 4) ? home_settings[4] : 0.0;
00104 resetCurrentFactor = (size >5) ? home_settings[5] : 0.5;
00105
00106
00107 resetCurrentFactor = std::max(std::min(resetCurrentFactor,1.0f),0.0f);
00108 }
00109
00110 };
00111
00112
00114 inline std::ostream& operator << (std::ostream& o, const SVHHomeSettings& hs)
00115 {
00116 o << "Direction " << hs.direction << " "
00117 << "Min offset " << hs.minimumOffset << " "
00118 << "Max offset "<< hs.maximumOffset << " "
00119 << "idle pos " << hs.idlePosition << " "
00120 << "Range Rad " << hs.rangeRad << " "
00121 << "Reset Curr Factor " << hs.resetCurrentFactor << " "
00122 << std::endl;
00123 return o;
00124 }
00125
00126
00127 }
00128
00129
00130 #endif // SVHHOMESETTINGS_H