$search
00001 """autogenerated by genmsg_py from WorldState.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 WorldState(roslib.message.Message): 00010 _md5sum = "cbb30658c5399203b49098926c4c30ed" 00011 _type = "wire_msgs/WorldState" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """Header header 00014 ObjectState[] objects 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/ObjectState 00036 uint32 ID 00037 float64 probability # probability that this object is actually in the world 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','objects'] 00075 _slot_types = ['Header','wire_msgs/ObjectState[]'] 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,objects 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(WorldState, 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.objects is None: 00097 self.objects = [] 00098 else: 00099 self.header = std_msgs.msg._Header.Header() 00100 self.objects = [] 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.objects) 00121 buff.write(_struct_I.pack(length)) 00122 for val1 in self.objects: 00123 _x = val1 00124 buff.write(_struct_Id.pack(_x.ID, _x.probability)) 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.objects = [] 00182 for i in range(0, length): 00183 val1 = wire_msgs.msg.ObjectState() 00184 _x = val1 00185 start = end 00186 end += 12 00187 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end]) 00188 start = end 00189 end += 4 00190 (length,) = _struct_I.unpack(str[start:end]) 00191 val1.properties = [] 00192 for i in range(0, length): 00193 val2 = wire_msgs.msg.Property() 00194 start = end 00195 end += 4 00196 (length,) = _struct_I.unpack(str[start:end]) 00197 start = end 00198 end += length 00199 val2.attribute = str[start:end] 00200 _v2 = val2.pdf 00201 _x = _v2 00202 start = end 00203 end += 5 00204 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end]) 00205 start = end 00206 end += 4 00207 (length,) = _struct_I.unpack(str[start:end]) 00208 pattern = '<%sd'%length 00209 start = end 00210 end += struct.calcsize(pattern) 00211 _v2.data = struct.unpack(pattern, str[start:end]) 00212 start = end 00213 end += 4 00214 (_v2.domain_size,) = _struct_i.unpack(str[start:end]) 00215 start = end 00216 end += 4 00217 (length,) = _struct_I.unpack(str[start:end]) 00218 _v2.values = [] 00219 for i in range(0, length): 00220 start = end 00221 end += 4 00222 (length,) = _struct_I.unpack(str[start:end]) 00223 start = end 00224 end += length 00225 val4 = str[start:end] 00226 _v2.values.append(val4) 00227 start = end 00228 end += 4 00229 (length,) = _struct_I.unpack(str[start:end]) 00230 pattern = '<%sd'%length 00231 start = end 00232 end += struct.calcsize(pattern) 00233 _v2.probabilities = struct.unpack(pattern, str[start:end]) 00234 start = end 00235 end += 4 00236 (length,) = _struct_I.unpack(str[start:end]) 00237 start = end 00238 end += length 00239 _v2.exact_value_str = str[start:end] 00240 start = end 00241 end += 4 00242 (length,) = _struct_I.unpack(str[start:end]) 00243 pattern = '<%sd'%length 00244 start = end 00245 end += struct.calcsize(pattern) 00246 _v2.exact_value_vec = struct.unpack(pattern, str[start:end]) 00247 val1.properties.append(val2) 00248 self.objects.append(val1) 00249 return self 00250 except struct.error as e: 00251 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00252 00253 00254 def serialize_numpy(self, buff, numpy): 00255 """ 00256 serialize message with numpy array types into buffer 00257 @param buff: buffer 00258 @type buff: StringIO 00259 @param numpy: numpy python module 00260 @type numpy module 00261 """ 00262 try: 00263 _x = self 00264 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00265 _x = self.header.frame_id 00266 length = len(_x) 00267 buff.write(struct.pack('<I%ss'%length, length, _x)) 00268 length = len(self.objects) 00269 buff.write(_struct_I.pack(length)) 00270 for val1 in self.objects: 00271 _x = val1 00272 buff.write(_struct_Id.pack(_x.ID, _x.probability)) 00273 length = len(val1.properties) 00274 buff.write(_struct_I.pack(length)) 00275 for val2 in val1.properties: 00276 _x = val2.attribute 00277 length = len(_x) 00278 buff.write(struct.pack('<I%ss'%length, length, _x)) 00279 _v3 = val2.pdf 00280 _x = _v3 00281 buff.write(_struct_BI.pack(_x.type, _x.dimensions)) 00282 length = len(_v3.data) 00283 buff.write(_struct_I.pack(length)) 00284 pattern = '<%sd'%length 00285 buff.write(_v3.data.tostring()) 00286 buff.write(_struct_i.pack(_v3.domain_size)) 00287 length = len(_v3.values) 00288 buff.write(_struct_I.pack(length)) 00289 for val4 in _v3.values: 00290 length = len(val4) 00291 buff.write(struct.pack('<I%ss'%length, length, val4)) 00292 length = len(_v3.probabilities) 00293 buff.write(_struct_I.pack(length)) 00294 pattern = '<%sd'%length 00295 buff.write(_v3.probabilities.tostring()) 00296 _x = _v3.exact_value_str 00297 length = len(_x) 00298 buff.write(struct.pack('<I%ss'%length, length, _x)) 00299 length = len(_v3.exact_value_vec) 00300 buff.write(_struct_I.pack(length)) 00301 pattern = '<%sd'%length 00302 buff.write(_v3.exact_value_vec.tostring()) 00303 except struct.error as se: self._check_types(se) 00304 except TypeError as te: self._check_types(te) 00305 00306 def deserialize_numpy(self, str, numpy): 00307 """ 00308 unpack serialized message in str into this message instance using numpy for array types 00309 @param str: byte array of serialized message 00310 @type str: str 00311 @param numpy: numpy python module 00312 @type numpy: module 00313 """ 00314 try: 00315 if self.header is None: 00316 self.header = std_msgs.msg._Header.Header() 00317 end = 0 00318 _x = self 00319 start = end 00320 end += 12 00321 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00322 start = end 00323 end += 4 00324 (length,) = _struct_I.unpack(str[start:end]) 00325 start = end 00326 end += length 00327 self.header.frame_id = str[start:end] 00328 start = end 00329 end += 4 00330 (length,) = _struct_I.unpack(str[start:end]) 00331 self.objects = [] 00332 for i in range(0, length): 00333 val1 = wire_msgs.msg.ObjectState() 00334 _x = val1 00335 start = end 00336 end += 12 00337 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end]) 00338 start = end 00339 end += 4 00340 (length,) = _struct_I.unpack(str[start:end]) 00341 val1.properties = [] 00342 for i in range(0, length): 00343 val2 = wire_msgs.msg.Property() 00344 start = end 00345 end += 4 00346 (length,) = _struct_I.unpack(str[start:end]) 00347 start = end 00348 end += length 00349 val2.attribute = str[start:end] 00350 _v4 = val2.pdf 00351 _x = _v4 00352 start = end 00353 end += 5 00354 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end]) 00355 start = end 00356 end += 4 00357 (length,) = _struct_I.unpack(str[start:end]) 00358 pattern = '<%sd'%length 00359 start = end 00360 end += struct.calcsize(pattern) 00361 _v4.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00362 start = end 00363 end += 4 00364 (_v4.domain_size,) = _struct_i.unpack(str[start:end]) 00365 start = end 00366 end += 4 00367 (length,) = _struct_I.unpack(str[start:end]) 00368 _v4.values = [] 00369 for i in range(0, length): 00370 start = end 00371 end += 4 00372 (length,) = _struct_I.unpack(str[start:end]) 00373 start = end 00374 end += length 00375 val4 = str[start:end] 00376 _v4.values.append(val4) 00377 start = end 00378 end += 4 00379 (length,) = _struct_I.unpack(str[start:end]) 00380 pattern = '<%sd'%length 00381 start = end 00382 end += struct.calcsize(pattern) 00383 _v4.probabilities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00384 start = end 00385 end += 4 00386 (length,) = _struct_I.unpack(str[start:end]) 00387 start = end 00388 end += length 00389 _v4.exact_value_str = str[start:end] 00390 start = end 00391 end += 4 00392 (length,) = _struct_I.unpack(str[start:end]) 00393 pattern = '<%sd'%length 00394 start = end 00395 end += struct.calcsize(pattern) 00396 _v4.exact_value_vec = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00397 val1.properties.append(val2) 00398 self.objects.append(val1) 00399 return self 00400 except struct.error as e: 00401 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00402 00403 _struct_I = roslib.message.struct_I 00404 _struct_i = struct.Struct("<i") 00405 _struct_3I = struct.Struct("<3I") 00406 _struct_Id = struct.Struct("<Id") 00407 _struct_BI = struct.Struct("<BI")