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