SVHHomeSettings.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 
4 // -- BEGIN LICENSE BLOCK ----------------------------------------------
5 // This file is part of the SCHUNK SVH Driver suite.
6 //
7 // This program is free software licensed under the LGPL
8 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
9 // You can find a copy of this license in LICENSE folder in the top
10 // directory of the source code.
11 //
12 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
13 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
14 //
15 // -- END LICENSE BLOCK ------------------------------------------------
16 
17 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 
29 #ifndef SVHHOMESETTINGS_H
30 #define SVHHOMESETTINGS_H
31 
32 namespace driver_svh {
33 
36 {
38  int direction;
44  float idlePosition;
49  float rangeRad;
52 
57  direction(+1),
58  minimumOffset(0.0),
59  maximumOffset(0.0),
60  idlePosition(0.0),
61  rangeRad(0.0),
62  resetCurrentFactor(0.5)
63  {}
64 
73  SVHHomeSettings(const int &direction_,const float &minimumOffset_,const float &maximumOffset_,const float &idlePosition_,const float &rangeRad_,const float &resetCurrentFactor_):
74  minimumOffset(minimumOffset_),
75  maximumOffset(maximumOffset_),
76  idlePosition(idlePosition_),
77  rangeRad(rangeRad_),
78  resetCurrentFactor(resetCurrentFactor_)
79  {
80  // Limit the direction to just contain a factor rather than any multipliers
81  direction = direction_ < 0 ? -1 : +1;
82  // Limit the resetCurrentFactor to allowed bounds
83  resetCurrentFactor = std::max(std::min(resetCurrentFactor,1.0f),0.0f);
84 
85  }
86 
91  SVHHomeSettings(const std::vector<float> & home_settings)
92  {
93  // maybe not the most beautifull way but it works.
94  size_t size = home_settings.size();
95  float temp_direction = 0.0;
96 
97  temp_direction = (size > 0) ? home_settings[0] : 0.0;
98  direction = temp_direction < 0.0 ? -1 : +1;
99 
100  minimumOffset = (size > 1) ? home_settings[1] : 0.0;
101  maximumOffset = (size > 2) ? home_settings[2] : 0.0;
102  idlePosition = (size > 3) ? home_settings[3] : 0.0;
103  rangeRad = (size > 4) ? home_settings[4] : 0.0;
104  resetCurrentFactor = (size >5) ? home_settings[5] : 0.5;
105 
106  // Limit the resetCurrentFactor to allowed bounds
107  resetCurrentFactor = std::max(std::min(resetCurrentFactor,1.0f),0.0f);
108  }
109 
110 };
111 
112 
114 inline std::ostream& operator << (std::ostream& o, const SVHHomeSettings& hs)
115 {
116  o << "Direction " << hs.direction << " "
117  << "Min offset " << hs.minimumOffset << " "
118  << "Max offset "<< hs.maximumOffset << " "
119  << "idle pos " << hs.idlePosition << " "
120  << "Range Rad " << hs.rangeRad << " "
121  << "Reset Curr Factor " << hs.resetCurrentFactor << " "
122  << std::endl;
123  return o;
124 }
125 
126 
127 }
128 
129 
130 #endif // SVHHOMESETTINGS_H
f
float minimumOffset
Minimum reachable tick limit, given as offset from the hard stop (soft limit)
SVHHomeSettings(const std::vector< float > &home_settings)
SVHHomeSettings Convenience constructor to easily construct home settings out of a singe vector...
int direction
Movement direction of the finger +1 or -1 home in positive or negative direction. ...
float idlePosition
Idle position to move the fingers to after initialization.
float resetCurrentFactor
The resetCurrentFactor indicates how much of the maximum allowed current (of the controller) must be ...
SVHHomeSettings(const int &direction_, const float &minimumOffset_, const float &maximumOffset_, const float &idlePosition_, const float &rangeRad_, const float &resetCurrentFactor_)
SVHHomeSettingsn Constructor for the home settings, providing each value individually.
icl_comm::ArrayBuilder & operator<<(icl_comm::ArrayBuilder &ab, const SVHControlCommand &data)
SVHHomeSettings()
SVHHomeSettings Default constructor initializing empty homeSettings. This is not usefull and should b...
float maximumOffset
Maximum reachable tick limt, given as an offset from the hard stop (soft limit)
data sctructure for home positions


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