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


object_recognition_gui
Author(s): David Gossow
autogenerated on Fri Jan 3 2014 12:01:17