$search
00001 """autogenerated by genmsg_py from ShapeArray.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 import sensor_msgs.msg 00007 import cob_3d_mapping_msgs.msg 00008 import std_msgs.msg 00009 00010 class ShapeArray(roslib.message.Message): 00011 _md5sum = "24df939600330ea9ee1a25b046aef0f9" 00012 _type = "cob_3d_mapping_msgs/ShapeArray" 00013 _has_header = True #flag to mark the presence of a Header object 00014 _full_text = """# An array of poses with a header for global reference. 00015 00016 Header header 00017 00018 cob_3d_mapping_msgs/Shape[] shapes 00019 ================================================================================ 00020 MSG: std_msgs/Header 00021 # Standard metadata for higher-level stamped data types. 00022 # This is generally used to communicate timestamped data 00023 # in a particular coordinate frame. 00024 # 00025 # sequence ID: consecutively increasing ID 00026 uint32 seq 00027 #Two-integer timestamp that is expressed as: 00028 # * stamp.secs: seconds (stamp_secs) since epoch 00029 # * stamp.nsecs: nanoseconds since stamp_secs 00030 # time-handling sugar is provided by the client library 00031 time stamp 00032 #Frame this data is associated with 00033 # 0: no frame 00034 # 1: global frame 00035 string frame_id 00036 00037 ================================================================================ 00038 MSG: cob_3d_mapping_msgs/Shape 00039 Header header 00040 00041 uint8 POLYGON=0 00042 uint8 LINE=1 00043 uint8 CURVED=2 00044 uint8 MESH=3 00045 uint8 OTHER=4 00046 uint8 CYLINDER=5 00047 # potential extensions: SPHERE, CYLINDER, BOX 00048 00049 uint8 type 00050 00051 00052 int32 id 00053 # define shape parameters 00054 # for plane 00055 # normal vector = params[0],params[1],params[2] 00056 # d = params[3] 00057 # for line 00058 # direction vector = params[0],params[1],params[2] 00059 # 00060 #for cylinder 00061 # symmetry axis = params[0],params[1],params[2] 00062 # z axis = params[3], params[4], params[5] 00063 # origin = params[6], params[7], params[8] 00064 # radius = params[9] 00065 # 00066 float64[] params 00067 00068 sensor_msgs/PointCloud2[] points 00069 00070 #### define mesh #### 00071 # each three entries form a triangle; indices of points are stored 00072 int32[] vertices 00073 00074 geometry_msgs/Point32 centroid 00075 std_msgs/ColorRGBA color 00076 bool[] holes 00077 00078 ================================================================================ 00079 MSG: sensor_msgs/PointCloud2 00080 # This message holds a collection of N-dimensional points, which may 00081 # contain additional information such as normals, intensity, etc. The 00082 # point data is stored as a binary blob, its layout described by the 00083 # contents of the "fields" array. 00084 00085 # The point cloud data may be organized 2d (image-like) or 1d 00086 # (unordered). Point clouds organized as 2d images may be produced by 00087 # camera depth sensors such as stereo or time-of-flight. 00088 00089 # Time of sensor data acquisition, and the coordinate frame ID (for 3d 00090 # points). 00091 Header header 00092 00093 # 2D structure of the point cloud. If the cloud is unordered, height is 00094 # 1 and width is the length of the point cloud. 00095 uint32 height 00096 uint32 width 00097 00098 # Describes the channels and their layout in the binary data blob. 00099 PointField[] fields 00100 00101 bool is_bigendian # Is this data bigendian? 00102 uint32 point_step # Length of a point in bytes 00103 uint32 row_step # Length of a row in bytes 00104 uint8[] data # Actual point data, size is (row_step*height) 00105 00106 bool is_dense # True if there are no invalid points 00107 00108 ================================================================================ 00109 MSG: sensor_msgs/PointField 00110 # This message holds the description of one point entry in the 00111 # PointCloud2 message format. 00112 uint8 INT8 = 1 00113 uint8 UINT8 = 2 00114 uint8 INT16 = 3 00115 uint8 UINT16 = 4 00116 uint8 INT32 = 5 00117 uint8 UINT32 = 6 00118 uint8 FLOAT32 = 7 00119 uint8 FLOAT64 = 8 00120 00121 string name # Name of field 00122 uint32 offset # Offset from start of point struct 00123 uint8 datatype # Datatype enumeration, see above 00124 uint32 count # How many elements in the field 00125 00126 ================================================================================ 00127 MSG: geometry_msgs/Point32 00128 # This contains the position of a point in free space(with 32 bits of precision). 00129 # It is recommeded to use Point wherever possible instead of Point32. 00130 # 00131 # This recommendation is to promote interoperability. 00132 # 00133 # This message is designed to take up less space when sending 00134 # lots of points at once, as in the case of a PointCloud. 00135 00136 float32 x 00137 float32 y 00138 float32 z 00139 ================================================================================ 00140 MSG: std_msgs/ColorRGBA 00141 float32 r 00142 float32 g 00143 float32 b 00144 float32 a 00145 00146 """ 00147 __slots__ = ['header','shapes'] 00148 _slot_types = ['Header','cob_3d_mapping_msgs/Shape[]'] 00149 00150 def __init__(self, *args, **kwds): 00151 """ 00152 Constructor. Any message fields that are implicitly/explicitly 00153 set to None will be assigned a default value. The recommend 00154 use is keyword arguments as this is more robust to future message 00155 changes. You cannot mix in-order arguments and keyword arguments. 00156 00157 The available fields are: 00158 header,shapes 00159 00160 @param args: complete set of field values, in .msg order 00161 @param kwds: use keyword arguments corresponding to message field names 00162 to set specific fields. 00163 """ 00164 if args or kwds: 00165 super(ShapeArray, self).__init__(*args, **kwds) 00166 #message fields cannot be None, assign default values for those that are 00167 if self.header is None: 00168 self.header = std_msgs.msg._Header.Header() 00169 if self.shapes is None: 00170 self.shapes = [] 00171 else: 00172 self.header = std_msgs.msg._Header.Header() 00173 self.shapes = [] 00174 00175 def _get_types(self): 00176 """ 00177 internal API method 00178 """ 00179 return self._slot_types 00180 00181 def serialize(self, buff): 00182 """ 00183 serialize message into buffer 00184 @param buff: buffer 00185 @type buff: StringIO 00186 """ 00187 try: 00188 _x = self 00189 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00190 _x = self.header.frame_id 00191 length = len(_x) 00192 buff.write(struct.pack('<I%ss'%length, length, _x)) 00193 length = len(self.shapes) 00194 buff.write(_struct_I.pack(length)) 00195 for val1 in self.shapes: 00196 _v1 = val1.header 00197 buff.write(_struct_I.pack(_v1.seq)) 00198 _v2 = _v1.stamp 00199 _x = _v2 00200 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00201 _x = _v1.frame_id 00202 length = len(_x) 00203 buff.write(struct.pack('<I%ss'%length, length, _x)) 00204 _x = val1 00205 buff.write(_struct_Bi.pack(_x.type, _x.id)) 00206 length = len(val1.params) 00207 buff.write(_struct_I.pack(length)) 00208 pattern = '<%sd'%length 00209 buff.write(struct.pack(pattern, *val1.params)) 00210 length = len(val1.points) 00211 buff.write(_struct_I.pack(length)) 00212 for val2 in val1.points: 00213 _v3 = val2.header 00214 buff.write(_struct_I.pack(_v3.seq)) 00215 _v4 = _v3.stamp 00216 _x = _v4 00217 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00218 _x = _v3.frame_id 00219 length = len(_x) 00220 buff.write(struct.pack('<I%ss'%length, length, _x)) 00221 _x = val2 00222 buff.write(_struct_2I.pack(_x.height, _x.width)) 00223 length = len(val2.fields) 00224 buff.write(_struct_I.pack(length)) 00225 for val3 in val2.fields: 00226 _x = val3.name 00227 length = len(_x) 00228 buff.write(struct.pack('<I%ss'%length, length, _x)) 00229 _x = val3 00230 buff.write(_struct_IBI.pack(_x.offset, _x.datatype, _x.count)) 00231 _x = val2 00232 buff.write(_struct_B2I.pack(_x.is_bigendian, _x.point_step, _x.row_step)) 00233 _x = val2.data 00234 length = len(_x) 00235 # - if encoded as a list instead, serialize as bytes instead of string 00236 if type(_x) in [list, tuple]: 00237 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00238 else: 00239 buff.write(struct.pack('<I%ss'%length, length, _x)) 00240 buff.write(_struct_B.pack(val2.is_dense)) 00241 length = len(val1.vertices) 00242 buff.write(_struct_I.pack(length)) 00243 pattern = '<%si'%length 00244 buff.write(struct.pack(pattern, *val1.vertices)) 00245 _v5 = val1.centroid 00246 _x = _v5 00247 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00248 _v6 = val1.color 00249 _x = _v6 00250 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a)) 00251 length = len(val1.holes) 00252 buff.write(_struct_I.pack(length)) 00253 pattern = '<%sB'%length 00254 buff.write(struct.pack(pattern, *val1.holes)) 00255 except struct.error as se: self._check_types(se) 00256 except TypeError as te: self._check_types(te) 00257 00258 def deserialize(self, str): 00259 """ 00260 unpack serialized message in str into this message instance 00261 @param str: byte array of serialized message 00262 @type str: str 00263 """ 00264 try: 00265 if self.header is None: 00266 self.header = std_msgs.msg._Header.Header() 00267 end = 0 00268 _x = self 00269 start = end 00270 end += 12 00271 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00272 start = end 00273 end += 4 00274 (length,) = _struct_I.unpack(str[start:end]) 00275 start = end 00276 end += length 00277 self.header.frame_id = str[start:end] 00278 start = end 00279 end += 4 00280 (length,) = _struct_I.unpack(str[start:end]) 00281 self.shapes = [] 00282 for i in range(0, length): 00283 val1 = cob_3d_mapping_msgs.msg.Shape() 00284 _v7 = val1.header 00285 start = end 00286 end += 4 00287 (_v7.seq,) = _struct_I.unpack(str[start:end]) 00288 _v8 = _v7.stamp 00289 _x = _v8 00290 start = end 00291 end += 8 00292 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00293 start = end 00294 end += 4 00295 (length,) = _struct_I.unpack(str[start:end]) 00296 start = end 00297 end += length 00298 _v7.frame_id = str[start:end] 00299 _x = val1 00300 start = end 00301 end += 5 00302 (_x.type, _x.id,) = _struct_Bi.unpack(str[start:end]) 00303 start = end 00304 end += 4 00305 (length,) = _struct_I.unpack(str[start:end]) 00306 pattern = '<%sd'%length 00307 start = end 00308 end += struct.calcsize(pattern) 00309 val1.params = struct.unpack(pattern, str[start:end]) 00310 start = end 00311 end += 4 00312 (length,) = _struct_I.unpack(str[start:end]) 00313 val1.points = [] 00314 for i in range(0, length): 00315 val2 = sensor_msgs.msg.PointCloud2() 00316 _v9 = val2.header 00317 start = end 00318 end += 4 00319 (_v9.seq,) = _struct_I.unpack(str[start:end]) 00320 _v10 = _v9.stamp 00321 _x = _v10 00322 start = end 00323 end += 8 00324 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00325 start = end 00326 end += 4 00327 (length,) = _struct_I.unpack(str[start:end]) 00328 start = end 00329 end += length 00330 _v9.frame_id = str[start:end] 00331 _x = val2 00332 start = end 00333 end += 8 00334 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end]) 00335 start = end 00336 end += 4 00337 (length,) = _struct_I.unpack(str[start:end]) 00338 val2.fields = [] 00339 for i in range(0, length): 00340 val3 = sensor_msgs.msg.PointField() 00341 start = end 00342 end += 4 00343 (length,) = _struct_I.unpack(str[start:end]) 00344 start = end 00345 end += length 00346 val3.name = str[start:end] 00347 _x = val3 00348 start = end 00349 end += 9 00350 (_x.offset, _x.datatype, _x.count,) = _struct_IBI.unpack(str[start:end]) 00351 val2.fields.append(val3) 00352 _x = val2 00353 start = end 00354 end += 9 00355 (_x.is_bigendian, _x.point_step, _x.row_step,) = _struct_B2I.unpack(str[start:end]) 00356 val2.is_bigendian = bool(val2.is_bigendian) 00357 start = end 00358 end += 4 00359 (length,) = _struct_I.unpack(str[start:end]) 00360 start = end 00361 end += length 00362 val2.data = str[start:end] 00363 start = end 00364 end += 1 00365 (val2.is_dense,) = _struct_B.unpack(str[start:end]) 00366 val2.is_dense = bool(val2.is_dense) 00367 val1.points.append(val2) 00368 start = end 00369 end += 4 00370 (length,) = _struct_I.unpack(str[start:end]) 00371 pattern = '<%si'%length 00372 start = end 00373 end += struct.calcsize(pattern) 00374 val1.vertices = struct.unpack(pattern, str[start:end]) 00375 _v11 = val1.centroid 00376 _x = _v11 00377 start = end 00378 end += 12 00379 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00380 _v12 = val1.color 00381 _x = _v12 00382 start = end 00383 end += 16 00384 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end]) 00385 start = end 00386 end += 4 00387 (length,) = _struct_I.unpack(str[start:end]) 00388 pattern = '<%sB'%length 00389 start = end 00390 end += struct.calcsize(pattern) 00391 val1.holes = struct.unpack(pattern, str[start:end]) 00392 val1.holes = map(bool, val1.holes) 00393 self.shapes.append(val1) 00394 return self 00395 except struct.error as e: 00396 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00397 00398 00399 def serialize_numpy(self, buff, numpy): 00400 """ 00401 serialize message with numpy array types into buffer 00402 @param buff: buffer 00403 @type buff: StringIO 00404 @param numpy: numpy python module 00405 @type numpy module 00406 """ 00407 try: 00408 _x = self 00409 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00410 _x = self.header.frame_id 00411 length = len(_x) 00412 buff.write(struct.pack('<I%ss'%length, length, _x)) 00413 length = len(self.shapes) 00414 buff.write(_struct_I.pack(length)) 00415 for val1 in self.shapes: 00416 _v13 = val1.header 00417 buff.write(_struct_I.pack(_v13.seq)) 00418 _v14 = _v13.stamp 00419 _x = _v14 00420 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00421 _x = _v13.frame_id 00422 length = len(_x) 00423 buff.write(struct.pack('<I%ss'%length, length, _x)) 00424 _x = val1 00425 buff.write(_struct_Bi.pack(_x.type, _x.id)) 00426 length = len(val1.params) 00427 buff.write(_struct_I.pack(length)) 00428 pattern = '<%sd'%length 00429 buff.write(val1.params.tostring()) 00430 length = len(val1.points) 00431 buff.write(_struct_I.pack(length)) 00432 for val2 in val1.points: 00433 _v15 = val2.header 00434 buff.write(_struct_I.pack(_v15.seq)) 00435 _v16 = _v15.stamp 00436 _x = _v16 00437 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00438 _x = _v15.frame_id 00439 length = len(_x) 00440 buff.write(struct.pack('<I%ss'%length, length, _x)) 00441 _x = val2 00442 buff.write(_struct_2I.pack(_x.height, _x.width)) 00443 length = len(val2.fields) 00444 buff.write(_struct_I.pack(length)) 00445 for val3 in val2.fields: 00446 _x = val3.name 00447 length = len(_x) 00448 buff.write(struct.pack('<I%ss'%length, length, _x)) 00449 _x = val3 00450 buff.write(_struct_IBI.pack(_x.offset, _x.datatype, _x.count)) 00451 _x = val2 00452 buff.write(_struct_B2I.pack(_x.is_bigendian, _x.point_step, _x.row_step)) 00453 _x = val2.data 00454 length = len(_x) 00455 # - if encoded as a list instead, serialize as bytes instead of string 00456 if type(_x) in [list, tuple]: 00457 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00458 else: 00459 buff.write(struct.pack('<I%ss'%length, length, _x)) 00460 buff.write(_struct_B.pack(val2.is_dense)) 00461 length = len(val1.vertices) 00462 buff.write(_struct_I.pack(length)) 00463 pattern = '<%si'%length 00464 buff.write(val1.vertices.tostring()) 00465 _v17 = val1.centroid 00466 _x = _v17 00467 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00468 _v18 = val1.color 00469 _x = _v18 00470 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a)) 00471 length = len(val1.holes) 00472 buff.write(_struct_I.pack(length)) 00473 pattern = '<%sB'%length 00474 buff.write(val1.holes.tostring()) 00475 except struct.error as se: self._check_types(se) 00476 except TypeError as te: self._check_types(te) 00477 00478 def deserialize_numpy(self, str, numpy): 00479 """ 00480 unpack serialized message in str into this message instance using numpy for array types 00481 @param str: byte array of serialized message 00482 @type str: str 00483 @param numpy: numpy python module 00484 @type numpy: module 00485 """ 00486 try: 00487 if self.header is None: 00488 self.header = std_msgs.msg._Header.Header() 00489 end = 0 00490 _x = self 00491 start = end 00492 end += 12 00493 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00494 start = end 00495 end += 4 00496 (length,) = _struct_I.unpack(str[start:end]) 00497 start = end 00498 end += length 00499 self.header.frame_id = str[start:end] 00500 start = end 00501 end += 4 00502 (length,) = _struct_I.unpack(str[start:end]) 00503 self.shapes = [] 00504 for i in range(0, length): 00505 val1 = cob_3d_mapping_msgs.msg.Shape() 00506 _v19 = val1.header 00507 start = end 00508 end += 4 00509 (_v19.seq,) = _struct_I.unpack(str[start:end]) 00510 _v20 = _v19.stamp 00511 _x = _v20 00512 start = end 00513 end += 8 00514 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00515 start = end 00516 end += 4 00517 (length,) = _struct_I.unpack(str[start:end]) 00518 start = end 00519 end += length 00520 _v19.frame_id = str[start:end] 00521 _x = val1 00522 start = end 00523 end += 5 00524 (_x.type, _x.id,) = _struct_Bi.unpack(str[start:end]) 00525 start = end 00526 end += 4 00527 (length,) = _struct_I.unpack(str[start:end]) 00528 pattern = '<%sd'%length 00529 start = end 00530 end += struct.calcsize(pattern) 00531 val1.params = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00532 start = end 00533 end += 4 00534 (length,) = _struct_I.unpack(str[start:end]) 00535 val1.points = [] 00536 for i in range(0, length): 00537 val2 = sensor_msgs.msg.PointCloud2() 00538 _v21 = val2.header 00539 start = end 00540 end += 4 00541 (_v21.seq,) = _struct_I.unpack(str[start:end]) 00542 _v22 = _v21.stamp 00543 _x = _v22 00544 start = end 00545 end += 8 00546 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00547 start = end 00548 end += 4 00549 (length,) = _struct_I.unpack(str[start:end]) 00550 start = end 00551 end += length 00552 _v21.frame_id = str[start:end] 00553 _x = val2 00554 start = end 00555 end += 8 00556 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end]) 00557 start = end 00558 end += 4 00559 (length,) = _struct_I.unpack(str[start:end]) 00560 val2.fields = [] 00561 for i in range(0, length): 00562 val3 = sensor_msgs.msg.PointField() 00563 start = end 00564 end += 4 00565 (length,) = _struct_I.unpack(str[start:end]) 00566 start = end 00567 end += length 00568 val3.name = str[start:end] 00569 _x = val3 00570 start = end 00571 end += 9 00572 (_x.offset, _x.datatype, _x.count,) = _struct_IBI.unpack(str[start:end]) 00573 val2.fields.append(val3) 00574 _x = val2 00575 start = end 00576 end += 9 00577 (_x.is_bigendian, _x.point_step, _x.row_step,) = _struct_B2I.unpack(str[start:end]) 00578 val2.is_bigendian = bool(val2.is_bigendian) 00579 start = end 00580 end += 4 00581 (length,) = _struct_I.unpack(str[start:end]) 00582 start = end 00583 end += length 00584 val2.data = str[start:end] 00585 start = end 00586 end += 1 00587 (val2.is_dense,) = _struct_B.unpack(str[start:end]) 00588 val2.is_dense = bool(val2.is_dense) 00589 val1.points.append(val2) 00590 start = end 00591 end += 4 00592 (length,) = _struct_I.unpack(str[start:end]) 00593 pattern = '<%si'%length 00594 start = end 00595 end += struct.calcsize(pattern) 00596 val1.vertices = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length) 00597 _v23 = val1.centroid 00598 _x = _v23 00599 start = end 00600 end += 12 00601 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00602 _v24 = val1.color 00603 _x = _v24 00604 start = end 00605 end += 16 00606 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end]) 00607 start = end 00608 end += 4 00609 (length,) = _struct_I.unpack(str[start:end]) 00610 pattern = '<%sB'%length 00611 start = end 00612 end += struct.calcsize(pattern) 00613 val1.holes = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length) 00614 val1.holes = map(bool, val1.holes) 00615 self.shapes.append(val1) 00616 return self 00617 except struct.error as e: 00618 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00619 00620 _struct_I = roslib.message.struct_I 00621 _struct_IBI = struct.Struct("<IBI") 00622 _struct_B = struct.Struct("<B") 00623 _struct_Bi = struct.Struct("<Bi") 00624 _struct_3f = struct.Struct("<3f") 00625 _struct_3I = struct.Struct("<3I") 00626 _struct_B2I = struct.Struct("<B2I") 00627 _struct_4f = struct.Struct("<4f") 00628 _struct_2I = struct.Struct("<2I")