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