_PerceptInfo.py
Go to the documentation of this file.
00001 """autogenerated by genpy from hector_worldmodel_msgs/PerceptInfo.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 PerceptInfo(genpy.Message):
00009   _md5sum = "6d276cf0fa6b560cbfd07a3f9eab88b5"
00010   _type = "hector_worldmodel_msgs/PerceptInfo"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# hector_worldmodel_msgs/PerceptInfo
00013 # This message contains information about the estimated class and object identity 
00014 
00015 # A string identifying the object's class (all objects of a class look the same)
00016 string class_id
00017 
00018 # The class association support of the observation
00019 # The support is the log odd likelihood ratio given by log(p(y/observation y belongs to object of class class_id) / p(y/observation y is a false positive))
00020 float32 class_support
00021 
00022 # A string identifying a specific object
00023 string object_id
00024 
00025 # The object association support of the observation
00026 # The support is the log odd likelihood ratio given by log(p(observation belongs to object object_id) / p(observation is false positive or belongs to another object))
00027 float32 object_support
00028 
00029 # A string that contains the name or a description of the specific object
00030 string name
00031 
00032 """
00033   __slots__ = ['class_id','class_support','object_id','object_support','name']
00034   _slot_types = ['string','float32','string','float32','string']
00035 
00036   def __init__(self, *args, **kwds):
00037     """
00038     Constructor. Any message fields that are implicitly/explicitly
00039     set to None will be assigned a default value. The recommend
00040     use is keyword arguments as this is more robust to future message
00041     changes.  You cannot mix in-order arguments and keyword arguments.
00042 
00043     The available fields are:
00044        class_id,class_support,object_id,object_support,name
00045 
00046     :param args: complete set of field values, in .msg order
00047     :param kwds: use keyword arguments corresponding to message field names
00048     to set specific fields.
00049     """
00050     if args or kwds:
00051       super(PerceptInfo, self).__init__(*args, **kwds)
00052       #message fields cannot be None, assign default values for those that are
00053       if self.class_id is None:
00054         self.class_id = ''
00055       if self.class_support is None:
00056         self.class_support = 0.
00057       if self.object_id is None:
00058         self.object_id = ''
00059       if self.object_support is None:
00060         self.object_support = 0.
00061       if self.name is None:
00062         self.name = ''
00063     else:
00064       self.class_id = ''
00065       self.class_support = 0.
00066       self.object_id = ''
00067       self.object_support = 0.
00068       self.name = ''
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, ``StringIO``
00080     """
00081     try:
00082       _x = self.class_id
00083       length = len(_x)
00084       if python3 or type(_x) == unicode:
00085         _x = _x.encode('utf-8')
00086         length = len(_x)
00087       buff.write(struct.pack('<I%ss'%length, length, _x))
00088       buff.write(_struct_f.pack(self.class_support))
00089       _x = self.object_id
00090       length = len(_x)
00091       if python3 or type(_x) == unicode:
00092         _x = _x.encode('utf-8')
00093         length = len(_x)
00094       buff.write(struct.pack('<I%ss'%length, length, _x))
00095       buff.write(_struct_f.pack(self.object_support))
00096       _x = self.name
00097       length = len(_x)
00098       if python3 or type(_x) == unicode:
00099         _x = _x.encode('utf-8')
00100         length = len(_x)
00101       buff.write(struct.pack('<I%ss'%length, length, _x))
00102     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00103     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00104 
00105   def deserialize(self, str):
00106     """
00107     unpack serialized message in str into this message instance
00108     :param str: byte array of serialized message, ``str``
00109     """
00110     try:
00111       end = 0
00112       start = end
00113       end += 4
00114       (length,) = _struct_I.unpack(str[start:end])
00115       start = end
00116       end += length
00117       if python3:
00118         self.class_id = str[start:end].decode('utf-8')
00119       else:
00120         self.class_id = str[start:end]
00121       start = end
00122       end += 4
00123       (self.class_support,) = _struct_f.unpack(str[start:end])
00124       start = end
00125       end += 4
00126       (length,) = _struct_I.unpack(str[start:end])
00127       start = end
00128       end += length
00129       if python3:
00130         self.object_id = str[start:end].decode('utf-8')
00131       else:
00132         self.object_id = str[start:end]
00133       start = end
00134       end += 4
00135       (self.object_support,) = _struct_f.unpack(str[start:end])
00136       start = end
00137       end += 4
00138       (length,) = _struct_I.unpack(str[start:end])
00139       start = end
00140       end += length
00141       if python3:
00142         self.name = str[start:end].decode('utf-8')
00143       else:
00144         self.name = str[start:end]
00145       return self
00146     except struct.error as e:
00147       raise genpy.DeserializationError(e) #most likely buffer underfill
00148 
00149 
00150   def serialize_numpy(self, buff, numpy):
00151     """
00152     serialize message with numpy array types into buffer
00153     :param buff: buffer, ``StringIO``
00154     :param numpy: numpy python module
00155     """
00156     try:
00157       _x = self.class_id
00158       length = len(_x)
00159       if python3 or type(_x) == unicode:
00160         _x = _x.encode('utf-8')
00161         length = len(_x)
00162       buff.write(struct.pack('<I%ss'%length, length, _x))
00163       buff.write(_struct_f.pack(self.class_support))
00164       _x = self.object_id
00165       length = len(_x)
00166       if python3 or type(_x) == unicode:
00167         _x = _x.encode('utf-8')
00168         length = len(_x)
00169       buff.write(struct.pack('<I%ss'%length, length, _x))
00170       buff.write(_struct_f.pack(self.object_support))
00171       _x = self.name
00172       length = len(_x)
00173       if python3 or type(_x) == unicode:
00174         _x = _x.encode('utf-8')
00175         length = len(_x)
00176       buff.write(struct.pack('<I%ss'%length, length, _x))
00177     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00178     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00179 
00180   def deserialize_numpy(self, str, numpy):
00181     """
00182     unpack serialized message in str into this message instance using numpy for array types
00183     :param str: byte array of serialized message, ``str``
00184     :param numpy: numpy python module
00185     """
00186     try:
00187       end = 0
00188       start = end
00189       end += 4
00190       (length,) = _struct_I.unpack(str[start:end])
00191       start = end
00192       end += length
00193       if python3:
00194         self.class_id = str[start:end].decode('utf-8')
00195       else:
00196         self.class_id = str[start:end]
00197       start = end
00198       end += 4
00199       (self.class_support,) = _struct_f.unpack(str[start:end])
00200       start = end
00201       end += 4
00202       (length,) = _struct_I.unpack(str[start:end])
00203       start = end
00204       end += length
00205       if python3:
00206         self.object_id = str[start:end].decode('utf-8')
00207       else:
00208         self.object_id = str[start:end]
00209       start = end
00210       end += 4
00211       (self.object_support,) = _struct_f.unpack(str[start:end])
00212       start = end
00213       end += 4
00214       (length,) = _struct_I.unpack(str[start:end])
00215       start = end
00216       end += length
00217       if python3:
00218         self.name = str[start:end].decode('utf-8')
00219       else:
00220         self.name = str[start:end]
00221       return self
00222     except struct.error as e:
00223       raise genpy.DeserializationError(e) #most likely buffer underfill
00224 
00225 _struct_I = genpy.struct_I
00226 _struct_f = struct.Struct("<f")


hector_worldmodel_msgs
Author(s): Johannes Meyer
autogenerated on Mon Oct 6 2014 00:36:27