00001 """autogenerated by genpy from brics_actuator/JointImpedances.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import brics_actuator.msg
00008 import genpy
00009
00010 class JointImpedances(genpy.Message):
00011 _md5sum = "14fdbb76121290f17525acd99e7242c6"
00012 _type = "brics_actuator/JointImpedances"
00013 _has_header = False
00014 _full_text = """Poison poisonStamp
00015 JointValue[] dampings
00016 JointValue[] stiffnesses
00017
00018 ================================================================================
00019 MSG: brics_actuator/Poison
00020 string originator # node id
00021 string description # encoding still an issue
00022 float32 qos # reliability of the channel
00023 # 0..1 where 1 means healthy
00024
00025 ================================================================================
00026 MSG: brics_actuator/JointValue
00027 time timeStamp #time of the data
00028 string joint_uri
00029 string unit #if empy expects si units, you can use boost::unit
00030 float64 value
00031
00032 """
00033 __slots__ = ['poisonStamp','dampings','stiffnesses']
00034 _slot_types = ['brics_actuator/Poison','brics_actuator/JointValue[]','brics_actuator/JointValue[]']
00035
00036 def __init__(self, *args, **kwds):
00037 """
00038 Constructor. Any message fields that are implicitly/explicitly
00039 set to None will be assigned a default value. The recommend
00040 use is keyword arguments as this is more robust to future message
00041 changes. You cannot mix in-order arguments and keyword arguments.
00042
00043 The available fields are:
00044 poisonStamp,dampings,stiffnesses
00045
00046 :param args: complete set of field values, in .msg order
00047 :param kwds: use keyword arguments corresponding to message field names
00048 to set specific fields.
00049 """
00050 if args or kwds:
00051 super(JointImpedances, self).__init__(*args, **kwds)
00052
00053 if self.poisonStamp is None:
00054 self.poisonStamp = brics_actuator.msg.Poison()
00055 if self.dampings is None:
00056 self.dampings = []
00057 if self.stiffnesses is None:
00058 self.stiffnesses = []
00059 else:
00060 self.poisonStamp = brics_actuator.msg.Poison()
00061 self.dampings = []
00062 self.stiffnesses = []
00063
00064 def _get_types(self):
00065 """
00066 internal API method
00067 """
00068 return self._slot_types
00069
00070 def serialize(self, buff):
00071 """
00072 serialize message into buffer
00073 :param buff: buffer, ``StringIO``
00074 """
00075 try:
00076 _x = self.poisonStamp.originator
00077 length = len(_x)
00078 if python3 or type(_x) == unicode:
00079 _x = _x.encode('utf-8')
00080 length = len(_x)
00081 buff.write(struct.pack('<I%ss'%length, length, _x))
00082 _x = self.poisonStamp.description
00083 length = len(_x)
00084 if python3 or type(_x) == unicode:
00085 _x = _x.encode('utf-8')
00086 length = len(_x)
00087 buff.write(struct.pack('<I%ss'%length, length, _x))
00088 buff.write(_struct_f.pack(self.poisonStamp.qos))
00089 length = len(self.dampings)
00090 buff.write(_struct_I.pack(length))
00091 for val1 in self.dampings:
00092 _v1 = val1.timeStamp
00093 _x = _v1
00094 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00095 _x = val1.joint_uri
00096 length = len(_x)
00097 if python3 or type(_x) == unicode:
00098 _x = _x.encode('utf-8')
00099 length = len(_x)
00100 buff.write(struct.pack('<I%ss'%length, length, _x))
00101 _x = val1.unit
00102 length = len(_x)
00103 if python3 or type(_x) == unicode:
00104 _x = _x.encode('utf-8')
00105 length = len(_x)
00106 buff.write(struct.pack('<I%ss'%length, length, _x))
00107 buff.write(_struct_d.pack(val1.value))
00108 length = len(self.stiffnesses)
00109 buff.write(_struct_I.pack(length))
00110 for val1 in self.stiffnesses:
00111 _v2 = val1.timeStamp
00112 _x = _v2
00113 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00114 _x = val1.joint_uri
00115 length = len(_x)
00116 if python3 or type(_x) == unicode:
00117 _x = _x.encode('utf-8')
00118 length = len(_x)
00119 buff.write(struct.pack('<I%ss'%length, length, _x))
00120 _x = val1.unit
00121 length = len(_x)
00122 if python3 or type(_x) == unicode:
00123 _x = _x.encode('utf-8')
00124 length = len(_x)
00125 buff.write(struct.pack('<I%ss'%length, length, _x))
00126 buff.write(_struct_d.pack(val1.value))
00127 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00128 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00129
00130 def deserialize(self, str):
00131 """
00132 unpack serialized message in str into this message instance
00133 :param str: byte array of serialized message, ``str``
00134 """
00135 try:
00136 if self.poisonStamp is None:
00137 self.poisonStamp = brics_actuator.msg.Poison()
00138 if self.dampings is None:
00139 self.dampings = None
00140 if self.stiffnesses is None:
00141 self.stiffnesses = None
00142 end = 0
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 start = end
00147 end += length
00148 if python3:
00149 self.poisonStamp.originator = str[start:end].decode('utf-8')
00150 else:
00151 self.poisonStamp.originator = str[start:end]
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 self.poisonStamp.description = str[start:end].decode('utf-8')
00159 else:
00160 self.poisonStamp.description = str[start:end]
00161 start = end
00162 end += 4
00163 (self.poisonStamp.qos,) = _struct_f.unpack(str[start:end])
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 self.dampings = []
00168 for i in range(0, length):
00169 val1 = brics_actuator.msg.JointValue()
00170 _v3 = val1.timeStamp
00171 _x = _v3
00172 start = end
00173 end += 8
00174 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00175 start = end
00176 end += 4
00177 (length,) = _struct_I.unpack(str[start:end])
00178 start = end
00179 end += length
00180 if python3:
00181 val1.joint_uri = str[start:end].decode('utf-8')
00182 else:
00183 val1.joint_uri = str[start:end]
00184 start = end
00185 end += 4
00186 (length,) = _struct_I.unpack(str[start:end])
00187 start = end
00188 end += length
00189 if python3:
00190 val1.unit = str[start:end].decode('utf-8')
00191 else:
00192 val1.unit = str[start:end]
00193 start = end
00194 end += 8
00195 (val1.value,) = _struct_d.unpack(str[start:end])
00196 self.dampings.append(val1)
00197 start = end
00198 end += 4
00199 (length,) = _struct_I.unpack(str[start:end])
00200 self.stiffnesses = []
00201 for i in range(0, length):
00202 val1 = brics_actuator.msg.JointValue()
00203 _v4 = val1.timeStamp
00204 _x = _v4
00205 start = end
00206 end += 8
00207 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00208 start = end
00209 end += 4
00210 (length,) = _struct_I.unpack(str[start:end])
00211 start = end
00212 end += length
00213 if python3:
00214 val1.joint_uri = str[start:end].decode('utf-8')
00215 else:
00216 val1.joint_uri = str[start:end]
00217 start = end
00218 end += 4
00219 (length,) = _struct_I.unpack(str[start:end])
00220 start = end
00221 end += length
00222 if python3:
00223 val1.unit = str[start:end].decode('utf-8')
00224 else:
00225 val1.unit = str[start:end]
00226 start = end
00227 end += 8
00228 (val1.value,) = _struct_d.unpack(str[start:end])
00229 self.stiffnesses.append(val1)
00230 return self
00231 except struct.error as e:
00232 raise genpy.DeserializationError(e)
00233
00234
00235 def serialize_numpy(self, buff, numpy):
00236 """
00237 serialize message with numpy array types into buffer
00238 :param buff: buffer, ``StringIO``
00239 :param numpy: numpy python module
00240 """
00241 try:
00242 _x = self.poisonStamp.originator
00243 length = len(_x)
00244 if python3 or type(_x) == unicode:
00245 _x = _x.encode('utf-8')
00246 length = len(_x)
00247 buff.write(struct.pack('<I%ss'%length, length, _x))
00248 _x = self.poisonStamp.description
00249 length = len(_x)
00250 if python3 or type(_x) == unicode:
00251 _x = _x.encode('utf-8')
00252 length = len(_x)
00253 buff.write(struct.pack('<I%ss'%length, length, _x))
00254 buff.write(_struct_f.pack(self.poisonStamp.qos))
00255 length = len(self.dampings)
00256 buff.write(_struct_I.pack(length))
00257 for val1 in self.dampings:
00258 _v5 = val1.timeStamp
00259 _x = _v5
00260 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00261 _x = val1.joint_uri
00262 length = len(_x)
00263 if python3 or type(_x) == unicode:
00264 _x = _x.encode('utf-8')
00265 length = len(_x)
00266 buff.write(struct.pack('<I%ss'%length, length, _x))
00267 _x = val1.unit
00268 length = len(_x)
00269 if python3 or type(_x) == unicode:
00270 _x = _x.encode('utf-8')
00271 length = len(_x)
00272 buff.write(struct.pack('<I%ss'%length, length, _x))
00273 buff.write(_struct_d.pack(val1.value))
00274 length = len(self.stiffnesses)
00275 buff.write(_struct_I.pack(length))
00276 for val1 in self.stiffnesses:
00277 _v6 = val1.timeStamp
00278 _x = _v6
00279 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00280 _x = val1.joint_uri
00281 length = len(_x)
00282 if python3 or type(_x) == unicode:
00283 _x = _x.encode('utf-8')
00284 length = len(_x)
00285 buff.write(struct.pack('<I%ss'%length, length, _x))
00286 _x = val1.unit
00287 length = len(_x)
00288 if python3 or type(_x) == unicode:
00289 _x = _x.encode('utf-8')
00290 length = len(_x)
00291 buff.write(struct.pack('<I%ss'%length, length, _x))
00292 buff.write(_struct_d.pack(val1.value))
00293 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00294 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00295
00296 def deserialize_numpy(self, str, numpy):
00297 """
00298 unpack serialized message in str into this message instance using numpy for array types
00299 :param str: byte array of serialized message, ``str``
00300 :param numpy: numpy python module
00301 """
00302 try:
00303 if self.poisonStamp is None:
00304 self.poisonStamp = brics_actuator.msg.Poison()
00305 if self.dampings is None:
00306 self.dampings = None
00307 if self.stiffnesses is None:
00308 self.stiffnesses = None
00309 end = 0
00310 start = end
00311 end += 4
00312 (length,) = _struct_I.unpack(str[start:end])
00313 start = end
00314 end += length
00315 if python3:
00316 self.poisonStamp.originator = str[start:end].decode('utf-8')
00317 else:
00318 self.poisonStamp.originator = str[start:end]
00319 start = end
00320 end += 4
00321 (length,) = _struct_I.unpack(str[start:end])
00322 start = end
00323 end += length
00324 if python3:
00325 self.poisonStamp.description = str[start:end].decode('utf-8')
00326 else:
00327 self.poisonStamp.description = str[start:end]
00328 start = end
00329 end += 4
00330 (self.poisonStamp.qos,) = _struct_f.unpack(str[start:end])
00331 start = end
00332 end += 4
00333 (length,) = _struct_I.unpack(str[start:end])
00334 self.dampings = []
00335 for i in range(0, length):
00336 val1 = brics_actuator.msg.JointValue()
00337 _v7 = val1.timeStamp
00338 _x = _v7
00339 start = end
00340 end += 8
00341 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00342 start = end
00343 end += 4
00344 (length,) = _struct_I.unpack(str[start:end])
00345 start = end
00346 end += length
00347 if python3:
00348 val1.joint_uri = str[start:end].decode('utf-8')
00349 else:
00350 val1.joint_uri = str[start:end]
00351 start = end
00352 end += 4
00353 (length,) = _struct_I.unpack(str[start:end])
00354 start = end
00355 end += length
00356 if python3:
00357 val1.unit = str[start:end].decode('utf-8')
00358 else:
00359 val1.unit = str[start:end]
00360 start = end
00361 end += 8
00362 (val1.value,) = _struct_d.unpack(str[start:end])
00363 self.dampings.append(val1)
00364 start = end
00365 end += 4
00366 (length,) = _struct_I.unpack(str[start:end])
00367 self.stiffnesses = []
00368 for i in range(0, length):
00369 val1 = brics_actuator.msg.JointValue()
00370 _v8 = val1.timeStamp
00371 _x = _v8
00372 start = end
00373 end += 8
00374 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00375 start = end
00376 end += 4
00377 (length,) = _struct_I.unpack(str[start:end])
00378 start = end
00379 end += length
00380 if python3:
00381 val1.joint_uri = str[start:end].decode('utf-8')
00382 else:
00383 val1.joint_uri = str[start:end]
00384 start = end
00385 end += 4
00386 (length,) = _struct_I.unpack(str[start:end])
00387 start = end
00388 end += length
00389 if python3:
00390 val1.unit = str[start:end].decode('utf-8')
00391 else:
00392 val1.unit = str[start:end]
00393 start = end
00394 end += 8
00395 (val1.value,) = _struct_d.unpack(str[start:end])
00396 self.stiffnesses.append(val1)
00397 return self
00398 except struct.error as e:
00399 raise genpy.DeserializationError(e)
00400
00401 _struct_I = genpy.struct_I
00402 _struct_d = struct.Struct("<d")
00403 _struct_2I = struct.Struct("<2I")
00404 _struct_f = struct.Struct("<f")