$search
00001 """autogenerated by genmsg_py from ObjectState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import wire_msgs.msg 00006 import problib.msg 00007 00008 class ObjectState(roslib.message.Message): 00009 _md5sum = "68e5e23a02875f3c610161fde54dc1c3" 00010 _type = "wire_msgs/ObjectState" 00011 _has_header = False #flag to mark the presence of a Header object 00012 _full_text = """uint32 ID 00013 float64 probability # probability that this object is actually in the world 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__ = ['ID','probability','properties'] 00051 _slot_types = ['uint32','float64','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 ID,probability,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(ObjectState, self).__init__(*args, **kwds) 00069 #message fields cannot be None, assign default values for those that are 00070 if self.ID is None: 00071 self.ID = 0 00072 if self.probability is None: 00073 self.probability = 0. 00074 if self.properties is None: 00075 self.properties = [] 00076 else: 00077 self.ID = 0 00078 self.probability = 0. 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_Id.pack(_x.ID, _x.probability)) 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 += 12 00140 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end]) 00141 start = end 00142 end += 4 00143 (length,) = _struct_I.unpack(str[start:end]) 00144 self.properties = [] 00145 for i in range(0, length): 00146 val1 = wire_msgs.msg.Property() 00147 start = end 00148 end += 4 00149 (length,) = _struct_I.unpack(str[start:end]) 00150 start = end 00151 end += length 00152 val1.attribute = str[start:end] 00153 _v2 = val1.pdf 00154 _x = _v2 00155 start = end 00156 end += 5 00157 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end]) 00158 start = end 00159 end += 4 00160 (length,) = _struct_I.unpack(str[start:end]) 00161 pattern = '<%sd'%length 00162 start = end 00163 end += struct.calcsize(pattern) 00164 _v2.data = struct.unpack(pattern, str[start:end]) 00165 start = end 00166 end += 4 00167 (_v2.domain_size,) = _struct_i.unpack(str[start:end]) 00168 start = end 00169 end += 4 00170 (length,) = _struct_I.unpack(str[start:end]) 00171 _v2.values = [] 00172 for i in range(0, length): 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 start = end 00177 end += length 00178 val3 = str[start:end] 00179 _v2.values.append(val3) 00180 start = end 00181 end += 4 00182 (length,) = _struct_I.unpack(str[start:end]) 00183 pattern = '<%sd'%length 00184 start = end 00185 end += struct.calcsize(pattern) 00186 _v2.probabilities = struct.unpack(pattern, str[start:end]) 00187 start = end 00188 end += 4 00189 (length,) = _struct_I.unpack(str[start:end]) 00190 start = end 00191 end += length 00192 _v2.exact_value_str = str[start:end] 00193 start = end 00194 end += 4 00195 (length,) = _struct_I.unpack(str[start:end]) 00196 pattern = '<%sd'%length 00197 start = end 00198 end += struct.calcsize(pattern) 00199 _v2.exact_value_vec = struct.unpack(pattern, str[start:end]) 00200 self.properties.append(val1) 00201 return self 00202 except struct.error as e: 00203 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00204 00205 00206 def serialize_numpy(self, buff, numpy): 00207 """ 00208 serialize message with numpy array types into buffer 00209 @param buff: buffer 00210 @type buff: StringIO 00211 @param numpy: numpy python module 00212 @type numpy module 00213 """ 00214 try: 00215 _x = self 00216 buff.write(_struct_Id.pack(_x.ID, _x.probability)) 00217 length = len(self.properties) 00218 buff.write(_struct_I.pack(length)) 00219 for val1 in self.properties: 00220 _x = val1.attribute 00221 length = len(_x) 00222 buff.write(struct.pack('<I%ss'%length, length, _x)) 00223 _v3 = val1.pdf 00224 _x = _v3 00225 buff.write(_struct_BI.pack(_x.type, _x.dimensions)) 00226 length = len(_v3.data) 00227 buff.write(_struct_I.pack(length)) 00228 pattern = '<%sd'%length 00229 buff.write(_v3.data.tostring()) 00230 buff.write(_struct_i.pack(_v3.domain_size)) 00231 length = len(_v3.values) 00232 buff.write(_struct_I.pack(length)) 00233 for val3 in _v3.values: 00234 length = len(val3) 00235 buff.write(struct.pack('<I%ss'%length, length, val3)) 00236 length = len(_v3.probabilities) 00237 buff.write(_struct_I.pack(length)) 00238 pattern = '<%sd'%length 00239 buff.write(_v3.probabilities.tostring()) 00240 _x = _v3.exact_value_str 00241 length = len(_x) 00242 buff.write(struct.pack('<I%ss'%length, length, _x)) 00243 length = len(_v3.exact_value_vec) 00244 buff.write(_struct_I.pack(length)) 00245 pattern = '<%sd'%length 00246 buff.write(_v3.exact_value_vec.tostring()) 00247 except struct.error as se: self._check_types(se) 00248 except TypeError as te: self._check_types(te) 00249 00250 def deserialize_numpy(self, str, numpy): 00251 """ 00252 unpack serialized message in str into this message instance using numpy for array types 00253 @param str: byte array of serialized message 00254 @type str: str 00255 @param numpy: numpy python module 00256 @type numpy: module 00257 """ 00258 try: 00259 end = 0 00260 _x = self 00261 start = end 00262 end += 12 00263 (_x.ID, _x.probability,) = _struct_Id.unpack(str[start:end]) 00264 start = end 00265 end += 4 00266 (length,) = _struct_I.unpack(str[start:end]) 00267 self.properties = [] 00268 for i in range(0, length): 00269 val1 = wire_msgs.msg.Property() 00270 start = end 00271 end += 4 00272 (length,) = _struct_I.unpack(str[start:end]) 00273 start = end 00274 end += length 00275 val1.attribute = str[start:end] 00276 _v4 = val1.pdf 00277 _x = _v4 00278 start = end 00279 end += 5 00280 (_x.type, _x.dimensions,) = _struct_BI.unpack(str[start:end]) 00281 start = end 00282 end += 4 00283 (length,) = _struct_I.unpack(str[start:end]) 00284 pattern = '<%sd'%length 00285 start = end 00286 end += struct.calcsize(pattern) 00287 _v4.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00288 start = end 00289 end += 4 00290 (_v4.domain_size,) = _struct_i.unpack(str[start:end]) 00291 start = end 00292 end += 4 00293 (length,) = _struct_I.unpack(str[start:end]) 00294 _v4.values = [] 00295 for i in range(0, length): 00296 start = end 00297 end += 4 00298 (length,) = _struct_I.unpack(str[start:end]) 00299 start = end 00300 end += length 00301 val3 = str[start:end] 00302 _v4.values.append(val3) 00303 start = end 00304 end += 4 00305 (length,) = _struct_I.unpack(str[start:end]) 00306 pattern = '<%sd'%length 00307 start = end 00308 end += struct.calcsize(pattern) 00309 _v4.probabilities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00310 start = end 00311 end += 4 00312 (length,) = _struct_I.unpack(str[start:end]) 00313 start = end 00314 end += length 00315 _v4.exact_value_str = str[start:end] 00316 start = end 00317 end += 4 00318 (length,) = _struct_I.unpack(str[start:end]) 00319 pattern = '<%sd'%length 00320 start = end 00321 end += struct.calcsize(pattern) 00322 _v4.exact_value_vec = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00323 self.properties.append(val1) 00324 return self 00325 except struct.error as e: 00326 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00327 00328 _struct_I = roslib.message.struct_I 00329 _struct_i = struct.Struct("<i") 00330 _struct_Id = struct.Struct("<Id") 00331 _struct_BI = struct.Struct("<BI")