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


worldmodel_msgs
Author(s): Johannes Meyer
autogenerated on Mon Sep 2 2013 11:37:27