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