_WorldEvidence.py
Go to the documentation of this file.
00001 """autogenerated by genpy from wire_msgs/WorldEvidence.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 WorldEvidence(genpy.Message):
00012   _md5sum = "3e1294571cc4e4e17ce4b1d2768db636"
00013   _type = "wire_msgs/WorldEvidence"
00014   _has_header = True #flag to mark the presence of a Header object
00015   _full_text = """Header header
00016 ObjectEvidence[] object_evidence
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/ObjectEvidence
00038 float64 certainty
00039 bool negative
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','object_evidence']
00077   _slot_types = ['std_msgs/Header','wire_msgs/ObjectEvidence[]']
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,object_evidence
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(WorldEvidence, self).__init__(*args, **kwds)
00095       #message fields cannot be None, assign default values for those that are
00096       if self.header is None:
00097         self.header = std_msgs.msg.Header()
00098       if self.object_evidence is None:
00099         self.object_evidence = []
00100     else:
00101       self.header = std_msgs.msg.Header()
00102       self.object_evidence = []
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.object_evidence)
00125       buff.write(_struct_I.pack(length))
00126       for val1 in self.object_evidence:
00127         _x = val1
00128         buff.write(_struct_dB.pack(_x.certainty, _x.negative))
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.object_evidence is None:
00180         self.object_evidence = 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.object_evidence = []
00199       for i in range(0, length):
00200         val1 = wire_msgs.msg.ObjectEvidence()
00201         _x = val1
00202         start = end
00203         end += 9
00204         (_x.certainty, _x.negative,) = _struct_dB.unpack(str[start:end])
00205         val1.negative = bool(val1.negative)
00206         start = end
00207         end += 4
00208         (length,) = _struct_I.unpack(str[start:end])
00209         val1.properties = []
00210         for i in range(0, length):
00211           val2 = wire_msgs.msg.Property()
00212           start = end
00213           end += 4
00214           (length,) = _struct_I.unpack(str[start:end])
00215           start = end
00216           end += length
00217           if python3:
00218             val2.attribute = str[start:end].decode('utf-8')
00219           else:
00220             val2.attribute = str[start:end]
00221           _v2 = val2.pdf
00222           _x = _v2
00223           start = end
00224           end += 5
00225           (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00226           start = end
00227           end += 4
00228           (length,) = _struct_I.unpack(str[start:end])
00229           pattern = '<%sd'%length
00230           start = end
00231           end += struct.calcsize(pattern)
00232           _v2.data = struct.unpack(pattern, str[start:end])
00233           start = end
00234           end += 4
00235           (_v2.domain_size,) = _struct_i.unpack(str[start:end])
00236           start = end
00237           end += 4
00238           (length,) = _struct_I.unpack(str[start:end])
00239           _v2.values = []
00240           for i in range(0, length):
00241             start = end
00242             end += 4
00243             (length,) = _struct_I.unpack(str[start:end])
00244             start = end
00245             end += length
00246             if python3:
00247               val4 = str[start:end].decode('utf-8')
00248             else:
00249               val4 = str[start:end]
00250             _v2.values.append(val4)
00251           start = end
00252           end += 4
00253           (length,) = _struct_I.unpack(str[start:end])
00254           pattern = '<%sd'%length
00255           start = end
00256           end += struct.calcsize(pattern)
00257           _v2.probabilities = struct.unpack(pattern, str[start:end])
00258           start = end
00259           end += 4
00260           (length,) = _struct_I.unpack(str[start:end])
00261           start = end
00262           end += length
00263           if python3:
00264             _v2.exact_value_str = str[start:end].decode('utf-8')
00265           else:
00266             _v2.exact_value_str = str[start:end]
00267           start = end
00268           end += 4
00269           (length,) = _struct_I.unpack(str[start:end])
00270           pattern = '<%sd'%length
00271           start = end
00272           end += struct.calcsize(pattern)
00273           _v2.exact_value_vec = struct.unpack(pattern, str[start:end])
00274           val1.properties.append(val2)
00275         self.object_evidence.append(val1)
00276       return self
00277     except struct.error as e:
00278       raise genpy.DeserializationError(e) #most likely buffer underfill
00279 
00280 
00281   def serialize_numpy(self, buff, numpy):
00282     """
00283     serialize message with numpy array types into buffer
00284     :param buff: buffer, ``StringIO``
00285     :param numpy: numpy python module
00286     """
00287     try:
00288       _x = self
00289       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00290       _x = self.header.frame_id
00291       length = len(_x)
00292       if python3 or type(_x) == unicode:
00293         _x = _x.encode('utf-8')
00294         length = len(_x)
00295       buff.write(struct.pack('<I%ss'%length, length, _x))
00296       length = len(self.object_evidence)
00297       buff.write(_struct_I.pack(length))
00298       for val1 in self.object_evidence:
00299         _x = val1
00300         buff.write(_struct_dB.pack(_x.certainty, _x.negative))
00301         length = len(val1.properties)
00302         buff.write(_struct_I.pack(length))
00303         for val2 in val1.properties:
00304           _x = val2.attribute
00305           length = len(_x)
00306           if python3 or type(_x) == unicode:
00307             _x = _x.encode('utf-8')
00308             length = len(_x)
00309           buff.write(struct.pack('<I%ss'%length, length, _x))
00310           _v3 = val2.pdf
00311           _x = _v3
00312           buff.write(_struct_BI.pack(_x.type, _x.dimensions))
00313           length = len(_v3.data)
00314           buff.write(_struct_I.pack(length))
00315           pattern = '<%sd'%length
00316           buff.write(_v3.data.tostring())
00317           buff.write(_struct_i.pack(_v3.domain_size))
00318           length = len(_v3.values)
00319           buff.write(_struct_I.pack(length))
00320           for val4 in _v3.values:
00321             length = len(val4)
00322             if python3 or type(val4) == unicode:
00323               val4 = val4.encode('utf-8')
00324               length = len(val4)
00325             buff.write(struct.pack('<I%ss'%length, length, val4))
00326           length = len(_v3.probabilities)
00327           buff.write(_struct_I.pack(length))
00328           pattern = '<%sd'%length
00329           buff.write(_v3.probabilities.tostring())
00330           _x = _v3.exact_value_str
00331           length = len(_x)
00332           if python3 or type(_x) == unicode:
00333             _x = _x.encode('utf-8')
00334             length = len(_x)
00335           buff.write(struct.pack('<I%ss'%length, length, _x))
00336           length = len(_v3.exact_value_vec)
00337           buff.write(_struct_I.pack(length))
00338           pattern = '<%sd'%length
00339           buff.write(_v3.exact_value_vec.tostring())
00340     except struct.error as se: self._check_types(se)
00341     except TypeError as te: self._check_types(te)
00342 
00343   def deserialize_numpy(self, str, numpy):
00344     """
00345     unpack serialized message in str into this message instance using numpy for array types
00346     :param str: byte array of serialized message, ``str``
00347     :param numpy: numpy python module
00348     """
00349     try:
00350       if self.header is None:
00351         self.header = std_msgs.msg.Header()
00352       if self.object_evidence is None:
00353         self.object_evidence = None
00354       end = 0
00355       _x = self
00356       start = end
00357       end += 12
00358       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00359       start = end
00360       end += 4
00361       (length,) = _struct_I.unpack(str[start:end])
00362       start = end
00363       end += length
00364       if python3:
00365         self.header.frame_id = str[start:end].decode('utf-8')
00366       else:
00367         self.header.frame_id = str[start:end]
00368       start = end
00369       end += 4
00370       (length,) = _struct_I.unpack(str[start:end])
00371       self.object_evidence = []
00372       for i in range(0, length):
00373         val1 = wire_msgs.msg.ObjectEvidence()
00374         _x = val1
00375         start = end
00376         end += 9
00377         (_x.certainty, _x.negative,) = _struct_dB.unpack(str[start:end])
00378         val1.negative = bool(val1.negative)
00379         start = end
00380         end += 4
00381         (length,) = _struct_I.unpack(str[start:end])
00382         val1.properties = []
00383         for i in range(0, length):
00384           val2 = wire_msgs.msg.Property()
00385           start = end
00386           end += 4
00387           (length,) = _struct_I.unpack(str[start:end])
00388           start = end
00389           end += length
00390           if python3:
00391             val2.attribute = str[start:end].decode('utf-8')
00392           else:
00393             val2.attribute = str[start:end]
00394           _v4 = val2.pdf
00395           _x = _v4
00396           start = end
00397           end += 5
00398           (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00399           start = end
00400           end += 4
00401           (length,) = _struct_I.unpack(str[start:end])
00402           pattern = '<%sd'%length
00403           start = end
00404           end += struct.calcsize(pattern)
00405           _v4.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00406           start = end
00407           end += 4
00408           (_v4.domain_size,) = _struct_i.unpack(str[start:end])
00409           start = end
00410           end += 4
00411           (length,) = _struct_I.unpack(str[start:end])
00412           _v4.values = []
00413           for i in range(0, length):
00414             start = end
00415             end += 4
00416             (length,) = _struct_I.unpack(str[start:end])
00417             start = end
00418             end += length
00419             if python3:
00420               val4 = str[start:end].decode('utf-8')
00421             else:
00422               val4 = str[start:end]
00423             _v4.values.append(val4)
00424           start = end
00425           end += 4
00426           (length,) = _struct_I.unpack(str[start:end])
00427           pattern = '<%sd'%length
00428           start = end
00429           end += struct.calcsize(pattern)
00430           _v4.probabilities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00431           start = end
00432           end += 4
00433           (length,) = _struct_I.unpack(str[start:end])
00434           start = end
00435           end += length
00436           if python3:
00437             _v4.exact_value_str = str[start:end].decode('utf-8')
00438           else:
00439             _v4.exact_value_str = str[start:end]
00440           start = end
00441           end += 4
00442           (length,) = _struct_I.unpack(str[start:end])
00443           pattern = '<%sd'%length
00444           start = end
00445           end += struct.calcsize(pattern)
00446           _v4.exact_value_vec = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00447           val1.properties.append(val2)
00448         self.object_evidence.append(val1)
00449       return self
00450     except struct.error as e:
00451       raise genpy.DeserializationError(e) #most likely buffer underfill
00452 
00453 _struct_I = genpy.struct_I
00454 _struct_i = struct.Struct("<i")
00455 _struct_3I = struct.Struct("<3I")
00456 _struct_dB = struct.Struct("<dB")
00457 _struct_BI = struct.Struct("<BI")


wire_msgs
Author(s): Sjoerd van den Dries
autogenerated on Tue Jan 7 2014 11:42:56