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