00001 """autogenerated by genpy from mod_semantic_map/SemMap.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import mod_semantic_map.msg
00008 import std_msgs.msg
00009
00010 class SemMap(genpy.Message):
00011 _md5sum = "b5d726624cf18c09ef6a9556a3c51953"
00012 _type = "mod_semantic_map/SemMap"
00013 _has_header = True
00014 _full_text = """# Semantic map message type, Moritz Tenorth, tenorth@cs.tum.edu
00015 Header header # Message header
00016 SemMapObject[] objects # List of objects in the map
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 ================================================================================
00037 MSG: mod_semantic_map/SemMapObject
00038 # Semantic map object message type, Moritz Tenorth, tenorth@cs.tum.edu
00039 int32 id # unique object identifier
00040 string type # object class: {oven, cupboard, refrigerator, table, countertop, door, hinge, handle, knob, sink}
00041 float32 width # object width
00042 float32 depth # object width
00043 float32 height # object width
00044 float32[] pose # 4x4 pose matrix, row-based
00045 int32 partOf # ID of the parent object (consistent with the ID on the first line)
00046
00047 """
00048 __slots__ = ['header','objects']
00049 _slot_types = ['std_msgs/Header','mod_semantic_map/SemMapObject[]']
00050
00051 def __init__(self, *args, **kwds):
00052 """
00053 Constructor. Any message fields that are implicitly/explicitly
00054 set to None will be assigned a default value. The recommend
00055 use is keyword arguments as this is more robust to future message
00056 changes. You cannot mix in-order arguments and keyword arguments.
00057
00058 The available fields are:
00059 header,objects
00060
00061 :param args: complete set of field values, in .msg order
00062 :param kwds: use keyword arguments corresponding to message field names
00063 to set specific fields.
00064 """
00065 if args or kwds:
00066 super(SemMap, self).__init__(*args, **kwds)
00067
00068 if self.header is None:
00069 self.header = std_msgs.msg.Header()
00070 if self.objects is None:
00071 self.objects = []
00072 else:
00073 self.header = std_msgs.msg.Header()
00074 self.objects = []
00075
00076 def _get_types(self):
00077 """
00078 internal API method
00079 """
00080 return self._slot_types
00081
00082 def serialize(self, buff):
00083 """
00084 serialize message into buffer
00085 :param buff: buffer, ``StringIO``
00086 """
00087 try:
00088 _x = self
00089 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00090 _x = self.header.frame_id
00091 length = len(_x)
00092 if python3 or type(_x) == unicode:
00093 _x = _x.encode('utf-8')
00094 length = len(_x)
00095 buff.write(struct.pack('<I%ss'%length, length, _x))
00096 length = len(self.objects)
00097 buff.write(_struct_I.pack(length))
00098 for val1 in self.objects:
00099 buff.write(_struct_i.pack(val1.id))
00100 _x = val1.type
00101 length = len(_x)
00102 if python3 or type(_x) == unicode:
00103 _x = _x.encode('utf-8')
00104 length = len(_x)
00105 buff.write(struct.pack('<I%ss'%length, length, _x))
00106 _x = val1
00107 buff.write(_struct_3f.pack(_x.width, _x.depth, _x.height))
00108 length = len(val1.pose)
00109 buff.write(_struct_I.pack(length))
00110 pattern = '<%sf'%length
00111 buff.write(struct.pack(pattern, *val1.pose))
00112 buff.write(_struct_i.pack(val1.partOf))
00113 except struct.error as se: self._check_types(se)
00114 except TypeError as te: self._check_types(te)
00115
00116 def deserialize(self, str):
00117 """
00118 unpack serialized message in str into this message instance
00119 :param str: byte array of serialized message, ``str``
00120 """
00121 try:
00122 if self.header is None:
00123 self.header = std_msgs.msg.Header()
00124 if self.objects is None:
00125 self.objects = None
00126 end = 0
00127 _x = self
00128 start = end
00129 end += 12
00130 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 start = end
00135 end += length
00136 if python3:
00137 self.header.frame_id = str[start:end].decode('utf-8')
00138 else:
00139 self.header.frame_id = str[start:end]
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 self.objects = []
00144 for i in range(0, length):
00145 val1 = mod_semantic_map.msg.SemMapObject()
00146 start = end
00147 end += 4
00148 (val1.id,) = _struct_i.unpack(str[start:end])
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 val1.type = str[start:end].decode('utf-8')
00156 else:
00157 val1.type = str[start:end]
00158 _x = val1
00159 start = end
00160 end += 12
00161 (_x.width, _x.depth, _x.height,) = _struct_3f.unpack(str[start:end])
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 pattern = '<%sf'%length
00166 start = end
00167 end += struct.calcsize(pattern)
00168 val1.pose = struct.unpack(pattern, str[start:end])
00169 start = end
00170 end += 4
00171 (val1.partOf,) = _struct_i.unpack(str[start:end])
00172 self.objects.append(val1)
00173 return self
00174 except struct.error as e:
00175 raise genpy.DeserializationError(e)
00176
00177
00178 def serialize_numpy(self, buff, numpy):
00179 """
00180 serialize message with numpy array types into buffer
00181 :param buff: buffer, ``StringIO``
00182 :param numpy: numpy python module
00183 """
00184 try:
00185 _x = self
00186 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00187 _x = self.header.frame_id
00188 length = len(_x)
00189 if python3 or type(_x) == unicode:
00190 _x = _x.encode('utf-8')
00191 length = len(_x)
00192 buff.write(struct.pack('<I%ss'%length, length, _x))
00193 length = len(self.objects)
00194 buff.write(_struct_I.pack(length))
00195 for val1 in self.objects:
00196 buff.write(_struct_i.pack(val1.id))
00197 _x = val1.type
00198 length = len(_x)
00199 if python3 or type(_x) == unicode:
00200 _x = _x.encode('utf-8')
00201 length = len(_x)
00202 buff.write(struct.pack('<I%ss'%length, length, _x))
00203 _x = val1
00204 buff.write(_struct_3f.pack(_x.width, _x.depth, _x.height))
00205 length = len(val1.pose)
00206 buff.write(_struct_I.pack(length))
00207 pattern = '<%sf'%length
00208 buff.write(val1.pose.tostring())
00209 buff.write(_struct_i.pack(val1.partOf))
00210 except struct.error as se: self._check_types(se)
00211 except TypeError as te: self._check_types(te)
00212
00213 def deserialize_numpy(self, str, numpy):
00214 """
00215 unpack serialized message in str into this message instance using numpy for array types
00216 :param str: byte array of serialized message, ``str``
00217 :param numpy: numpy python module
00218 """
00219 try:
00220 if self.header is None:
00221 self.header = std_msgs.msg.Header()
00222 if self.objects is None:
00223 self.objects = None
00224 end = 0
00225 _x = self
00226 start = end
00227 end += 12
00228 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 if python3:
00235 self.header.frame_id = str[start:end].decode('utf-8')
00236 else:
00237 self.header.frame_id = str[start:end]
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 self.objects = []
00242 for i in range(0, length):
00243 val1 = mod_semantic_map.msg.SemMapObject()
00244 start = end
00245 end += 4
00246 (val1.id,) = _struct_i.unpack(str[start:end])
00247 start = end
00248 end += 4
00249 (length,) = _struct_I.unpack(str[start:end])
00250 start = end
00251 end += length
00252 if python3:
00253 val1.type = str[start:end].decode('utf-8')
00254 else:
00255 val1.type = str[start:end]
00256 _x = val1
00257 start = end
00258 end += 12
00259 (_x.width, _x.depth, _x.height,) = _struct_3f.unpack(str[start:end])
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 pattern = '<%sf'%length
00264 start = end
00265 end += struct.calcsize(pattern)
00266 val1.pose = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00267 start = end
00268 end += 4
00269 (val1.partOf,) = _struct_i.unpack(str[start:end])
00270 self.objects.append(val1)
00271 return self
00272 except struct.error as e:
00273 raise genpy.DeserializationError(e)
00274
00275 _struct_I = genpy.struct_I
00276 _struct_i = struct.Struct("<i")
00277 _struct_3I = struct.Struct("<3I")
00278 _struct_3f = struct.Struct("<3f")