00001 """autogenerated by genpy from ethercat_hardware/ActuatorInfo.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 ActuatorInfo(genpy.Message):
00009 _md5sum = "40f44d8ec4380adc0b63713486eecb09"
00010 _type = "ethercat_hardware/ActuatorInfo"
00011 _has_header = False
00012 _full_text = """uint32 id
00013 string name
00014 string robot_name
00015 string motor_make
00016 string motor_model
00017 float64 max_current
00018 float64 speed_constant
00019 float64 motor_resistance
00020 float64 motor_torque_constant
00021 float64 encoder_reduction
00022 float64 pulses_per_revolution
00023 """
00024 __slots__ = ['id','name','robot_name','motor_make','motor_model','max_current','speed_constant','motor_resistance','motor_torque_constant','encoder_reduction','pulses_per_revolution']
00025 _slot_types = ['uint32','string','string','string','string','float64','float64','float64','float64','float64','float64']
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 id,name,robot_name,motor_make,motor_model,max_current,speed_constant,motor_resistance,motor_torque_constant,encoder_reduction,pulses_per_revolution
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(ActuatorInfo, self).__init__(*args, **kwds)
00043
00044 if self.id is None:
00045 self.id = 0
00046 if self.name is None:
00047 self.name = ''
00048 if self.robot_name is None:
00049 self.robot_name = ''
00050 if self.motor_make is None:
00051 self.motor_make = ''
00052 if self.motor_model is None:
00053 self.motor_model = ''
00054 if self.max_current is None:
00055 self.max_current = 0.
00056 if self.speed_constant is None:
00057 self.speed_constant = 0.
00058 if self.motor_resistance is None:
00059 self.motor_resistance = 0.
00060 if self.motor_torque_constant is None:
00061 self.motor_torque_constant = 0.
00062 if self.encoder_reduction is None:
00063 self.encoder_reduction = 0.
00064 if self.pulses_per_revolution is None:
00065 self.pulses_per_revolution = 0.
00066 else:
00067 self.id = 0
00068 self.name = ''
00069 self.robot_name = ''
00070 self.motor_make = ''
00071 self.motor_model = ''
00072 self.max_current = 0.
00073 self.speed_constant = 0.
00074 self.motor_resistance = 0.
00075 self.motor_torque_constant = 0.
00076 self.encoder_reduction = 0.
00077 self.pulses_per_revolution = 0.
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 buff.write(_struct_I.pack(self.id))
00092 _x = self.name
00093 length = len(_x)
00094 if python3 or type(_x) == unicode:
00095 _x = _x.encode('utf-8')
00096 length = len(_x)
00097 buff.write(struct.pack('<I%ss'%length, length, _x))
00098 _x = self.robot_name
00099 length = len(_x)
00100 if python3 or type(_x) == unicode:
00101 _x = _x.encode('utf-8')
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 _x = self.motor_make
00105 length = len(_x)
00106 if python3 or type(_x) == unicode:
00107 _x = _x.encode('utf-8')
00108 length = len(_x)
00109 buff.write(struct.pack('<I%ss'%length, length, _x))
00110 _x = self.motor_model
00111 length = len(_x)
00112 if python3 or type(_x) == unicode:
00113 _x = _x.encode('utf-8')
00114 length = len(_x)
00115 buff.write(struct.pack('<I%ss'%length, length, _x))
00116 _x = self
00117 buff.write(_struct_6d.pack(_x.max_current, _x.speed_constant, _x.motor_resistance, _x.motor_torque_constant, _x.encoder_reduction, _x.pulses_per_revolution))
00118 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00119 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00120
00121 def deserialize(self, str):
00122 """
00123 unpack serialized message in str into this message instance
00124 :param str: byte array of serialized message, ``str``
00125 """
00126 try:
00127 end = 0
00128 start = end
00129 end += 4
00130 (self.id,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 start = end
00135 end += length
00136 if python3:
00137 self.name = str[start:end].decode('utf-8')
00138 else:
00139 self.name = str[start:end]
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 start = end
00144 end += length
00145 if python3:
00146 self.robot_name = str[start:end].decode('utf-8')
00147 else:
00148 self.robot_name = str[start:end]
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 self.motor_make = str[start:end].decode('utf-8')
00156 else:
00157 self.motor_make = str[start:end]
00158 start = end
00159 end += 4
00160 (length,) = _struct_I.unpack(str[start:end])
00161 start = end
00162 end += length
00163 if python3:
00164 self.motor_model = str[start:end].decode('utf-8')
00165 else:
00166 self.motor_model = str[start:end]
00167 _x = self
00168 start = end
00169 end += 48
00170 (_x.max_current, _x.speed_constant, _x.motor_resistance, _x.motor_torque_constant, _x.encoder_reduction, _x.pulses_per_revolution,) = _struct_6d.unpack(str[start:end])
00171 return self
00172 except struct.error as e:
00173 raise genpy.DeserializationError(e)
00174
00175
00176 def serialize_numpy(self, buff, numpy):
00177 """
00178 serialize message with numpy array types into buffer
00179 :param buff: buffer, ``StringIO``
00180 :param numpy: numpy python module
00181 """
00182 try:
00183 buff.write(_struct_I.pack(self.id))
00184 _x = self.name
00185 length = len(_x)
00186 if python3 or type(_x) == unicode:
00187 _x = _x.encode('utf-8')
00188 length = len(_x)
00189 buff.write(struct.pack('<I%ss'%length, length, _x))
00190 _x = self.robot_name
00191 length = len(_x)
00192 if python3 or type(_x) == unicode:
00193 _x = _x.encode('utf-8')
00194 length = len(_x)
00195 buff.write(struct.pack('<I%ss'%length, length, _x))
00196 _x = self.motor_make
00197 length = len(_x)
00198 if python3 or type(_x) == unicode:
00199 _x = _x.encode('utf-8')
00200 length = len(_x)
00201 buff.write(struct.pack('<I%ss'%length, length, _x))
00202 _x = self.motor_model
00203 length = len(_x)
00204 if python3 or type(_x) == unicode:
00205 _x = _x.encode('utf-8')
00206 length = len(_x)
00207 buff.write(struct.pack('<I%ss'%length, length, _x))
00208 _x = self
00209 buff.write(_struct_6d.pack(_x.max_current, _x.speed_constant, _x.motor_resistance, _x.motor_torque_constant, _x.encoder_reduction, _x.pulses_per_revolution))
00210 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00211 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00212
00213 def deserialize_numpy(self, str, numpy):
00214 """
00215 unpack serialized message in str into this message instance using numpy for array types
00216 :param str: byte array of serialized message, ``str``
00217 :param numpy: numpy python module
00218 """
00219 try:
00220 end = 0
00221 start = end
00222 end += 4
00223 (self.id,) = _struct_I.unpack(str[start:end])
00224 start = end
00225 end += 4
00226 (length,) = _struct_I.unpack(str[start:end])
00227 start = end
00228 end += length
00229 if python3:
00230 self.name = str[start:end].decode('utf-8')
00231 else:
00232 self.name = str[start:end]
00233 start = end
00234 end += 4
00235 (length,) = _struct_I.unpack(str[start:end])
00236 start = end
00237 end += length
00238 if python3:
00239 self.robot_name = str[start:end].decode('utf-8')
00240 else:
00241 self.robot_name = str[start:end]
00242 start = end
00243 end += 4
00244 (length,) = _struct_I.unpack(str[start:end])
00245 start = end
00246 end += length
00247 if python3:
00248 self.motor_make = str[start:end].decode('utf-8')
00249 else:
00250 self.motor_make = str[start:end]
00251 start = end
00252 end += 4
00253 (length,) = _struct_I.unpack(str[start:end])
00254 start = end
00255 end += length
00256 if python3:
00257 self.motor_model = str[start:end].decode('utf-8')
00258 else:
00259 self.motor_model = str[start:end]
00260 _x = self
00261 start = end
00262 end += 48
00263 (_x.max_current, _x.speed_constant, _x.motor_resistance, _x.motor_torque_constant, _x.encoder_reduction, _x.pulses_per_revolution,) = _struct_6d.unpack(str[start:end])
00264 return self
00265 except struct.error as e:
00266 raise genpy.DeserializationError(e)
00267
00268 _struct_I = genpy.struct_I
00269 _struct_6d = struct.Struct("<6d")