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


pcl
Author(s): See http://pcl.ros.org/authors for the complete list of authors.
autogenerated on Tue Mar 5 2013 13:54:35