00001 """autogenerated by genpy from wire_msgs/WorldState.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 wire_msgs.msg
00008 import problib.msg
00009 import std_msgs.msg
00010
00011 class WorldState(genpy.Message):
00012 _md5sum = "cbb30658c5399203b49098926c4c30ed"
00013 _type = "wire_msgs/WorldState"
00014 _has_header = True
00015 _full_text = """Header header
00016 ObjectState[] objects
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 ================================================================================
00037 MSG: wire_msgs/ObjectState
00038 uint32 ID
00039 float64 probability # probability that this object is actually in the world
00040
00041 Property[] properties
00042
00043 ================================================================================
00044 MSG: wire_msgs/Property
00045 string attribute
00046 problib/PDF pdf
00047
00048 ================================================================================
00049 MSG: problib/PDF
00050 uint8 EXACT=0 # Is here for easier msg creation, but is actually a specialized case:
00051 # - continuous: is a Gaussian with zero covariance
00052 # - discrete: is a Discrete pdf with one entry with P=1
00053 uint8 GAUSSIAN=1
00054 uint8 UNIFORM=2
00055 uint8 PARTICLES=3
00056 uint8 MIXTURE=4
00057 uint8 DISCRETE=5
00058 uint8 HYBRID=6
00059
00060 uint8 type
00061 uint32 dimensions
00062
00063 # For continuous pdf's
00064 float64[] data
00065
00066 # For discrete pdf's (pmf)
00067 int32 domain_size
00068 string[] values
00069 float64[] probabilities
00070
00071 # For exact values, either a string or a vector
00072 string exact_value_str
00073 float64[] exact_value_vec
00074
00075 """
00076 __slots__ = ['header','objects']
00077 _slot_types = ['std_msgs/Header','wire_msgs/ObjectState[]']
00078
00079 def __init__(self, *args, **kwds):
00080 """
00081 Constructor. Any message fields that are implicitly/explicitly
00082 set to None will be assigned a default value. The recommend
00083 use is keyword arguments as this is more robust to future message
00084 changes. You cannot mix in-order arguments and keyword arguments.
00085
00086 The available fields are:
00087 header,objects
00088
00089 :param args: complete set of field values, in .msg order
00090 :param kwds: use keyword arguments corresponding to message field names
00091 to set specific fields.
00092 """
00093 if args or kwds:
00094 super(WorldState, self).__init__(*args, **kwds)
00095
00096 if self.header is None:
00097 self.header = std_msgs.msg.Header()
00098 if self.objects is None:
00099 self.objects = []
00100 else:
00101 self.header = std_msgs.msg.Header()
00102 self.objects = []
00103
00104 def _get_types(self):
00105 """
00106 internal API method
00107 """
00108 return self._slot_types
00109
00110 def serialize(self, buff):
00111 """
00112 serialize message into buffer
00113 :param buff: buffer, ``StringIO``
00114 """
00115 try:
00116 _x = self
00117 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00118 _x = self.header.frame_id
00119 length = len(_x)
00120 if python3 or type(_x) == unicode:
00121 _x = _x.encode('utf-8')
00122 length = len(_x)
00123 buff.write(struct.pack('<I%ss'%length, length, _x))
00124 length = len(self.objects)
00125 buff.write(_struct_I.pack(length))
00126 for val1 in self.objects:
00127 _x = val1
00128 buff.write(_struct_Id.pack(_x.ID, _x.probability))
00129 length = len(val1.properties)
00130 buff.write(_struct_I.pack(length))
00131 for val2 in val1.properties:
00132 _x = val2.attribute
00133 length = len(_x)
00134 if python3 or type(_x) == unicode:
00135 _x = _x.encode('utf-8')
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 _v1 = val2.pdf
00139 _x = _v1
00140 buff.write(_struct_BI.pack(_x.type, _x.dimensions))
00141 length = len(_v1.data)
00142 buff.write(_struct_I.pack(length))
00143 pattern = '<%sd'%length
00144 buff.write(struct.pack(pattern, *_v1.data))
00145 buff.write(_struct_i.pack(_v1.domain_size))
00146 length = len(_v1.values)
00147 buff.write(_struct_I.pack(length))
00148 for val4 in _v1.values:
00149 length = len(val4)
00150 if python3 or type(val4) == unicode:
00151 val4 = val4.encode('utf-8')
00152 length = len(val4)
00153 buff.write(struct.pack('<I%ss'%length, length, val4))
00154 length = len(_v1.probabilities)
00155 buff.write(_struct_I.pack(length))
00156 pattern = '<%sd'%length
00157 buff.write(struct.pack(pattern, *_v1.probabilities))
00158 _x = _v1.exact_value_str
00159 length = len(_x)
00160 if python3 or type(_x) == unicode:
00161 _x = _x.encode('utf-8')
00162 length = len(_x)
00163 buff.write(struct.pack('<I%ss'%length, length, _x))
00164 length = len(_v1.exact_value_vec)
00165 buff.write(_struct_I.pack(length))
00166 pattern = '<%sd'%length
00167 buff.write(struct.pack(pattern, *_v1.exact_value_vec))
00168 except struct.error as se: self._check_types(se)
00169 except TypeError as te: self._check_types(te)
00170
00171 def deserialize(self, str):
00172 """
00173 unpack serialized message in str into this message instance
00174 :param str: byte array of serialized message, ``str``
00175 """
00176 try:
00177 if self.header is None:
00178 self.header = std_msgs.msg.Header()
00179 if self.objects is None:
00180 self.objects = None
00181 end = 0
00182 _x = self
00183 start = end
00184 end += 12
00185 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 start = end
00190 end += length
00191 if python3:
00192 self.header.frame_id = str[start:end].decode('utf-8')
00193 else:
00194 self.header.frame_id = str[start:end]
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 self.objects = []
00199 for i in range(0, length):
00200 val1 = wire_msgs.msg.ObjectState()
00201 _x = val1
00202 start = end
00203 end += 12
00204 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end])
00205 start = end
00206 end += 4
00207 (length,) = _struct_I.unpack(str[start:end])
00208 val1.properties = []
00209 for i in range(0, length):
00210 val2 = wire_msgs.msg.Property()
00211 start = end
00212 end += 4
00213 (length,) = _struct_I.unpack(str[start:end])
00214 start = end
00215 end += length
00216 if python3:
00217 val2.attribute = str[start:end].decode('utf-8')
00218 else:
00219 val2.attribute = str[start:end]
00220 _v2 = val2.pdf
00221 _x = _v2
00222 start = end
00223 end += 5
00224 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00225 start = end
00226 end += 4
00227 (length,) = _struct_I.unpack(str[start:end])
00228 pattern = '<%sd'%length
00229 start = end
00230 end += struct.calcsize(pattern)
00231 _v2.data = struct.unpack(pattern, str[start:end])
00232 start = end
00233 end += 4
00234 (_v2.domain_size,) = _struct_i.unpack(str[start:end])
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 _v2.values = []
00239 for i in range(0, length):
00240 start = end
00241 end += 4
00242 (length,) = _struct_I.unpack(str[start:end])
00243 start = end
00244 end += length
00245 if python3:
00246 val4 = str[start:end].decode('utf-8')
00247 else:
00248 val4 = str[start:end]
00249 _v2.values.append(val4)
00250 start = end
00251 end += 4
00252 (length,) = _struct_I.unpack(str[start:end])
00253 pattern = '<%sd'%length
00254 start = end
00255 end += struct.calcsize(pattern)
00256 _v2.probabilities = struct.unpack(pattern, str[start:end])
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 start = end
00261 end += length
00262 if python3:
00263 _v2.exact_value_str = str[start:end].decode('utf-8')
00264 else:
00265 _v2.exact_value_str = str[start:end]
00266 start = end
00267 end += 4
00268 (length,) = _struct_I.unpack(str[start:end])
00269 pattern = '<%sd'%length
00270 start = end
00271 end += struct.calcsize(pattern)
00272 _v2.exact_value_vec = struct.unpack(pattern, str[start:end])
00273 val1.properties.append(val2)
00274 self.objects.append(val1)
00275 return self
00276 except struct.error as e:
00277 raise genpy.DeserializationError(e)
00278
00279
00280 def serialize_numpy(self, buff, numpy):
00281 """
00282 serialize message with numpy array types into buffer
00283 :param buff: buffer, ``StringIO``
00284 :param numpy: numpy python module
00285 """
00286 try:
00287 _x = self
00288 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00289 _x = self.header.frame_id
00290 length = len(_x)
00291 if python3 or type(_x) == unicode:
00292 _x = _x.encode('utf-8')
00293 length = len(_x)
00294 buff.write(struct.pack('<I%ss'%length, length, _x))
00295 length = len(self.objects)
00296 buff.write(_struct_I.pack(length))
00297 for val1 in self.objects:
00298 _x = val1
00299 buff.write(_struct_Id.pack(_x.ID, _x.probability))
00300 length = len(val1.properties)
00301 buff.write(_struct_I.pack(length))
00302 for val2 in val1.properties:
00303 _x = val2.attribute
00304 length = len(_x)
00305 if python3 or type(_x) == unicode:
00306 _x = _x.encode('utf-8')
00307 length = len(_x)
00308 buff.write(struct.pack('<I%ss'%length, length, _x))
00309 _v3 = val2.pdf
00310 _x = _v3
00311 buff.write(_struct_BI.pack(_x.type, _x.dimensions))
00312 length = len(_v3.data)
00313 buff.write(_struct_I.pack(length))
00314 pattern = '<%sd'%length
00315 buff.write(_v3.data.tostring())
00316 buff.write(_struct_i.pack(_v3.domain_size))
00317 length = len(_v3.values)
00318 buff.write(_struct_I.pack(length))
00319 for val4 in _v3.values:
00320 length = len(val4)
00321 if python3 or type(val4) == unicode:
00322 val4 = val4.encode('utf-8')
00323 length = len(val4)
00324 buff.write(struct.pack('<I%ss'%length, length, val4))
00325 length = len(_v3.probabilities)
00326 buff.write(_struct_I.pack(length))
00327 pattern = '<%sd'%length
00328 buff.write(_v3.probabilities.tostring())
00329 _x = _v3.exact_value_str
00330 length = len(_x)
00331 if python3 or type(_x) == unicode:
00332 _x = _x.encode('utf-8')
00333 length = len(_x)
00334 buff.write(struct.pack('<I%ss'%length, length, _x))
00335 length = len(_v3.exact_value_vec)
00336 buff.write(_struct_I.pack(length))
00337 pattern = '<%sd'%length
00338 buff.write(_v3.exact_value_vec.tostring())
00339 except struct.error as se: self._check_types(se)
00340 except TypeError as te: self._check_types(te)
00341
00342 def deserialize_numpy(self, str, numpy):
00343 """
00344 unpack serialized message in str into this message instance using numpy for array types
00345 :param str: byte array of serialized message, ``str``
00346 :param numpy: numpy python module
00347 """
00348 try:
00349 if self.header is None:
00350 self.header = std_msgs.msg.Header()
00351 if self.objects is None:
00352 self.objects = None
00353 end = 0
00354 _x = self
00355 start = end
00356 end += 12
00357 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00358 start = end
00359 end += 4
00360 (length,) = _struct_I.unpack(str[start:end])
00361 start = end
00362 end += length
00363 if python3:
00364 self.header.frame_id = str[start:end].decode('utf-8')
00365 else:
00366 self.header.frame_id = str[start:end]
00367 start = end
00368 end += 4
00369 (length,) = _struct_I.unpack(str[start:end])
00370 self.objects = []
00371 for i in range(0, length):
00372 val1 = wire_msgs.msg.ObjectState()
00373 _x = val1
00374 start = end
00375 end += 12
00376 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end])
00377 start = end
00378 end += 4
00379 (length,) = _struct_I.unpack(str[start:end])
00380 val1.properties = []
00381 for i in range(0, length):
00382 val2 = wire_msgs.msg.Property()
00383 start = end
00384 end += 4
00385 (length,) = _struct_I.unpack(str[start:end])
00386 start = end
00387 end += length
00388 if python3:
00389 val2.attribute = str[start:end].decode('utf-8')
00390 else:
00391 val2.attribute = str[start:end]
00392 _v4 = val2.pdf
00393 _x = _v4
00394 start = end
00395 end += 5
00396 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00397 start = end
00398 end += 4
00399 (length,) = _struct_I.unpack(str[start:end])
00400 pattern = '<%sd'%length
00401 start = end
00402 end += struct.calcsize(pattern)
00403 _v4.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00404 start = end
00405 end += 4
00406 (_v4.domain_size,) = _struct_i.unpack(str[start:end])
00407 start = end
00408 end += 4
00409 (length,) = _struct_I.unpack(str[start:end])
00410 _v4.values = []
00411 for i in range(0, length):
00412 start = end
00413 end += 4
00414 (length,) = _struct_I.unpack(str[start:end])
00415 start = end
00416 end += length
00417 if python3:
00418 val4 = str[start:end].decode('utf-8')
00419 else:
00420 val4 = str[start:end]
00421 _v4.values.append(val4)
00422 start = end
00423 end += 4
00424 (length,) = _struct_I.unpack(str[start:end])
00425 pattern = '<%sd'%length
00426 start = end
00427 end += struct.calcsize(pattern)
00428 _v4.probabilities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00429 start = end
00430 end += 4
00431 (length,) = _struct_I.unpack(str[start:end])
00432 start = end
00433 end += length
00434 if python3:
00435 _v4.exact_value_str = str[start:end].decode('utf-8')
00436 else:
00437 _v4.exact_value_str = str[start:end]
00438 start = end
00439 end += 4
00440 (length,) = _struct_I.unpack(str[start:end])
00441 pattern = '<%sd'%length
00442 start = end
00443 end += struct.calcsize(pattern)
00444 _v4.exact_value_vec = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00445 val1.properties.append(val2)
00446 self.objects.append(val1)
00447 return self
00448 except struct.error as e:
00449 raise genpy.DeserializationError(e)
00450
00451 _struct_I = genpy.struct_I
00452 _struct_i = struct.Struct("<i")
00453 _struct_3I = struct.Struct("<3I")
00454 _struct_Id = struct.Struct("<Id")
00455 _struct_BI = struct.Struct("<BI")