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