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