_cop_descriptor.py
Go to the documentation of this file.
00001 """autogenerated by genpy from vision_msgs/cop_descriptor.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class cop_descriptor(genpy.Message):
00009   _md5sum = "da820395d349a763f46d0925861440b9"
00010   _type = "vision_msgs/cop_descriptor"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """#Descriptors of models used in cop, U. Klank klank@in.tum.de
00013 uint64  object_id          # unique id that could be used for a query
00014 string  sem_class          # connected semantic concept
00015 string  type               # Class name that was used to generate the corresponding cop descriptor plugin, 
00016                            # example are: ShapeModel, ColorClass, DeformShapeModel
00017 float64 quality            # the current quality assinged to this descriptor
00018 
00019 
00020 
00021 
00022 """
00023   __slots__ = ['object_id','sem_class','type','quality']
00024   _slot_types = ['uint64','string','string','float64']
00025 
00026   def __init__(self, *args, **kwds):
00027     """
00028     Constructor. Any message fields that are implicitly/explicitly
00029     set to None will be assigned a default value. The recommend
00030     use is keyword arguments as this is more robust to future message
00031     changes.  You cannot mix in-order arguments and keyword arguments.
00032 
00033     The available fields are:
00034        object_id,sem_class,type,quality
00035 
00036     :param args: complete set of field values, in .msg order
00037     :param kwds: use keyword arguments corresponding to message field names
00038     to set specific fields.
00039     """
00040     if args or kwds:
00041       super(cop_descriptor, self).__init__(*args, **kwds)
00042       #message fields cannot be None, assign default values for those that are
00043       if self.object_id is None:
00044         self.object_id = 0
00045       if self.sem_class is None:
00046         self.sem_class = ''
00047       if self.type is None:
00048         self.type = ''
00049       if self.quality is None:
00050         self.quality = 0.
00051     else:
00052       self.object_id = 0
00053       self.sem_class = ''
00054       self.type = ''
00055       self.quality = 0.
00056 
00057   def _get_types(self):
00058     """
00059     internal API method
00060     """
00061     return self._slot_types
00062 
00063   def serialize(self, buff):
00064     """
00065     serialize message into buffer
00066     :param buff: buffer, ``StringIO``
00067     """
00068     try:
00069       buff.write(_struct_Q.pack(self.object_id))
00070       _x = self.sem_class
00071       length = len(_x)
00072       if python3 or type(_x) == unicode:
00073         _x = _x.encode('utf-8')
00074         length = len(_x)
00075       buff.write(struct.pack('<I%ss'%length, length, _x))
00076       _x = self.type
00077       length = len(_x)
00078       if python3 or type(_x) == unicode:
00079         _x = _x.encode('utf-8')
00080         length = len(_x)
00081       buff.write(struct.pack('<I%ss'%length, length, _x))
00082       buff.write(_struct_d.pack(self.quality))
00083     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00084     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00085 
00086   def deserialize(self, str):
00087     """
00088     unpack serialized message in str into this message instance
00089     :param str: byte array of serialized message, ``str``
00090     """
00091     try:
00092       end = 0
00093       start = end
00094       end += 8
00095       (self.object_id,) = _struct_Q.unpack(str[start:end])
00096       start = end
00097       end += 4
00098       (length,) = _struct_I.unpack(str[start:end])
00099       start = end
00100       end += length
00101       if python3:
00102         self.sem_class = str[start:end].decode('utf-8')
00103       else:
00104         self.sem_class = str[start:end]
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       start = end
00109       end += length
00110       if python3:
00111         self.type = str[start:end].decode('utf-8')
00112       else:
00113         self.type = str[start:end]
00114       start = end
00115       end += 8
00116       (self.quality,) = _struct_d.unpack(str[start:end])
00117       return self
00118     except struct.error as e:
00119       raise genpy.DeserializationError(e) #most likely buffer underfill
00120 
00121 
00122   def serialize_numpy(self, buff, numpy):
00123     """
00124     serialize message with numpy array types into buffer
00125     :param buff: buffer, ``StringIO``
00126     :param numpy: numpy python module
00127     """
00128     try:
00129       buff.write(_struct_Q.pack(self.object_id))
00130       _x = self.sem_class
00131       length = len(_x)
00132       if python3 or type(_x) == unicode:
00133         _x = _x.encode('utf-8')
00134         length = len(_x)
00135       buff.write(struct.pack('<I%ss'%length, length, _x))
00136       _x = self.type
00137       length = len(_x)
00138       if python3 or type(_x) == unicode:
00139         _x = _x.encode('utf-8')
00140         length = len(_x)
00141       buff.write(struct.pack('<I%ss'%length, length, _x))
00142       buff.write(_struct_d.pack(self.quality))
00143     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00144     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00145 
00146   def deserialize_numpy(self, str, numpy):
00147     """
00148     unpack serialized message in str into this message instance using numpy for array types
00149     :param str: byte array of serialized message, ``str``
00150     :param numpy: numpy python module
00151     """
00152     try:
00153       end = 0
00154       start = end
00155       end += 8
00156       (self.object_id,) = _struct_Q.unpack(str[start:end])
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       start = end
00161       end += length
00162       if python3:
00163         self.sem_class = str[start:end].decode('utf-8')
00164       else:
00165         self.sem_class = str[start:end]
00166       start = end
00167       end += 4
00168       (length,) = _struct_I.unpack(str[start:end])
00169       start = end
00170       end += length
00171       if python3:
00172         self.type = str[start:end].decode('utf-8')
00173       else:
00174         self.type = str[start:end]
00175       start = end
00176       end += 8
00177       (self.quality,) = _struct_d.unpack(str[start:end])
00178       return self
00179     except struct.error as e:
00180       raise genpy.DeserializationError(e) #most likely buffer underfill
00181 
00182 _struct_I = genpy.struct_I
00183 _struct_Q = struct.Struct("<Q")
00184 _struct_d = struct.Struct("<d")


vision_msgs
Author(s): Ulrich F Klank
autogenerated on Mon Oct 6 2014 00:47:36