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