00001 """autogenerated by genpy from interactive_perception_msgs/ModelHypothesisList.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 geometry_msgs.msg
00008 import interactive_perception_msgs.msg
00009 import shape_msgs.msg
00010 import std_msgs.msg
00011
00012 class ModelHypothesisList(genpy.Message):
00013 _md5sum = "4c912ee108200d2765bed511e89acbff"
00014 _type = "interactive_perception_msgs/ModelHypothesisList"
00015 _has_header = False
00016 _full_text = """ModelHypothesis[] hypotheses
00017
00018 #initial guess if this can be a correct recognition result at all
00019 bool accept
00020 ================================================================================
00021 MSG: interactive_perception_msgs/ModelHypothesis
00022 #describes a hypothesis about a recognized object (mesh+pose)
00023
00024 shape_msgs/Mesh mesh
00025 geometry_msgs/PoseStamped pose
00026
00027 ================================================================================
00028 MSG: shape_msgs/Mesh
00029 # Definition of a mesh
00030
00031 # list of triangles; the index values refer to positions in vertices[]
00032 MeshTriangle[] triangles
00033
00034 # the actual vertices that make up the mesh
00035 geometry_msgs/Point[] vertices
00036
00037 ================================================================================
00038 MSG: shape_msgs/MeshTriangle
00039 # Definition of a triangle's vertices
00040 uint32[3] vertex_indices
00041
00042 ================================================================================
00043 MSG: geometry_msgs/Point
00044 # This contains the position of a point in free space
00045 float64 x
00046 float64 y
00047 float64 z
00048
00049 ================================================================================
00050 MSG: geometry_msgs/PoseStamped
00051 # A Pose with reference coordinate frame and timestamp
00052 Header header
00053 Pose pose
00054
00055 ================================================================================
00056 MSG: std_msgs/Header
00057 # Standard metadata for higher-level stamped data types.
00058 # This is generally used to communicate timestamped data
00059 # in a particular coordinate frame.
00060 #
00061 # sequence ID: consecutively increasing ID
00062 uint32 seq
00063 #Two-integer timestamp that is expressed as:
00064 # * stamp.secs: seconds (stamp_secs) since epoch
00065 # * stamp.nsecs: nanoseconds since stamp_secs
00066 # time-handling sugar is provided by the client library
00067 time stamp
00068 #Frame this data is associated with
00069 # 0: no frame
00070 # 1: global frame
00071 string frame_id
00072
00073 ================================================================================
00074 MSG: geometry_msgs/Pose
00075 # A representation of pose in free space, composed of postion and orientation.
00076 Point position
00077 Quaternion orientation
00078
00079 ================================================================================
00080 MSG: geometry_msgs/Quaternion
00081 # This represents an orientation in free space in quaternion form.
00082
00083 float64 x
00084 float64 y
00085 float64 z
00086 float64 w
00087
00088 """
00089 __slots__ = ['hypotheses','accept']
00090 _slot_types = ['interactive_perception_msgs/ModelHypothesis[]','bool']
00091
00092 def __init__(self, *args, **kwds):
00093 """
00094 Constructor. Any message fields that are implicitly/explicitly
00095 set to None will be assigned a default value. The recommend
00096 use is keyword arguments as this is more robust to future message
00097 changes. You cannot mix in-order arguments and keyword arguments.
00098
00099 The available fields are:
00100 hypotheses,accept
00101
00102 :param args: complete set of field values, in .msg order
00103 :param kwds: use keyword arguments corresponding to message field names
00104 to set specific fields.
00105 """
00106 if args or kwds:
00107 super(ModelHypothesisList, self).__init__(*args, **kwds)
00108
00109 if self.hypotheses is None:
00110 self.hypotheses = []
00111 if self.accept is None:
00112 self.accept = False
00113 else:
00114 self.hypotheses = []
00115 self.accept = False
00116
00117 def _get_types(self):
00118 """
00119 internal API method
00120 """
00121 return self._slot_types
00122
00123 def serialize(self, buff):
00124 """
00125 serialize message into buffer
00126 :param buff: buffer, ``StringIO``
00127 """
00128 try:
00129 length = len(self.hypotheses)
00130 buff.write(_struct_I.pack(length))
00131 for val1 in self.hypotheses:
00132 _v1 = val1.mesh
00133 length = len(_v1.triangles)
00134 buff.write(_struct_I.pack(length))
00135 for val3 in _v1.triangles:
00136 buff.write(_struct_3I.pack(*val3.vertex_indices))
00137 length = len(_v1.vertices)
00138 buff.write(_struct_I.pack(length))
00139 for val3 in _v1.vertices:
00140 _x = val3
00141 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00142 _v2 = val1.pose
00143 _v3 = _v2.header
00144 buff.write(_struct_I.pack(_v3.seq))
00145 _v4 = _v3.stamp
00146 _x = _v4
00147 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00148 _x = _v3.frame_id
00149 length = len(_x)
00150 if python3 or type(_x) == unicode:
00151 _x = _x.encode('utf-8')
00152 length = len(_x)
00153 buff.write(struct.pack('<I%ss'%length, length, _x))
00154 _v5 = _v2.pose
00155 _v6 = _v5.position
00156 _x = _v6
00157 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00158 _v7 = _v5.orientation
00159 _x = _v7
00160 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00161 buff.write(_struct_B.pack(self.accept))
00162 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00163 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00164
00165 def deserialize(self, str):
00166 """
00167 unpack serialized message in str into this message instance
00168 :param str: byte array of serialized message, ``str``
00169 """
00170 try:
00171 if self.hypotheses is None:
00172 self.hypotheses = None
00173 end = 0
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 self.hypotheses = []
00178 for i in range(0, length):
00179 val1 = interactive_perception_msgs.msg.ModelHypothesis()
00180 _v8 = val1.mesh
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 _v8.triangles = []
00185 for i in range(0, length):
00186 val3 = shape_msgs.msg.MeshTriangle()
00187 start = end
00188 end += 12
00189 val3.vertex_indices = _struct_3I.unpack(str[start:end])
00190 _v8.triangles.append(val3)
00191 start = end
00192 end += 4
00193 (length,) = _struct_I.unpack(str[start:end])
00194 _v8.vertices = []
00195 for i in range(0, length):
00196 val3 = geometry_msgs.msg.Point()
00197 _x = val3
00198 start = end
00199 end += 24
00200 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00201 _v8.vertices.append(val3)
00202 _v9 = val1.pose
00203 _v10 = _v9.header
00204 start = end
00205 end += 4
00206 (_v10.seq,) = _struct_I.unpack(str[start:end])
00207 _v11 = _v10.stamp
00208 _x = _v11
00209 start = end
00210 end += 8
00211 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 start = end
00216 end += length
00217 if python3:
00218 _v10.frame_id = str[start:end].decode('utf-8')
00219 else:
00220 _v10.frame_id = str[start:end]
00221 _v12 = _v9.pose
00222 _v13 = _v12.position
00223 _x = _v13
00224 start = end
00225 end += 24
00226 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00227 _v14 = _v12.orientation
00228 _x = _v14
00229 start = end
00230 end += 32
00231 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00232 self.hypotheses.append(val1)
00233 start = end
00234 end += 1
00235 (self.accept,) = _struct_B.unpack(str[start:end])
00236 self.accept = bool(self.accept)
00237 return self
00238 except struct.error as e:
00239 raise genpy.DeserializationError(e)
00240
00241
00242 def serialize_numpy(self, buff, numpy):
00243 """
00244 serialize message with numpy array types into buffer
00245 :param buff: buffer, ``StringIO``
00246 :param numpy: numpy python module
00247 """
00248 try:
00249 length = len(self.hypotheses)
00250 buff.write(_struct_I.pack(length))
00251 for val1 in self.hypotheses:
00252 _v15 = val1.mesh
00253 length = len(_v15.triangles)
00254 buff.write(_struct_I.pack(length))
00255 for val3 in _v15.triangles:
00256 buff.write(val3.vertex_indices.tostring())
00257 length = len(_v15.vertices)
00258 buff.write(_struct_I.pack(length))
00259 for val3 in _v15.vertices:
00260 _x = val3
00261 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00262 _v16 = val1.pose
00263 _v17 = _v16.header
00264 buff.write(_struct_I.pack(_v17.seq))
00265 _v18 = _v17.stamp
00266 _x = _v18
00267 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00268 _x = _v17.frame_id
00269 length = len(_x)
00270 if python3 or type(_x) == unicode:
00271 _x = _x.encode('utf-8')
00272 length = len(_x)
00273 buff.write(struct.pack('<I%ss'%length, length, _x))
00274 _v19 = _v16.pose
00275 _v20 = _v19.position
00276 _x = _v20
00277 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00278 _v21 = _v19.orientation
00279 _x = _v21
00280 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00281 buff.write(_struct_B.pack(self.accept))
00282 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00283 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00284
00285 def deserialize_numpy(self, str, numpy):
00286 """
00287 unpack serialized message in str into this message instance using numpy for array types
00288 :param str: byte array of serialized message, ``str``
00289 :param numpy: numpy python module
00290 """
00291 try:
00292 if self.hypotheses is None:
00293 self.hypotheses = None
00294 end = 0
00295 start = end
00296 end += 4
00297 (length,) = _struct_I.unpack(str[start:end])
00298 self.hypotheses = []
00299 for i in range(0, length):
00300 val1 = interactive_perception_msgs.msg.ModelHypothesis()
00301 _v22 = val1.mesh
00302 start = end
00303 end += 4
00304 (length,) = _struct_I.unpack(str[start:end])
00305 _v22.triangles = []
00306 for i in range(0, length):
00307 val3 = shape_msgs.msg.MeshTriangle()
00308 start = end
00309 end += 12
00310 val3.vertex_indices = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=3)
00311 _v22.triangles.append(val3)
00312 start = end
00313 end += 4
00314 (length,) = _struct_I.unpack(str[start:end])
00315 _v22.vertices = []
00316 for i in range(0, length):
00317 val3 = geometry_msgs.msg.Point()
00318 _x = val3
00319 start = end
00320 end += 24
00321 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00322 _v22.vertices.append(val3)
00323 _v23 = val1.pose
00324 _v24 = _v23.header
00325 start = end
00326 end += 4
00327 (_v24.seq,) = _struct_I.unpack(str[start:end])
00328 _v25 = _v24.stamp
00329 _x = _v25
00330 start = end
00331 end += 8
00332 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00333 start = end
00334 end += 4
00335 (length,) = _struct_I.unpack(str[start:end])
00336 start = end
00337 end += length
00338 if python3:
00339 _v24.frame_id = str[start:end].decode('utf-8')
00340 else:
00341 _v24.frame_id = str[start:end]
00342 _v26 = _v23.pose
00343 _v27 = _v26.position
00344 _x = _v27
00345 start = end
00346 end += 24
00347 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00348 _v28 = _v26.orientation
00349 _x = _v28
00350 start = end
00351 end += 32
00352 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00353 self.hypotheses.append(val1)
00354 start = end
00355 end += 1
00356 (self.accept,) = _struct_B.unpack(str[start:end])
00357 self.accept = bool(self.accept)
00358 return self
00359 except struct.error as e:
00360 raise genpy.DeserializationError(e)
00361
00362 _struct_I = genpy.struct_I
00363 _struct_B = struct.Struct("<B")
00364 _struct_3I = struct.Struct("<3I")
00365 _struct_4d = struct.Struct("<4d")
00366 _struct_2I = struct.Struct("<2I")
00367 _struct_3d = struct.Struct("<3d")