_ObjectEvidence.py
Go to the documentation of this file.
00001 """autogenerated by genpy from wire_msgs/ObjectEvidence.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 
00010 class ObjectEvidence(genpy.Message):
00011   _md5sum = "77e95746f47f2a6173d16614abb68048"
00012   _type = "wire_msgs/ObjectEvidence"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """float64 certainty
00015 bool negative
00016 
00017 Property[] properties
00018 
00019 ================================================================================
00020 MSG: wire_msgs/Property
00021 string attribute
00022 problib/PDF pdf
00023 
00024 ================================================================================
00025 MSG: problib/PDF
00026 uint8 EXACT=0     # Is here for easier msg creation, but is actually a specialized case:
00027                   # - continuous: is a Gaussian with zero covariance
00028                   # - discrete: is a Discrete pdf with one entry with P=1                
00029 uint8 GAUSSIAN=1
00030 uint8 UNIFORM=2
00031 uint8 PARTICLES=3
00032 uint8 MIXTURE=4
00033 uint8 DISCRETE=5
00034 uint8 HYBRID=6
00035 
00036 uint8 type
00037 uint32 dimensions
00038 
00039 # For continuous pdf's
00040 float64[] data
00041 
00042 # For discrete pdf's (pmf)
00043 int32 domain_size
00044 string[] values
00045 float64[] probabilities
00046 
00047 # For exact values, either a string or a vector
00048 string exact_value_str
00049 float64[] exact_value_vec
00050 
00051 """
00052   __slots__ = ['certainty','negative','properties']
00053   _slot_types = ['float64','bool','wire_msgs/Property[]']
00054 
00055   def __init__(self, *args, **kwds):
00056     """
00057     Constructor. Any message fields that are implicitly/explicitly
00058     set to None will be assigned a default value. The recommend
00059     use is keyword arguments as this is more robust to future message
00060     changes.  You cannot mix in-order arguments and keyword arguments.
00061 
00062     The available fields are:
00063        certainty,negative,properties
00064 
00065     :param args: complete set of field values, in .msg order
00066     :param kwds: use keyword arguments corresponding to message field names
00067     to set specific fields.
00068     """
00069     if args or kwds:
00070       super(ObjectEvidence, self).__init__(*args, **kwds)
00071       #message fields cannot be None, assign default values for those that are
00072       if self.certainty is None:
00073         self.certainty = 0.
00074       if self.negative is None:
00075         self.negative = False
00076       if self.properties is None:
00077         self.properties = []
00078     else:
00079       self.certainty = 0.
00080       self.negative = False
00081       self.properties = []
00082 
00083   def _get_types(self):
00084     """
00085     internal API method
00086     """
00087     return self._slot_types
00088 
00089   def serialize(self, buff):
00090     """
00091     serialize message into buffer
00092     :param buff: buffer, ``StringIO``
00093     """
00094     try:
00095       _x = self
00096       buff.write(_struct_dB.pack(_x.certainty, _x.negative))
00097       length = len(self.properties)
00098       buff.write(_struct_I.pack(length))
00099       for val1 in self.properties:
00100         _x = val1.attribute
00101         length = len(_x)
00102         if python3 or type(_x) == unicode:
00103           _x = _x.encode('utf-8')
00104           length = len(_x)
00105         buff.write(struct.pack('<I%ss'%length, length, _x))
00106         _v1 = val1.pdf
00107         _x = _v1
00108         buff.write(_struct_BI.pack(_x.type, _x.dimensions))
00109         length = len(_v1.data)
00110         buff.write(_struct_I.pack(length))
00111         pattern = '<%sd'%length
00112         buff.write(struct.pack(pattern, *_v1.data))
00113         buff.write(_struct_i.pack(_v1.domain_size))
00114         length = len(_v1.values)
00115         buff.write(_struct_I.pack(length))
00116         for val3 in _v1.values:
00117           length = len(val3)
00118           if python3 or type(val3) == unicode:
00119             val3 = val3.encode('utf-8')
00120             length = len(val3)
00121           buff.write(struct.pack('<I%ss'%length, length, val3))
00122         length = len(_v1.probabilities)
00123         buff.write(_struct_I.pack(length))
00124         pattern = '<%sd'%length
00125         buff.write(struct.pack(pattern, *_v1.probabilities))
00126         _x = _v1.exact_value_str
00127         length = len(_x)
00128         if python3 or type(_x) == unicode:
00129           _x = _x.encode('utf-8')
00130           length = len(_x)
00131         buff.write(struct.pack('<I%ss'%length, length, _x))
00132         length = len(_v1.exact_value_vec)
00133         buff.write(_struct_I.pack(length))
00134         pattern = '<%sd'%length
00135         buff.write(struct.pack(pattern, *_v1.exact_value_vec))
00136     except struct.error as se: self._check_types(se)
00137     except TypeError as te: self._check_types(te)
00138 
00139   def deserialize(self, str):
00140     """
00141     unpack serialized message in str into this message instance
00142     :param str: byte array of serialized message, ``str``
00143     """
00144     try:
00145       if self.properties is None:
00146         self.properties = None
00147       end = 0
00148       _x = self
00149       start = end
00150       end += 9
00151       (_x.certainty, _x.negative,) = _struct_dB.unpack(str[start:end])
00152       self.negative = bool(self.negative)
00153       start = end
00154       end += 4
00155       (length,) = _struct_I.unpack(str[start:end])
00156       self.properties = []
00157       for i in range(0, length):
00158         val1 = wire_msgs.msg.Property()
00159         start = end
00160         end += 4
00161         (length,) = _struct_I.unpack(str[start:end])
00162         start = end
00163         end += length
00164         if python3:
00165           val1.attribute = str[start:end].decode('utf-8')
00166         else:
00167           val1.attribute = str[start:end]
00168         _v2 = val1.pdf
00169         _x = _v2
00170         start = end
00171         end += 5
00172         (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00173         start = end
00174         end += 4
00175         (length,) = _struct_I.unpack(str[start:end])
00176         pattern = '<%sd'%length
00177         start = end
00178         end += struct.calcsize(pattern)
00179         _v2.data = struct.unpack(pattern, str[start:end])
00180         start = end
00181         end += 4
00182         (_v2.domain_size,) = _struct_i.unpack(str[start:end])
00183         start = end
00184         end += 4
00185         (length,) = _struct_I.unpack(str[start:end])
00186         _v2.values = []
00187         for i in range(0, length):
00188           start = end
00189           end += 4
00190           (length,) = _struct_I.unpack(str[start:end])
00191           start = end
00192           end += length
00193           if python3:
00194             val3 = str[start:end].decode('utf-8')
00195           else:
00196             val3 = str[start:end]
00197           _v2.values.append(val3)
00198         start = end
00199         end += 4
00200         (length,) = _struct_I.unpack(str[start:end])
00201         pattern = '<%sd'%length
00202         start = end
00203         end += struct.calcsize(pattern)
00204         _v2.probabilities = struct.unpack(pattern, str[start:end])
00205         start = end
00206         end += 4
00207         (length,) = _struct_I.unpack(str[start:end])
00208         start = end
00209         end += length
00210         if python3:
00211           _v2.exact_value_str = str[start:end].decode('utf-8')
00212         else:
00213           _v2.exact_value_str = str[start:end]
00214         start = end
00215         end += 4
00216         (length,) = _struct_I.unpack(str[start:end])
00217         pattern = '<%sd'%length
00218         start = end
00219         end += struct.calcsize(pattern)
00220         _v2.exact_value_vec = struct.unpack(pattern, str[start:end])
00221         self.properties.append(val1)
00222       return self
00223     except struct.error as e:
00224       raise genpy.DeserializationError(e) #most likely buffer underfill
00225 
00226 
00227   def serialize_numpy(self, buff, numpy):
00228     """
00229     serialize message with numpy array types into buffer
00230     :param buff: buffer, ``StringIO``
00231     :param numpy: numpy python module
00232     """
00233     try:
00234       _x = self
00235       buff.write(_struct_dB.pack(_x.certainty, _x.negative))
00236       length = len(self.properties)
00237       buff.write(_struct_I.pack(length))
00238       for val1 in self.properties:
00239         _x = val1.attribute
00240         length = len(_x)
00241         if python3 or type(_x) == unicode:
00242           _x = _x.encode('utf-8')
00243           length = len(_x)
00244         buff.write(struct.pack('<I%ss'%length, length, _x))
00245         _v3 = val1.pdf
00246         _x = _v3
00247         buff.write(_struct_BI.pack(_x.type, _x.dimensions))
00248         length = len(_v3.data)
00249         buff.write(_struct_I.pack(length))
00250         pattern = '<%sd'%length
00251         buff.write(_v3.data.tostring())
00252         buff.write(_struct_i.pack(_v3.domain_size))
00253         length = len(_v3.values)
00254         buff.write(_struct_I.pack(length))
00255         for val3 in _v3.values:
00256           length = len(val3)
00257           if python3 or type(val3) == unicode:
00258             val3 = val3.encode('utf-8')
00259             length = len(val3)
00260           buff.write(struct.pack('<I%ss'%length, length, val3))
00261         length = len(_v3.probabilities)
00262         buff.write(_struct_I.pack(length))
00263         pattern = '<%sd'%length
00264         buff.write(_v3.probabilities.tostring())
00265         _x = _v3.exact_value_str
00266         length = len(_x)
00267         if python3 or type(_x) == unicode:
00268           _x = _x.encode('utf-8')
00269           length = len(_x)
00270         buff.write(struct.pack('<I%ss'%length, length, _x))
00271         length = len(_v3.exact_value_vec)
00272         buff.write(_struct_I.pack(length))
00273         pattern = '<%sd'%length
00274         buff.write(_v3.exact_value_vec.tostring())
00275     except struct.error as se: self._check_types(se)
00276     except TypeError as te: self._check_types(te)
00277 
00278   def deserialize_numpy(self, str, numpy):
00279     """
00280     unpack serialized message in str into this message instance using numpy for array types
00281     :param str: byte array of serialized message, ``str``
00282     :param numpy: numpy python module
00283     """
00284     try:
00285       if self.properties is None:
00286         self.properties = None
00287       end = 0
00288       _x = self
00289       start = end
00290       end += 9
00291       (_x.certainty, _x.negative,) = _struct_dB.unpack(str[start:end])
00292       self.negative = bool(self.negative)
00293       start = end
00294       end += 4
00295       (length,) = _struct_I.unpack(str[start:end])
00296       self.properties = []
00297       for i in range(0, length):
00298         val1 = wire_msgs.msg.Property()
00299         start = end
00300         end += 4
00301         (length,) = _struct_I.unpack(str[start:end])
00302         start = end
00303         end += length
00304         if python3:
00305           val1.attribute = str[start:end].decode('utf-8')
00306         else:
00307           val1.attribute = str[start:end]
00308         _v4 = val1.pdf
00309         _x = _v4
00310         start = end
00311         end += 5
00312         (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end])
00313         start = end
00314         end += 4
00315         (length,) = _struct_I.unpack(str[start:end])
00316         pattern = '<%sd'%length
00317         start = end
00318         end += struct.calcsize(pattern)
00319         _v4.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00320         start = end
00321         end += 4
00322         (_v4.domain_size,) = _struct_i.unpack(str[start:end])
00323         start = end
00324         end += 4
00325         (length,) = _struct_I.unpack(str[start:end])
00326         _v4.values = []
00327         for i in range(0, length):
00328           start = end
00329           end += 4
00330           (length,) = _struct_I.unpack(str[start:end])
00331           start = end
00332           end += length
00333           if python3:
00334             val3 = str[start:end].decode('utf-8')
00335           else:
00336             val3 = str[start:end]
00337           _v4.values.append(val3)
00338         start = end
00339         end += 4
00340         (length,) = _struct_I.unpack(str[start:end])
00341         pattern = '<%sd'%length
00342         start = end
00343         end += struct.calcsize(pattern)
00344         _v4.probabilities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00345         start = end
00346         end += 4
00347         (length,) = _struct_I.unpack(str[start:end])
00348         start = end
00349         end += length
00350         if python3:
00351           _v4.exact_value_str = str[start:end].decode('utf-8')
00352         else:
00353           _v4.exact_value_str = str[start:end]
00354         start = end
00355         end += 4
00356         (length,) = _struct_I.unpack(str[start:end])
00357         pattern = '<%sd'%length
00358         start = end
00359         end += struct.calcsize(pattern)
00360         _v4.exact_value_vec = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00361         self.properties.append(val1)
00362       return self
00363     except struct.error as e:
00364       raise genpy.DeserializationError(e) #most likely buffer underfill
00365 
00366 _struct_I = genpy.struct_I
00367 _struct_i = struct.Struct("<i")
00368 _struct_dB = struct.Struct("<dB")
00369 _struct_BI = struct.Struct("<BI")


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