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 as se: self._check_types(se)
00057 except TypeError as 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 as 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 as se: self._check_types(se)
00086 except TypeError as 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 as 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 arm_navigation_msgs.msg
00112 import geometry_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 arm_navigation_msgs/Shape mesh
00125
00126
00127 ================================================================================
00128 MSG: household_objects_database_msgs/DatabaseReturnCode
00129 # return codes for database-related services
00130
00131 int32 UNKNOWN_ERROR = 1
00132 int32 DATABASE_NOT_CONNECTED = 2
00133 int32 DATABASE_QUERY_ERROR = 3
00134 int32 SUCCESS = -1
00135
00136 int32 code
00137 ================================================================================
00138 MSG: arm_navigation_msgs/Shape
00139 byte SPHERE=0
00140 byte BOX=1
00141 byte CYLINDER=2
00142 byte MESH=3
00143
00144 byte type
00145
00146
00147 #### define sphere, box, cylinder ####
00148 # the origin of each shape is considered at the shape's center
00149
00150 # for sphere
00151 # radius := dimensions[0]
00152
00153 # for cylinder
00154 # radius := dimensions[0]
00155 # length := dimensions[1]
00156 # the length is along the Z axis
00157
00158 # for box
00159 # size_x := dimensions[0]
00160 # size_y := dimensions[1]
00161 # size_z := dimensions[2]
00162 float64[] dimensions
00163
00164
00165 #### define mesh ####
00166
00167 # list of triangles; triangle k is defined by tre vertices located
00168 # at indices triangles[3k], triangles[3k+1], triangles[3k+2]
00169 int32[] triangles
00170 geometry_msgs/Point[] vertices
00171
00172 ================================================================================
00173 MSG: geometry_msgs/Point
00174 # This contains the position of a point in free space
00175 float64 x
00176 float64 y
00177 float64 z
00178
00179 """
00180 __slots__ = ['return_code','mesh']
00181 _slot_types = ['household_objects_database_msgs/DatabaseReturnCode','arm_navigation_msgs/Shape']
00182
00183 def __init__(self, *args, **kwds):
00184 """
00185 Constructor. Any message fields that are implicitly/explicitly
00186 set to None will be assigned a default value. The recommend
00187 use is keyword arguments as this is more robust to future message
00188 changes. You cannot mix in-order arguments and keyword arguments.
00189
00190 The available fields are:
00191 return_code,mesh
00192
00193 @param args: complete set of field values, in .msg order
00194 @param kwds: use keyword arguments corresponding to message field names
00195 to set specific fields.
00196 """
00197 if args or kwds:
00198 super(GetModelMeshResponse, self).__init__(*args, **kwds)
00199
00200 if self.return_code is None:
00201 self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00202 if self.mesh is None:
00203 self.mesh = arm_navigation_msgs.msg.Shape()
00204 else:
00205 self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00206 self.mesh = arm_navigation_msgs.msg.Shape()
00207
00208 def _get_types(self):
00209 """
00210 internal API method
00211 """
00212 return self._slot_types
00213
00214 def serialize(self, buff):
00215 """
00216 serialize message into buffer
00217 @param buff: buffer
00218 @type buff: StringIO
00219 """
00220 try:
00221 _x = self
00222 buff.write(_struct_ib.pack(_x.return_code.code, _x.mesh.type))
00223 length = len(self.mesh.dimensions)
00224 buff.write(_struct_I.pack(length))
00225 pattern = '<%sd'%length
00226 buff.write(struct.pack(pattern, *self.mesh.dimensions))
00227 length = len(self.mesh.triangles)
00228 buff.write(_struct_I.pack(length))
00229 pattern = '<%si'%length
00230 buff.write(struct.pack(pattern, *self.mesh.triangles))
00231 length = len(self.mesh.vertices)
00232 buff.write(_struct_I.pack(length))
00233 for val1 in self.mesh.vertices:
00234 _x = val1
00235 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00236 except struct.error as se: self._check_types(se)
00237 except TypeError as te: self._check_types(te)
00238
00239 def deserialize(self, str):
00240 """
00241 unpack serialized message in str into this message instance
00242 @param str: byte array of serialized message
00243 @type str: str
00244 """
00245 try:
00246 if self.return_code is None:
00247 self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00248 if self.mesh is None:
00249 self.mesh = arm_navigation_msgs.msg.Shape()
00250 end = 0
00251 _x = self
00252 start = end
00253 end += 5
00254 (_x.return_code.code, _x.mesh.type,) = _struct_ib.unpack(str[start:end])
00255 start = end
00256 end += 4
00257 (length,) = _struct_I.unpack(str[start:end])
00258 pattern = '<%sd'%length
00259 start = end
00260 end += struct.calcsize(pattern)
00261 self.mesh.dimensions = struct.unpack(pattern, str[start:end])
00262 start = end
00263 end += 4
00264 (length,) = _struct_I.unpack(str[start:end])
00265 pattern = '<%si'%length
00266 start = end
00267 end += struct.calcsize(pattern)
00268 self.mesh.triangles = struct.unpack(pattern, str[start:end])
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 self.mesh.vertices = []
00273 for i in range(0, length):
00274 val1 = geometry_msgs.msg.Point()
00275 _x = val1
00276 start = end
00277 end += 24
00278 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00279 self.mesh.vertices.append(val1)
00280 return self
00281 except struct.error as e:
00282 raise roslib.message.DeserializationError(e)
00283
00284
00285 def serialize_numpy(self, buff, numpy):
00286 """
00287 serialize message with numpy array types into buffer
00288 @param buff: buffer
00289 @type buff: StringIO
00290 @param numpy: numpy python module
00291 @type numpy module
00292 """
00293 try:
00294 _x = self
00295 buff.write(_struct_ib.pack(_x.return_code.code, _x.mesh.type))
00296 length = len(self.mesh.dimensions)
00297 buff.write(_struct_I.pack(length))
00298 pattern = '<%sd'%length
00299 buff.write(self.mesh.dimensions.tostring())
00300 length = len(self.mesh.triangles)
00301 buff.write(_struct_I.pack(length))
00302 pattern = '<%si'%length
00303 buff.write(self.mesh.triangles.tostring())
00304 length = len(self.mesh.vertices)
00305 buff.write(_struct_I.pack(length))
00306 for val1 in self.mesh.vertices:
00307 _x = val1
00308 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00309 except struct.error as se: self._check_types(se)
00310 except TypeError as te: self._check_types(te)
00311
00312 def deserialize_numpy(self, str, numpy):
00313 """
00314 unpack serialized message in str into this message instance using numpy for array types
00315 @param str: byte array of serialized message
00316 @type str: str
00317 @param numpy: numpy python module
00318 @type numpy: module
00319 """
00320 try:
00321 if self.return_code is None:
00322 self.return_code = household_objects_database_msgs.msg.DatabaseReturnCode()
00323 if self.mesh is None:
00324 self.mesh = arm_navigation_msgs.msg.Shape()
00325 end = 0
00326 _x = self
00327 start = end
00328 end += 5
00329 (_x.return_code.code, _x.mesh.type,) = _struct_ib.unpack(str[start:end])
00330 start = end
00331 end += 4
00332 (length,) = _struct_I.unpack(str[start:end])
00333 pattern = '<%sd'%length
00334 start = end
00335 end += struct.calcsize(pattern)
00336 self.mesh.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00337 start = end
00338 end += 4
00339 (length,) = _struct_I.unpack(str[start:end])
00340 pattern = '<%si'%length
00341 start = end
00342 end += struct.calcsize(pattern)
00343 self.mesh.triangles = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00344 start = end
00345 end += 4
00346 (length,) = _struct_I.unpack(str[start:end])
00347 self.mesh.vertices = []
00348 for i in range(0, length):
00349 val1 = geometry_msgs.msg.Point()
00350 _x = val1
00351 start = end
00352 end += 24
00353 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00354 self.mesh.vertices.append(val1)
00355 return self
00356 except struct.error as e:
00357 raise roslib.message.DeserializationError(e)
00358
00359 _struct_I = roslib.message.struct_I
00360 _struct_ib = struct.Struct("<ib")
00361 _struct_3d = struct.Struct("<3d")
00362 class GetModelMesh(roslib.message.ServiceDefinition):
00363 _type = 'household_objects_database_msgs/GetModelMesh'
00364 _md5sum = '5818acc32a9241b18f7b8a9445b38537'
00365 _request_class = GetModelMeshRequest
00366 _response_class = GetModelMeshResponse