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


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