SVHControllerState.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 SVHCONTROLLERSTATE_H
37 #define SVHCONTROLLERSTATE_H
38 
40 
41 namespace driver_svh {
42 
48 {
52  uint16_t pwm_fault;
56  uint16_t pwm_otw;
59  uint16_t pwm_reset;
63  uint16_t pwm_active;
65  uint16_t pos_ctrl;
67  uint16_t cur_ctrl;
68 
71  uint16_t pwm_otw = 0,
72  uint16_t pwm_reset = 0,
73  uint16_t pwm_active = 0,
74  uint16_t pos_ctrl = 0,
75  uint16_t cur_ctrl = 0)
77  , pwm_otw(pwm_otw)
82  {
83  }
84 
86  bool operator==(const SVHControllerState& other) const
87  {
88  return (pwm_fault == other.pwm_fault && pwm_otw == other.pwm_otw &&
89  pwm_reset == other.pwm_reset && pwm_active == other.pwm_active &&
90  pos_ctrl == other.pos_ctrl && cur_ctrl == other.cur_ctrl);
91  }
92 };
93 
96  const SVHControllerState& data)
97 {
98  ab << data.pwm_fault << data.pwm_otw << data.pwm_reset << data.pwm_active << data.pos_ctrl
99  << data.cur_ctrl;
100  return ab;
101 }
102 
105 {
106  ab >> data.pwm_fault >> data.pwm_otw >> data.pwm_reset >> data.pwm_active >> data.pos_ctrl >>
107  data.cur_ctrl;
108 
109  return ab;
110 }
111 
113 inline std::ostream& operator<<(std::ostream& o, const SVHControllerState& cs)
114 {
115  o << std::setw(4) << std::setfill('0') << std::hex << "pwm_fault "
116  << "0x" << static_cast<int>(cs.pwm_fault) << " "
117  << "pwm_otw "
118  << "0x" << static_cast<int>(cs.pwm_otw) << " "
119  << "pwm_reset "
120  << "0x" << static_cast<int>(cs.pwm_reset) << " "
121  << "pwm_active "
122  << "0x" << static_cast<int>(cs.pwm_active) << " "
123  << "pos_ctr "
124  << "0x" << static_cast<int>(cs.pos_ctrl) << " "
125  << "cur_ctrl "
126  << "0x" << static_cast<int>(cs.cur_ctrl) << " " << std::endl;
127  // Reset Output stream to decimal output .. otherwise it may confuse people
128  std::cout << std::dec;
129  return o;
130 }
131 
132 } // namespace driver_svh
133 
134 
135 #endif // SVHCONTROLLERSTATE_H
driver_svh::ArrayBuilder
Definition: ByteOrderConversion.h:146
driver_svh::SVHControllerState::pwm_fault
uint16_t pwm_fault
Definition: SVHControllerState.h:52
driver_svh::SVHControllerState::SVHControllerState
SVHControllerState(uint16_t pwm_fault=0, uint16_t pwm_otw=0, uint16_t pwm_reset=0, uint16_t pwm_active=0, uint16_t pos_ctrl=0, uint16_t cur_ctrl=0)
Default constructor with zero values for everything.
Definition: SVHControllerState.h:70
driver_svh
Definition: SVHControlCommand.h:39
driver_svh::SVHControllerState
The SVHControllerState indicates the current state of the MeCoVis controller IC which is used in the ...
Definition: SVHControllerState.h:47
ByteOrderConversion.h
driver_svh::SVHControllerState::cur_ctrl
uint16_t cur_ctrl
Enable/Disbale of current controller (0x0001 to Activate)
Definition: SVHControllerState.h:67
driver_svh::SVHControllerState::pos_ctrl
uint16_t pos_ctrl
Enable/Disable of position controller (0x0001 to Activate )
Definition: SVHControllerState.h:65
driver_svh::SVHControllerState::operator==
bool operator==(const SVHControllerState &other) const
Compares two SVHControllerState objects.
Definition: SVHControllerState.h:86
driver_svh::SVHControllerState::pwm_reset
uint16_t pwm_reset
Definition: SVHControllerState.h:59
driver_svh::operator>>
driver_svh::ArrayBuilder & operator>>(driver_svh::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
Definition: SVHControlCommand.h:143
driver_svh::SVHControllerState::pwm_otw
uint16_t pwm_otw
Definition: SVHControllerState.h:56
driver_svh::operator<<
driver_svh::ArrayBuilder & operator<<(driver_svh::ArrayBuilder &ab, const SVHControlCommand &data)
Definition: SVHControlCommand.h:134
driver_svh::SVHControllerState::pwm_active
uint16_t pwm_active
Definition: SVHControllerState.h:63


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