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