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


flirtlib_ros
Author(s): Bhaskara Marthi
autogenerated on Thu Nov 28 2013 11:21:50