$search
00001 """autogenerated by genmsg_py from PolygonMesh.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import pcl.msg 00006 import sensor_msgs.msg 00007 import std_msgs.msg 00008 00009 class PolygonMesh(roslib.message.Message): 00010 _md5sum = "45a5fc6ad2cde8489600a790acc9a38a" 00011 _type = "pcl/PolygonMesh" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """# Separate header for the polygonal surface 00014 Header header 00015 # Vertices of the mesh as a point cloud 00016 sensor_msgs/PointCloud2 cloud 00017 # List of polygons 00018 Vertices[] polygons 00019 00020 ================================================================================ 00021 MSG: std_msgs/Header 00022 # Standard metadata for higher-level stamped data types. 00023 # This is generally used to communicate timestamped data 00024 # in a particular coordinate frame. 00025 # 00026 # sequence ID: consecutively increasing ID 00027 uint32 seq 00028 #Two-integer timestamp that is expressed as: 00029 # * stamp.secs: seconds (stamp_secs) since epoch 00030 # * stamp.nsecs: nanoseconds since stamp_secs 00031 # time-handling sugar is provided by the client library 00032 time stamp 00033 #Frame this data is associated with 00034 # 0: no frame 00035 # 1: global frame 00036 string frame_id 00037 00038 ================================================================================ 00039 MSG: sensor_msgs/PointCloud2 00040 # This message holds a collection of N-dimensional points, which may 00041 # contain additional information such as normals, intensity, etc. The 00042 # point data is stored as a binary blob, its layout described by the 00043 # contents of the "fields" array. 00044 00045 # The point cloud data may be organized 2d (image-like) or 1d 00046 # (unordered). Point clouds organized as 2d images may be produced by 00047 # camera depth sensors such as stereo or time-of-flight. 00048 00049 # Time of sensor data acquisition, and the coordinate frame ID (for 3d 00050 # points). 00051 Header header 00052 00053 # 2D structure of the point cloud. If the cloud is unordered, height is 00054 # 1 and width is the length of the point cloud. 00055 uint32 height 00056 uint32 width 00057 00058 # Describes the channels and their layout in the binary data blob. 00059 PointField[] fields 00060 00061 bool is_bigendian # Is this data bigendian? 00062 uint32 point_step # Length of a point in bytes 00063 uint32 row_step # Length of a row in bytes 00064 uint8[] data # Actual point data, size is (row_step*height) 00065 00066 bool is_dense # True if there are no invalid points 00067 00068 ================================================================================ 00069 MSG: sensor_msgs/PointField 00070 # This message holds the description of one point entry in the 00071 # PointCloud2 message format. 00072 uint8 INT8 = 1 00073 uint8 UINT8 = 2 00074 uint8 INT16 = 3 00075 uint8 UINT16 = 4 00076 uint8 INT32 = 5 00077 uint8 UINT32 = 6 00078 uint8 FLOAT32 = 7 00079 uint8 FLOAT64 = 8 00080 00081 string name # Name of field 00082 uint32 offset # Offset from start of point struct 00083 uint8 datatype # Datatype enumeration, see above 00084 uint32 count # How many elements in the field 00085 00086 ================================================================================ 00087 MSG: pcl/Vertices 00088 # List of point indices 00089 uint32[] vertices 00090 00091 """ 00092 __slots__ = ['header','cloud','polygons'] 00093 _slot_types = ['Header','sensor_msgs/PointCloud2','pcl/Vertices[]'] 00094 00095 def __init__(self, *args, **kwds): 00096 """ 00097 Constructor. Any message fields that are implicitly/explicitly 00098 set to None will be assigned a default value. The recommend 00099 use is keyword arguments as this is more robust to future message 00100 changes. You cannot mix in-order arguments and keyword arguments. 00101 00102 The available fields are: 00103 header,cloud,polygons 00104 00105 @param args: complete set of field values, in .msg order 00106 @param kwds: use keyword arguments corresponding to message field names 00107 to set specific fields. 00108 """ 00109 if args or kwds: 00110 super(PolygonMesh, self).__init__(*args, **kwds) 00111 #message fields cannot be None, assign default values for those that are 00112 if self.header is None: 00113 self.header = std_msgs.msg._Header.Header() 00114 if self.cloud is None: 00115 self.cloud = sensor_msgs.msg.PointCloud2() 00116 if self.polygons is None: 00117 self.polygons = [] 00118 else: 00119 self.header = std_msgs.msg._Header.Header() 00120 self.cloud = sensor_msgs.msg.PointCloud2() 00121 self.polygons = [] 00122 00123 def _get_types(self): 00124 """ 00125 internal API method 00126 """ 00127 return self._slot_types 00128 00129 def serialize(self, buff): 00130 """ 00131 serialize message into buffer 00132 @param buff: buffer 00133 @type buff: StringIO 00134 """ 00135 try: 00136 _x = self 00137 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00138 _x = self.header.frame_id 00139 length = len(_x) 00140 buff.write(struct.pack('<I%ss'%length, length, _x)) 00141 _x = self 00142 buff.write(_struct_3I.pack(_x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs)) 00143 _x = self.cloud.header.frame_id 00144 length = len(_x) 00145 buff.write(struct.pack('<I%ss'%length, length, _x)) 00146 _x = self 00147 buff.write(_struct_2I.pack(_x.cloud.height, _x.cloud.width)) 00148 length = len(self.cloud.fields) 00149 buff.write(_struct_I.pack(length)) 00150 for val1 in self.cloud.fields: 00151 _x = val1.name 00152 length = len(_x) 00153 buff.write(struct.pack('<I%ss'%length, length, _x)) 00154 _x = val1 00155 buff.write(_struct_IBI.pack(_x.offset, _x.datatype, _x.count)) 00156 _x = self 00157 buff.write(_struct_B2I.pack(_x.cloud.is_bigendian, _x.cloud.point_step, _x.cloud.row_step)) 00158 _x = self.cloud.data 00159 length = len(_x) 00160 # - if encoded as a list instead, serialize as bytes instead of string 00161 if type(_x) in [list, tuple]: 00162 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00163 else: 00164 buff.write(struct.pack('<I%ss'%length, length, _x)) 00165 buff.write(_struct_B.pack(self.cloud.is_dense)) 00166 length = len(self.polygons) 00167 buff.write(_struct_I.pack(length)) 00168 for val1 in self.polygons: 00169 length = len(val1.vertices) 00170 buff.write(_struct_I.pack(length)) 00171 pattern = '<%sI'%length 00172 buff.write(struct.pack(pattern, *val1.vertices)) 00173 except struct.error as se: self._check_types(se) 00174 except TypeError as te: self._check_types(te) 00175 00176 def deserialize(self, str): 00177 """ 00178 unpack serialized message in str into this message instance 00179 @param str: byte array of serialized message 00180 @type str: str 00181 """ 00182 try: 00183 if self.header is None: 00184 self.header = std_msgs.msg._Header.Header() 00185 if self.cloud is None: 00186 self.cloud = sensor_msgs.msg.PointCloud2() 00187 end = 0 00188 _x = self 00189 start = end 00190 end += 12 00191 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00192 start = end 00193 end += 4 00194 (length,) = _struct_I.unpack(str[start:end]) 00195 start = end 00196 end += length 00197 self.header.frame_id = str[start:end] 00198 _x = self 00199 start = end 00200 end += 12 00201 (_x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00202 start = end 00203 end += 4 00204 (length,) = _struct_I.unpack(str[start:end]) 00205 start = end 00206 end += length 00207 self.cloud.header.frame_id = str[start:end] 00208 _x = self 00209 start = end 00210 end += 8 00211 (_x.cloud.height, _x.cloud.width,) = _struct_2I.unpack(str[start:end]) 00212 start = end 00213 end += 4 00214 (length,) = _struct_I.unpack(str[start:end]) 00215 self.cloud.fields = [] 00216 for i in range(0, length): 00217 val1 = sensor_msgs.msg.PointField() 00218 start = end 00219 end += 4 00220 (length,) = _struct_I.unpack(str[start:end]) 00221 start = end 00222 end += length 00223 val1.name = str[start:end] 00224 _x = val1 00225 start = end 00226 end += 9 00227 (_x.offset, _x.datatype, _x.count,) = _struct_IBI.unpack(str[start:end]) 00228 self.cloud.fields.append(val1) 00229 _x = self 00230 start = end 00231 end += 9 00232 (_x.cloud.is_bigendian, _x.cloud.point_step, _x.cloud.row_step,) = _struct_B2I.unpack(str[start:end]) 00233 self.cloud.is_bigendian = bool(self.cloud.is_bigendian) 00234 start = end 00235 end += 4 00236 (length,) = _struct_I.unpack(str[start:end]) 00237 start = end 00238 end += length 00239 self.cloud.data = str[start:end] 00240 start = end 00241 end += 1 00242 (self.cloud.is_dense,) = _struct_B.unpack(str[start:end]) 00243 self.cloud.is_dense = bool(self.cloud.is_dense) 00244 start = end 00245 end += 4 00246 (length,) = _struct_I.unpack(str[start:end]) 00247 self.polygons = [] 00248 for i in range(0, length): 00249 val1 = pcl.msg.Vertices() 00250 start = end 00251 end += 4 00252 (length,) = _struct_I.unpack(str[start:end]) 00253 pattern = '<%sI'%length 00254 start = end 00255 end += struct.calcsize(pattern) 00256 val1.vertices = struct.unpack(pattern, str[start:end]) 00257 self.polygons.append(val1) 00258 return self 00259 except struct.error as e: 00260 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00261 00262 00263 def serialize_numpy(self, buff, numpy): 00264 """ 00265 serialize message with numpy array types into buffer 00266 @param buff: buffer 00267 @type buff: StringIO 00268 @param numpy: numpy python module 00269 @type numpy module 00270 """ 00271 try: 00272 _x = self 00273 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00274 _x = self.header.frame_id 00275 length = len(_x) 00276 buff.write(struct.pack('<I%ss'%length, length, _x)) 00277 _x = self 00278 buff.write(_struct_3I.pack(_x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs)) 00279 _x = self.cloud.header.frame_id 00280 length = len(_x) 00281 buff.write(struct.pack('<I%ss'%length, length, _x)) 00282 _x = self 00283 buff.write(_struct_2I.pack(_x.cloud.height, _x.cloud.width)) 00284 length = len(self.cloud.fields) 00285 buff.write(_struct_I.pack(length)) 00286 for val1 in self.cloud.fields: 00287 _x = val1.name 00288 length = len(_x) 00289 buff.write(struct.pack('<I%ss'%length, length, _x)) 00290 _x = val1 00291 buff.write(_struct_IBI.pack(_x.offset, _x.datatype, _x.count)) 00292 _x = self 00293 buff.write(_struct_B2I.pack(_x.cloud.is_bigendian, _x.cloud.point_step, _x.cloud.row_step)) 00294 _x = self.cloud.data 00295 length = len(_x) 00296 # - if encoded as a list instead, serialize as bytes instead of string 00297 if type(_x) in [list, tuple]: 00298 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00299 else: 00300 buff.write(struct.pack('<I%ss'%length, length, _x)) 00301 buff.write(_struct_B.pack(self.cloud.is_dense)) 00302 length = len(self.polygons) 00303 buff.write(_struct_I.pack(length)) 00304 for val1 in self.polygons: 00305 length = len(val1.vertices) 00306 buff.write(_struct_I.pack(length)) 00307 pattern = '<%sI'%length 00308 buff.write(val1.vertices.tostring()) 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.header is None: 00322 self.header = std_msgs.msg._Header.Header() 00323 if self.cloud is None: 00324 self.cloud = sensor_msgs.msg.PointCloud2() 00325 end = 0 00326 _x = self 00327 start = end 00328 end += 12 00329 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00330 start = end 00331 end += 4 00332 (length,) = _struct_I.unpack(str[start:end]) 00333 start = end 00334 end += length 00335 self.header.frame_id = str[start:end] 00336 _x = self 00337 start = end 00338 end += 12 00339 (_x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00340 start = end 00341 end += 4 00342 (length,) = _struct_I.unpack(str[start:end]) 00343 start = end 00344 end += length 00345 self.cloud.header.frame_id = str[start:end] 00346 _x = self 00347 start = end 00348 end += 8 00349 (_x.cloud.height, _x.cloud.width,) = _struct_2I.unpack(str[start:end]) 00350 start = end 00351 end += 4 00352 (length,) = _struct_I.unpack(str[start:end]) 00353 self.cloud.fields = [] 00354 for i in range(0, length): 00355 val1 = sensor_msgs.msg.PointField() 00356 start = end 00357 end += 4 00358 (length,) = _struct_I.unpack(str[start:end]) 00359 start = end 00360 end += length 00361 val1.name = str[start:end] 00362 _x = val1 00363 start = end 00364 end += 9 00365 (_x.offset, _x.datatype, _x.count,) = _struct_IBI.unpack(str[start:end]) 00366 self.cloud.fields.append(val1) 00367 _x = self 00368 start = end 00369 end += 9 00370 (_x.cloud.is_bigendian, _x.cloud.point_step, _x.cloud.row_step,) = _struct_B2I.unpack(str[start:end]) 00371 self.cloud.is_bigendian = bool(self.cloud.is_bigendian) 00372 start = end 00373 end += 4 00374 (length,) = _struct_I.unpack(str[start:end]) 00375 start = end 00376 end += length 00377 self.cloud.data = str[start:end] 00378 start = end 00379 end += 1 00380 (self.cloud.is_dense,) = _struct_B.unpack(str[start:end]) 00381 self.cloud.is_dense = bool(self.cloud.is_dense) 00382 start = end 00383 end += 4 00384 (length,) = _struct_I.unpack(str[start:end]) 00385 self.polygons = [] 00386 for i in range(0, length): 00387 val1 = pcl.msg.Vertices() 00388 start = end 00389 end += 4 00390 (length,) = _struct_I.unpack(str[start:end]) 00391 pattern = '<%sI'%length 00392 start = end 00393 end += struct.calcsize(pattern) 00394 val1.vertices = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=length) 00395 self.polygons.append(val1) 00396 return self 00397 except struct.error as e: 00398 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00399 00400 _struct_I = roslib.message.struct_I 00401 _struct_IBI = struct.Struct("<IBI") 00402 _struct_3I = struct.Struct("<3I") 00403 _struct_B = struct.Struct("<B") 00404 _struct_2I = struct.Struct("<2I") 00405 _struct_B2I = struct.Struct("<B2I")