_SemMapObject.py
Go to the documentation of this file.
00001 """autogenerated by genpy from mod_semantic_map/SemMapObject.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 SemMapObject(genpy.Message):
00009   _md5sum = "b73de59dbea14f1d9d4ffff94cfce597"
00010   _type = "mod_semantic_map/SemMapObject"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Semantic map object message type, Moritz Tenorth, tenorth@cs.tum.edu
00013 int32 id          # unique object identifier
00014 string type       # object class: {oven, cupboard, refrigerator, table, countertop, door, hinge, handle, knob, sink}
00015 float32 width     # object width
00016 float32 depth     # object width
00017 float32 height    # object width
00018 float32[] pose    # 4x4 pose matrix, row-based
00019 int32   partOf    # ID of the parent object (consistent with the ID on the first line)
00020 
00021 """
00022   __slots__ = ['id','type','width','depth','height','pose','partOf']
00023   _slot_types = ['int32','string','float32','float32','float32','float32[]','int32']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        id,type,width,depth,height,pose,partOf
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(SemMapObject, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.id is None:
00043         self.id = 0
00044       if self.type is None:
00045         self.type = ''
00046       if self.width is None:
00047         self.width = 0.
00048       if self.depth is None:
00049         self.depth = 0.
00050       if self.height is None:
00051         self.height = 0.
00052       if self.pose is None:
00053         self.pose = []
00054       if self.partOf is None:
00055         self.partOf = 0
00056     else:
00057       self.id = 0
00058       self.type = ''
00059       self.width = 0.
00060       self.depth = 0.
00061       self.height = 0.
00062       self.pose = []
00063       self.partOf = 0
00064 
00065   def _get_types(self):
00066     """
00067     internal API method
00068     """
00069     return self._slot_types
00070 
00071   def serialize(self, buff):
00072     """
00073     serialize message into buffer
00074     :param buff: buffer, ``StringIO``
00075     """
00076     try:
00077       buff.write(_struct_i.pack(self.id))
00078       _x = self.type
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084       _x = self
00085       buff.write(_struct_3f.pack(_x.width, _x.depth, _x.height))
00086       length = len(self.pose)
00087       buff.write(_struct_I.pack(length))
00088       pattern = '<%sf'%length
00089       buff.write(struct.pack(pattern, *self.pose))
00090       buff.write(_struct_i.pack(self.partOf))
00091     except struct.error as se: self._check_types(se)
00092     except TypeError as te: self._check_types(te)
00093 
00094   def deserialize(self, str):
00095     """
00096     unpack serialized message in str into this message instance
00097     :param str: byte array of serialized message, ``str``
00098     """
00099     try:
00100       end = 0
00101       start = end
00102       end += 4
00103       (self.id,) = _struct_i.unpack(str[start:end])
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.type = str[start:end].decode('utf-8')
00111       else:
00112         self.type = str[start:end]
00113       _x = self
00114       start = end
00115       end += 12
00116       (_x.width, _x.depth, _x.height,) = _struct_3f.unpack(str[start:end])
00117       start = end
00118       end += 4
00119       (length,) = _struct_I.unpack(str[start:end])
00120       pattern = '<%sf'%length
00121       start = end
00122       end += struct.calcsize(pattern)
00123       self.pose = struct.unpack(pattern, str[start:end])
00124       start = end
00125       end += 4
00126       (self.partOf,) = _struct_i.unpack(str[start:end])
00127       return self
00128     except struct.error as e:
00129       raise genpy.DeserializationError(e) #most likely buffer underfill
00130 
00131 
00132   def serialize_numpy(self, buff, numpy):
00133     """
00134     serialize message with numpy array types into buffer
00135     :param buff: buffer, ``StringIO``
00136     :param numpy: numpy python module
00137     """
00138     try:
00139       buff.write(_struct_i.pack(self.id))
00140       _x = self.type
00141       length = len(_x)
00142       if python3 or type(_x) == unicode:
00143         _x = _x.encode('utf-8')
00144         length = len(_x)
00145       buff.write(struct.pack('<I%ss'%length, length, _x))
00146       _x = self
00147       buff.write(_struct_3f.pack(_x.width, _x.depth, _x.height))
00148       length = len(self.pose)
00149       buff.write(_struct_I.pack(length))
00150       pattern = '<%sf'%length
00151       buff.write(self.pose.tostring())
00152       buff.write(_struct_i.pack(self.partOf))
00153     except struct.error as se: self._check_types(se)
00154     except TypeError as te: self._check_types(te)
00155 
00156   def deserialize_numpy(self, str, numpy):
00157     """
00158     unpack serialized message in str into this message instance using numpy for array types
00159     :param str: byte array of serialized message, ``str``
00160     :param numpy: numpy python module
00161     """
00162     try:
00163       end = 0
00164       start = end
00165       end += 4
00166       (self.id,) = _struct_i.unpack(str[start:end])
00167       start = end
00168       end += 4
00169       (length,) = _struct_I.unpack(str[start:end])
00170       start = end
00171       end += length
00172       if python3:
00173         self.type = str[start:end].decode('utf-8')
00174       else:
00175         self.type = str[start:end]
00176       _x = self
00177       start = end
00178       end += 12
00179       (_x.width, _x.depth, _x.height,) = _struct_3f.unpack(str[start:end])
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       pattern = '<%sf'%length
00184       start = end
00185       end += struct.calcsize(pattern)
00186       self.pose = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00187       start = end
00188       end += 4
00189       (self.partOf,) = _struct_i.unpack(str[start:end])
00190       return self
00191     except struct.error as e:
00192       raise genpy.DeserializationError(e) #most likely buffer underfill
00193 
00194 _struct_I = genpy.struct_I
00195 _struct_i = struct.Struct("<i")
00196 _struct_3f = struct.Struct("<3f")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


mod_semantic_map
Author(s): Moritz Tenorth
autogenerated on Thu May 23 2013 08:54:30