SVHEncoderSettings.h
Go to the documentation of this file.
1 //
3 // © Copyright 2022 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
4 // © Copyright 2022 FZI Forschungszentrum Informatik, Karlsruhe, Germany
5 //
6 // This file is part of the Schunk SVH Library.
7 //
8 // The Schunk SVH Library is free software: you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or (at your
11 // option) any later version.
12 //
13 // The Schunk SVH Library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 // Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // the Schunk SVH Library. If not, see <https://www.gnu.org/licenses/>.
20 //
22 
23 //----------------------------------------------------------------------
35 //----------------------------------------------------------------------
36 #ifndef SVHENCODERSETTINGS_H
37 #define SVHENCODERSETTINGS_H
38 
40 
41 namespace driver_svh {
42 
47 {
49  std::vector<uint32_t> scalings;
50 
51  // TODO Provide a constructor that allows for seperate encoder settings in the hardware
56  SVHEncoderSettings(uint32_t scaling = 1)
57  : scalings(9, scaling)
58  {
59  }
60 
62  bool operator==(const SVHEncoderSettings& other) const { return (scalings == other.scalings); }
63 };
64 
65 
68  const SVHEncoderSettings& data)
69 {
70  // Trivial as the vector slicing is already done by the arraybuilder
71  ab << data.scalings;
72  return ab;
73 }
74 
77 {
78  ab >> data.scalings;
79  return ab;
80 }
81 
82 
84 inline std::ostream& operator<<(std::ostream& o, const SVHEncoderSettings& es)
85 {
86  o << "Scalings: ";
87  for (size_t i = 0; i < es.scalings.size(); i++)
88  {
89  o << (int)i << ":" << es.scalings[i] << " ";
90  }
91 
92  o << std::endl;
93  return o;
94 }
95 
96 } // namespace driver_svh
97 #endif // SVHENCODERSETTINGS_H
bool operator==(const SVHEncoderSettings &other) const
Compares two SVHEncoderSettings objects.
driver_svh::ArrayBuilder & operator<<(driver_svh::ArrayBuilder &ab, const SVHControlCommand &data)
std::vector< uint32_t > scalings
encoderSettings consist of multipliers for each encoder
driver_svh::ArrayBuilder & operator>>(driver_svh::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
SVHEncoderSettings(uint32_t scaling=1)
SVHEncoderSettings Default CTOR will assign 9x1 to the scalings if no argument is given...
The SVHEncoderSettings hold the settings for the encoder scaling of each channel. ...


schunk_svh_library
Author(s): Georg Heppner, Lars Pfotzer, Felix Exner, Johannes Mangler, Stefan Scherzinger, Pascal Becker
autogenerated on Fri Apr 14 2023 02:26:23