00001 """autogenerated by genpy from ethercat_hardware/BoardInfo.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class BoardInfo(genpy.Message):
00009 _md5sum = "ffcb87ef2725c5fab7d0d8fcd4c7e7bc"
00010 _type = "ethercat_hardware/BoardInfo"
00011 _has_header = False
00012 _full_text = """string description
00013 uint32 product_code
00014 uint32 pcb
00015 uint32 pca
00016 uint32 serial
00017 uint32 firmware_major
00018 uint32 firmware_minor
00019 float64 board_resistance
00020 float64 max_pwm_ratio
00021 float64 hw_max_current
00022 bool poor_measured_motor_voltage
00023 """
00024 __slots__ = ['description','product_code','pcb','pca','serial','firmware_major','firmware_minor','board_resistance','max_pwm_ratio','hw_max_current','poor_measured_motor_voltage']
00025 _slot_types = ['string','uint32','uint32','uint32','uint32','uint32','uint32','float64','float64','float64','bool']
00026
00027 def __init__(self, *args, **kwds):
00028 """
00029 Constructor. Any message fields that are implicitly/explicitly
00030 set to None will be assigned a default value. The recommend
00031 use is keyword arguments as this is more robust to future message
00032 changes. You cannot mix in-order arguments and keyword arguments.
00033
00034 The available fields are:
00035 description,product_code,pcb,pca,serial,firmware_major,firmware_minor,board_resistance,max_pwm_ratio,hw_max_current,poor_measured_motor_voltage
00036
00037 :param args: complete set of field values, in .msg order
00038 :param kwds: use keyword arguments corresponding to message field names
00039 to set specific fields.
00040 """
00041 if args or kwds:
00042 super(BoardInfo, self).__init__(*args, **kwds)
00043
00044 if self.description is None:
00045 self.description = ''
00046 if self.product_code is None:
00047 self.product_code = 0
00048 if self.pcb is None:
00049 self.pcb = 0
00050 if self.pca is None:
00051 self.pca = 0
00052 if self.serial is None:
00053 self.serial = 0
00054 if self.firmware_major is None:
00055 self.firmware_major = 0
00056 if self.firmware_minor is None:
00057 self.firmware_minor = 0
00058 if self.board_resistance is None:
00059 self.board_resistance = 0.
00060 if self.max_pwm_ratio is None:
00061 self.max_pwm_ratio = 0.
00062 if self.hw_max_current is None:
00063 self.hw_max_current = 0.
00064 if self.poor_measured_motor_voltage is None:
00065 self.poor_measured_motor_voltage = False
00066 else:
00067 self.description = ''
00068 self.product_code = 0
00069 self.pcb = 0
00070 self.pca = 0
00071 self.serial = 0
00072 self.firmware_major = 0
00073 self.firmware_minor = 0
00074 self.board_resistance = 0.
00075 self.max_pwm_ratio = 0.
00076 self.hw_max_current = 0.
00077 self.poor_measured_motor_voltage = False
00078
00079 def _get_types(self):
00080 """
00081 internal API method
00082 """
00083 return self._slot_types
00084
00085 def serialize(self, buff):
00086 """
00087 serialize message into buffer
00088 :param buff: buffer, ``StringIO``
00089 """
00090 try:
00091 _x = self.description
00092 length = len(_x)
00093 if python3 or type(_x) == unicode:
00094 _x = _x.encode('utf-8')
00095 length = len(_x)
00096 buff.write(struct.pack('<I%ss'%length, length, _x))
00097 _x = self
00098 buff.write(_struct_6I3dB.pack(_x.product_code, _x.pcb, _x.pca, _x.serial, _x.firmware_major, _x.firmware_minor, _x.board_resistance, _x.max_pwm_ratio, _x.hw_max_current, _x.poor_measured_motor_voltage))
00099 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00100 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00101
00102 def deserialize(self, str):
00103 """
00104 unpack serialized message in str into this message instance
00105 :param str: byte array of serialized message, ``str``
00106 """
00107 try:
00108 end = 0
00109 start = end
00110 end += 4
00111 (length,) = _struct_I.unpack(str[start:end])
00112 start = end
00113 end += length
00114 if python3:
00115 self.description = str[start:end].decode('utf-8')
00116 else:
00117 self.description = str[start:end]
00118 _x = self
00119 start = end
00120 end += 49
00121 (_x.product_code, _x.pcb, _x.pca, _x.serial, _x.firmware_major, _x.firmware_minor, _x.board_resistance, _x.max_pwm_ratio, _x.hw_max_current, _x.poor_measured_motor_voltage,) = _struct_6I3dB.unpack(str[start:end])
00122 self.poor_measured_motor_voltage = bool(self.poor_measured_motor_voltage)
00123 return self
00124 except struct.error as e:
00125 raise genpy.DeserializationError(e)
00126
00127
00128 def serialize_numpy(self, buff, numpy):
00129 """
00130 serialize message with numpy array types into buffer
00131 :param buff: buffer, ``StringIO``
00132 :param numpy: numpy python module
00133 """
00134 try:
00135 _x = self.description
00136 length = len(_x)
00137 if python3 or type(_x) == unicode:
00138 _x = _x.encode('utf-8')
00139 length = len(_x)
00140 buff.write(struct.pack('<I%ss'%length, length, _x))
00141 _x = self
00142 buff.write(_struct_6I3dB.pack(_x.product_code, _x.pcb, _x.pca, _x.serial, _x.firmware_major, _x.firmware_minor, _x.board_resistance, _x.max_pwm_ratio, _x.hw_max_current, _x.poor_measured_motor_voltage))
00143 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00144 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00145
00146 def deserialize_numpy(self, str, numpy):
00147 """
00148 unpack serialized message in str into this message instance using numpy for array types
00149 :param str: byte array of serialized message, ``str``
00150 :param numpy: numpy python module
00151 """
00152 try:
00153 end = 0
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 start = end
00158 end += length
00159 if python3:
00160 self.description = str[start:end].decode('utf-8')
00161 else:
00162 self.description = str[start:end]
00163 _x = self
00164 start = end
00165 end += 49
00166 (_x.product_code, _x.pcb, _x.pca, _x.serial, _x.firmware_major, _x.firmware_minor, _x.board_resistance, _x.max_pwm_ratio, _x.hw_max_current, _x.poor_measured_motor_voltage,) = _struct_6I3dB.unpack(str[start:end])
00167 self.poor_measured_motor_voltage = bool(self.poor_measured_motor_voltage)
00168 return self
00169 except struct.error as e:
00170 raise genpy.DeserializationError(e)
00171
00172 _struct_I = genpy.struct_I
00173 _struct_6I3dB = struct.Struct("<6I3dB")