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