_GetModelMesh.py
Go to the documentation of this file.
00001 """autogenerated by genpy from household_objects_database_msgs/GetModelMeshRequest.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 GetModelMeshRequest(genpy.Message):
00009   _md5sum = "28cb0598daf3b969068a38cd07aaa9f6"
00010   _type = "household_objects_database_msgs/GetModelMeshRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """
00013 
00014 
00015 int32 model_id
00016 
00017 
00018 """
00019   __slots__ = ['model_id']
00020   _slot_types = ['int32']
00021 
00022   def __init__(self, *args, **kwds):
00023     """
00024     Constructor. Any message fields that are implicitly/explicitly
00025     set to None will be assigned a default value. The recommend
00026     use is keyword arguments as this is more robust to future message
00027     changes.  You cannot mix in-order arguments and keyword arguments.
00028 
00029     The available fields are:
00030        model_id
00031 
00032     :param args: complete set of field values, in .msg order
00033     :param kwds: use keyword arguments corresponding to message field names
00034     to set specific fields.
00035     """
00036     if args or kwds:
00037       super(GetModelMeshRequest, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.model_id is None:
00040         self.model_id = 0
00041     else:
00042       self.model_id = 0
00043 
00044   def _get_types(self):
00045     """
00046     internal API method
00047     """
00048     return self._slot_types
00049 
00050   def serialize(self, buff):
00051     """
00052     serialize message into buffer
00053     :param buff: buffer, ``StringIO``
00054     """
00055     try:
00056       buff.write(_struct_i.pack(self.model_id))
00057     except struct.error as se: self._check_types(se)
00058     except TypeError as te: self._check_types(te)
00059 
00060   def deserialize(self, str):
00061     """
00062     unpack serialized message in str into this message instance
00063     :param str: byte array of serialized message, ``str``
00064     """
00065     try:
00066       end = 0
00067       start = end
00068       end += 4
00069       (self.model_id,) = _struct_i.unpack(str[start:end])
00070       return self
00071     except struct.error as e:
00072       raise genpy.DeserializationError(e) #most likely buffer underfill
00073 
00074 
00075   def serialize_numpy(self, buff, numpy):
00076     """
00077     serialize message with numpy array types into buffer
00078     :param buff: buffer, ``StringIO``
00079     :param numpy: numpy python module
00080     """
00081     try:
00082       buff.write(_struct_i.pack(self.model_id))
00083     except struct.error as se: self._check_types(se)
00084     except TypeError as te: self._check_types(te)
00085 
00086   def deserialize_numpy(self, str, numpy):
00087     """
00088     unpack serialized message in str into this message instance using numpy for array types
00089     :param str: byte array of serialized message, ``str``
00090     :param numpy: numpy python module
00091     """
00092     try:
00093       end = 0
00094       start = end
00095       end += 4
00096       (self.model_id,) = _struct_i.unpack(str[start:end])
00097       return self
00098     except struct.error as e:
00099       raise genpy.DeserializationError(e) #most likely buffer underfill
00100 
00101 _struct_I = genpy.struct_I
00102 _struct_i = struct.Struct("<i")
00103 """autogenerated by genpy from household_objects_database_msgs/GetModelMeshResponse.msg. Do not edit."""
00104 import sys
00105 python3 = True if sys.hexversion > 0x03000000 else False
00106 import genpy
00107 import struct
00108 
00109 import arm_navigation_msgs.msg
00110 import geometry_msgs.msg
00111 import household_objects_database_msgs.msg
00112 
00113 class GetModelMeshResponse(genpy.Message):
00114   _md5sum = "c80005b4fe4c8f41b80f3d8cffb7852f"
00115   _type = "household_objects_database_msgs/GetModelMeshResponse"
00116   _has_header = False #flag to mark the presence of a Header object
00117   _full_text = """
00118 
00119 DatabaseReturnCode return_code
00120 
00121 
00122 arm_navigation_msgs/Shape mesh
00123 
00124 
00125 ================================================================================
00126 MSG: household_objects_database_msgs/DatabaseReturnCode
00127 # return codes for database-related services
00128 
00129 int32 UNKNOWN_ERROR = 1
00130 int32 DATABASE_NOT_CONNECTED = 2
00131 int32 DATABASE_QUERY_ERROR = 3
00132 int32 SUCCESS = -1
00133 
00134 int32 code
00135 ================================================================================
00136 MSG: arm_navigation_msgs/Shape
00137 byte SPHERE=0
00138 byte BOX=1
00139 byte CYLINDER=2
00140 byte MESH=3
00141 
00142 byte type
00143 
00144 
00145 #### define sphere, box, cylinder ####
00146 # the origin of each shape is considered at the shape's center
00147 
00148 # for sphere
00149 # radius := dimensions[0]
00150 
00151 # for cylinder
00152 # radius := dimensions[0]
00153 # length := dimensions[1]
00154 # the length is along the Z axis
00155 
00156 # for box
00157 # size_x := dimensions[0]
00158 # size_y := dimensions[1]
00159 # size_z := dimensions[2]
00160 float64[] dimensions
00161 
00162 
00163 #### define mesh ####
00164 
00165 # list of triangles; triangle k is defined by tre vertices located
00166 # at indices triangles[3k], triangles[3k+1], triangles[3k+2]
00167 int32[] triangles
00168 geometry_msgs/Point[] vertices
00169 
00170 ================================================================================
00171 MSG: geometry_msgs/Point
00172 # This contains the position of a point in free space
00173 float64 x
00174 float64 y
00175 float64 z
00176 
00177 """
00178   __slots__ = ['return_code','mesh']
00179   _slot_types = ['household_objects_database_msgs/DatabaseReturnCode','arm_navigation_msgs/Shape']
00180 
00181   def __init__(self, *args, **kwds):
00182     """
00183     Constructor. Any message fields that are implicitly/explicitly
00184     set to None will be assigned a default value. The recommend
00185     use is keyword arguments as this is more robust to future message
00186     changes.  You cannot mix in-order arguments and keyword arguments.
00187 
00188     The available fields are:
00189        return_code,mesh
00190 
00191     :param args: complete set of field values, in .msg order
00192     :param kwds: use keyword arguments corresponding to message field names
00193     to set specific fields.
00194     """
00195     if args or kwds:
00196       super(GetModelMeshResponse, self).__init__(*args, **kwds)
00197       #message fields cannot be None, assign default values for those that are
00198       if self.return_code is None:
00199         self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00200       if self.mesh is None:
00201         self.mesh = arm_navigation_msgs.msg.Shape()
00202     else:
00203       self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00204       self.mesh = arm_navigation_msgs.msg.Shape()
00205 
00206   def _get_types(self):
00207     """
00208     internal API method
00209     """
00210     return self._slot_types
00211 
00212   def serialize(self, buff):
00213     """
00214     serialize message into buffer
00215     :param buff: buffer, ``StringIO``
00216     """
00217     try:
00218       _x = self
00219       buff.write(_struct_ib.pack(_x.return_code.code, _x.mesh.type))
00220       length = len(self.mesh.dimensions)
00221       buff.write(_struct_I.pack(length))
00222       pattern = '<%sd'%length
00223       buff.write(struct.pack(pattern, *self.mesh.dimensions))
00224       length = len(self.mesh.triangles)
00225       buff.write(_struct_I.pack(length))
00226       pattern = '<%si'%length
00227       buff.write(struct.pack(pattern, *self.mesh.triangles))
00228       length = len(self.mesh.vertices)
00229       buff.write(_struct_I.pack(length))
00230       for val1 in self.mesh.vertices:
00231         _x = val1
00232         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00233     except struct.error as se: self._check_types(se)
00234     except TypeError as te: self._check_types(te)
00235 
00236   def deserialize(self, str):
00237     """
00238     unpack serialized message in str into this message instance
00239     :param str: byte array of serialized message, ``str``
00240     """
00241     try:
00242       if self.return_code is None:
00243         self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00244       if self.mesh is None:
00245         self.mesh = arm_navigation_msgs.msg.Shape()
00246       end = 0
00247       _x = self
00248       start = end
00249       end += 5
00250       (_x.return_code.code, _x.mesh.type,) = _struct_ib.unpack(str[start:end])
00251       start = end
00252       end += 4
00253       (length,) = _struct_I.unpack(str[start:end])
00254       pattern = '<%sd'%length
00255       start = end
00256       end += struct.calcsize(pattern)
00257       self.mesh.dimensions = struct.unpack(pattern, str[start:end])
00258       start = end
00259       end += 4
00260       (length,) = _struct_I.unpack(str[start:end])
00261       pattern = '<%si'%length
00262       start = end
00263       end += struct.calcsize(pattern)
00264       self.mesh.triangles = struct.unpack(pattern, str[start:end])
00265       start = end
00266       end += 4
00267       (length,) = _struct_I.unpack(str[start:end])
00268       self.mesh.vertices = []
00269       for i in range(0, length):
00270         val1 = geometry_msgs.msg.Point()
00271         _x = val1
00272         start = end
00273         end += 24
00274         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00275         self.mesh.vertices.append(val1)
00276       return self
00277     except struct.error as e:
00278       raise genpy.DeserializationError(e) #most likely buffer underfill
00279 
00280 
00281   def serialize_numpy(self, buff, numpy):
00282     """
00283     serialize message with numpy array types into buffer
00284     :param buff: buffer, ``StringIO``
00285     :param numpy: numpy python module
00286     """
00287     try:
00288       _x = self
00289       buff.write(_struct_ib.pack(_x.return_code.code, _x.mesh.type))
00290       length = len(self.mesh.dimensions)
00291       buff.write(_struct_I.pack(length))
00292       pattern = '<%sd'%length
00293       buff.write(self.mesh.dimensions.tostring())
00294       length = len(self.mesh.triangles)
00295       buff.write(_struct_I.pack(length))
00296       pattern = '<%si'%length
00297       buff.write(self.mesh.triangles.tostring())
00298       length = len(self.mesh.vertices)
00299       buff.write(_struct_I.pack(length))
00300       for val1 in self.mesh.vertices:
00301         _x = val1
00302         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00303     except struct.error as se: self._check_types(se)
00304     except TypeError as te: self._check_types(te)
00305 
00306   def deserialize_numpy(self, str, numpy):
00307     """
00308     unpack serialized message in str into this message instance using numpy for array types
00309     :param str: byte array of serialized message, ``str``
00310     :param numpy: numpy python module
00311     """
00312     try:
00313       if self.return_code is None:
00314         self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00315       if self.mesh is None:
00316         self.mesh = arm_navigation_msgs.msg.Shape()
00317       end = 0
00318       _x = self
00319       start = end
00320       end += 5
00321       (_x.return_code.code, _x.mesh.type,) = _struct_ib.unpack(str[start:end])
00322       start = end
00323       end += 4
00324       (length,) = _struct_I.unpack(str[start:end])
00325       pattern = '<%sd'%length
00326       start = end
00327       end += struct.calcsize(pattern)
00328       self.mesh.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00329       start = end
00330       end += 4
00331       (length,) = _struct_I.unpack(str[start:end])
00332       pattern = '<%si'%length
00333       start = end
00334       end += struct.calcsize(pattern)
00335       self.mesh.triangles = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00336       start = end
00337       end += 4
00338       (length,) = _struct_I.unpack(str[start:end])
00339       self.mesh.vertices = []
00340       for i in range(0, length):
00341         val1 = geometry_msgs.msg.Point()
00342         _x = val1
00343         start = end
00344         end += 24
00345         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00346         self.mesh.vertices.append(val1)
00347       return self
00348     except struct.error as e:
00349       raise genpy.DeserializationError(e) #most likely buffer underfill
00350 
00351 _struct_I = genpy.struct_I
00352 _struct_ib = struct.Struct("<ib")
00353 _struct_3d = struct.Struct("<3d")
00354 class GetModelMesh(object):
00355   _type          = 'household_objects_database_msgs/GetModelMesh'
00356   _md5sum = '5818acc32a9241b18f7b8a9445b38537'
00357   _request_class  = GetModelMeshRequest
00358   _response_class = GetModelMeshResponse


household_objects_database_msgs
Author(s): Matei Ciocarlie
autogenerated on Thu Jan 2 2014 11:37:20