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