SVHControllerState.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of the SCHUNK SVH Driver suite.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
12 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
13 //
14 // -- END LICENSE BLOCK ------------------------------------------------
15 
16 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 #ifndef SVHCONTROLLERSTATE_H
30 #define SVHCONTROLLERSTATE_H
31 
32 namespace driver_svh {
33 
38 {
54 
56  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):
57  pwm_fault(_pwm_fault),
58  pwm_otw(_pwm_otw),
59  pwm_reset(_pwm_reset),
60  pwm_active(_pwm_active),
61  pos_ctrl(_pos_ctrl),
62  cur_ctrl(_cur_ctrl)
63  { }
64 
66  bool operator == (const SVHControllerState& other) const
67  {
68  return
69  (pwm_fault == other.pwm_fault
70  && pwm_otw == other.pwm_otw
71  && pwm_reset == other.pwm_reset
72  && pwm_active == other.pwm_active
73  && pos_ctrl == other.pos_ctrl
74  && cur_ctrl == other.cur_ctrl);
75  }
76 };
77 
79 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHControllerState& data)
80 {
81  ab << data.pwm_fault
82  << data.pwm_otw
83  << data.pwm_reset
84  << data.pwm_active
85  << data.pos_ctrl
86  << data.cur_ctrl;
87  return ab;
88 }
89 
91 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHControllerState& data)
92 {
93  ab >> data.pwm_fault
94  >> data.pwm_otw
95  >> data.pwm_reset
96  >> data.pwm_active
97  >> data.pos_ctrl
98  >> data.cur_ctrl;
99 
100  return ab;
101 }
102 
104 inline std::ostream& operator << (std::ostream& o, const SVHControllerState& cs)
105 {
106  o << std::setw(4) << std::setfill('0') << std::hex
107  << "pwm_fault " << "0x" << static_cast<int>(cs.pwm_fault) << " "
108  << "pwm_otw " << "0x" << static_cast<int>(cs.pwm_otw) << " "
109  << "pwm_reset " << "0x" << static_cast<int>(cs.pwm_reset) << " "
110  << "pwm_active " << "0x" << static_cast<int>(cs.pwm_active) << " "
111  << "pos_ctr " << "0x" << static_cast<int>(cs.pos_ctrl) << " "
112  << "cur_ctrl " << "0x" << static_cast<int>(cs.cur_ctrl) << " "
113  << std::endl;
114  // Reset Output stream to decimal output .. otherwise it may confuse people
115  std::cout << std::dec ;
116  return o;
117 }
118 
119 }
120 
121 
122 #endif // SVHCONTROLLERSTATE_H
uint16_t pos_ctrl
Enable/Disable of position controller (0x0001 to Activate )
bool operator==(const SVHControllerState &other) const
Compares two SVHControllerState objects.
icl_comm::ArrayBuilder & operator>>(icl_comm::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
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.
icl_comm::ArrayBuilder & operator<<(icl_comm::ArrayBuilder &ab, const SVHControlCommand &data)
uint16_t cur_ctrl
Enable/Disbale of current controller (0x0001 to Activate)
The SVHControllerState indicates the current state of the MeCoVis controller IC which is used in the ...
unsigned short uint16_t
uint16_t pwm_reset
Bitmask for low-active resets of the channels (0-8). Channel 9 (0x0200) is a special channel that act...


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