00001 """autogenerated by genmsg_py from PointCloud.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import sensor_msgs.msg
00006 import geometry_msgs.msg
00007 import std_msgs.msg
00008
00009 class PointCloud(roslib.message.Message):
00010 _md5sum = "d8e9c3f5afbdd8a130fd1d2763945fca"
00011 _type = "sensor_msgs/PointCloud"
00012 _has_header = True
00013 _full_text = """# This message holds a collection of 3d points, plus optional additional
00014 # information about each point.
00015
00016 # Time of sensor data acquisition, coordinate frame ID.
00017 Header header
00018
00019 # Array of 3d points. Each Point32 should be interpreted as a 3d point
00020 # in the frame given in the header.
00021 geometry_msgs/Point32[] points
00022
00023 # Each channel should have the same number of elements as points array,
00024 # and the data in each channel should correspond 1:1 with each point.
00025 # Channel names in common practice are listed in ChannelFloat32.msg.
00026 ChannelFloat32[] channels
00027
00028 ================================================================================
00029 MSG: std_msgs/Header
00030 # Standard metadata for higher-level stamped data types.
00031 # This is generally used to communicate timestamped data
00032 # in a particular coordinate frame.
00033 #
00034 # sequence ID: consecutively increasing ID
00035 uint32 seq
00036 #Two-integer timestamp that is expressed as:
00037 # * stamp.secs: seconds (stamp_secs) since epoch
00038 # * stamp.nsecs: nanoseconds since stamp_secs
00039 # time-handling sugar is provided by the client library
00040 time stamp
00041 #Frame this data is associated with
00042 # 0: no frame
00043 # 1: global frame
00044 string frame_id
00045
00046 ================================================================================
00047 MSG: geometry_msgs/Point32
00048 # This contains the position of a point in free space(with 32 bits of precision).
00049 # It is recommeded to use Point wherever possible instead of Point32.
00050 #
00051 # This recommendation is to promote interoperability.
00052 #
00053 # This message is designed to take up less space when sending
00054 # lots of points at once, as in the case of a PointCloud.
00055
00056 float32 x
00057 float32 y
00058 float32 z
00059 ================================================================================
00060 MSG: sensor_msgs/ChannelFloat32
00061 # This message is used by the PointCloud message to hold optional data
00062 # associated with each point in the cloud. The length of the values
00063 # array should be the same as the length of the points array in the
00064 # PointCloud, and each value should be associated with the corresponding
00065 # point.
00066
00067 # Channel names in existing practice include:
00068 # "u", "v" - row and column (respectively) in the left stereo image.
00069 # This is opposite to usual conventions but remains for
00070 # historical reasons. The newer PointCloud2 message has no
00071 # such problem.
00072 # "rgb" - For point clouds produced by color stereo cameras. uint8
00073 # (R,G,B) values packed into the least significant 24 bits,
00074 # in order.
00075 # "intensity" - laser or pixel intensity.
00076 # "distance"
00077
00078 # The channel name should give semantics of the channel (e.g.
00079 # "intensity" instead of "value").
00080 string name
00081
00082 # The values array should be 1-1 with the elements of the associated
00083 # PointCloud.
00084 float32[] values
00085
00086 """
00087 __slots__ = ['header','points','channels']
00088 _slot_types = ['Header','geometry_msgs/Point32[]','sensor_msgs/ChannelFloat32[]']
00089
00090 def __init__(self, *args, **kwds):
00091 """
00092 Constructor. Any message fields that are implicitly/explicitly
00093 set to None will be assigned a default value. The recommend
00094 use is keyword arguments as this is more robust to future message
00095 changes. You cannot mix in-order arguments and keyword arguments.
00096
00097 The available fields are:
00098 header,points,channels
00099
00100 @param args: complete set of field values, in .msg order
00101 @param kwds: use keyword arguments corresponding to message field names
00102 to set specific fields.
00103 """
00104 if args or kwds:
00105 super(PointCloud, self).__init__(*args, **kwds)
00106 #message fields cannot be None, assign default values for those that are
00107 if self.header is None:
00108 self.header = std_msgs.msg._Header.Header()
00109 if self.points is None:
00110 self.points = []
00111 if self.channels is None:
00112 self.channels = []
00113 else:
00114 self.header = std_msgs.msg._Header.Header()
00115 self.points = []
00116 self.channels = []
00117
00118 def _get_types(self):
00119 """
00120 internal API method
00121 """
00122 return self._slot_types
00123
00124 def serialize(self, buff):
00125 """
00126 serialize message into buffer
00127 @param buff: buffer
00128 @type buff: StringIO
00129 """
00130 try:
00131 _x = self
00132 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00133 _x = self.header.frame_id
00134 length = len(_x)
00135 buff.write(struct.pack('<I%ss'%length, length, _x))
00136 length = len(self.points)
00137 buff.write(_struct_I.pack(length))
00138 for val1 in self.points:
00139 _x = val1
00140 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00141 length = len(self.channels)
00142 buff.write(_struct_I.pack(length))
00143 for val1 in self.channels:
00144 _x = val1.name
00145 length = len(_x)
00146 buff.write(struct.pack('<I%ss'%length, length, _x))
00147 length = len(val1.values)
00148 buff.write(_struct_I.pack(length))
00149 pattern = '<%sf'%length
00150 buff.write(struct.pack(pattern, *val1.values))
00151 except struct.error, se: self._check_types(se)
00152 except TypeError, te: self._check_types(te)
00153
00154 def deserialize(self, str):
00155 """
00156 unpack serialized message in str into this message instance
00157 @param str: byte array of serialized message
00158 @type str: str
00159 """
00160 try:
00161 if self.header is None:
00162 self.header = std_msgs.msg._Header.Header()
00163 end = 0
00164 _x = self
00165 start = end
00166 end += 12
00167 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 start = end
00172 end += length
00173 self.header.frame_id = str[start:end]
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 self.points = []
00178 for i in xrange(0, length):
00179 val1 = geometry_msgs.msg.Point32()
00180 _x = val1
00181 start = end
00182 end += 12
00183 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00184 self.points.append(val1)
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 self.channels = []
00189 for i in xrange(0, length):
00190 val1 = sensor_msgs.msg.ChannelFloat32()
00191 start = end
00192 end += 4
00193 (length,) = _struct_I.unpack(str[start:end])
00194 start = end
00195 end += length
00196 val1.name = str[start:end]
00197 start = end
00198 end += 4
00199 (length,) = _struct_I.unpack(str[start:end])
00200 pattern = '<%sf'%length
00201 start = end
00202 end += struct.calcsize(pattern)
00203 val1.values = struct.unpack(pattern, str[start:end])
00204 self.channels.append(val1)
00205 return self
00206 except struct.error, e:
00207 raise roslib.message.DeserializationError(e) #most likely buffer underfill
00208
00209
00210 def serialize_numpy(self, buff, numpy):
00211 """
00212 serialize message with numpy array types into buffer
00213 @param buff: buffer
00214 @type buff: StringIO
00215 @param numpy: numpy python module
00216 @type numpy module
00217 """
00218 try:
00219 _x = self
00220 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00221 _x = self.header.frame_id
00222 length = len(_x)
00223 buff.write(struct.pack('<I%ss'%length, length, _x))
00224 length = len(self.points)
00225 buff.write(_struct_I.pack(length))
00226 for val1 in self.points:
00227 _x = val1
00228 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00229 length = len(self.channels)
00230 buff.write(_struct_I.pack(length))
00231 for val1 in self.channels:
00232 _x = val1.name
00233 length = len(_x)
00234 buff.write(struct.pack('<I%ss'%length, length, _x))
00235 length = len(val1.values)
00236 buff.write(_struct_I.pack(length))
00237 pattern = '<%sf'%length
00238 buff.write(val1.values.tostring())
00239 except struct.error, se: self._check_types(se)
00240 except TypeError, te: self._check_types(te)
00241
00242 def deserialize_numpy(self, str, numpy):
00243 """
00244 unpack serialized message in str into this message instance using numpy for array types
00245 @param str: byte array of serialized message
00246 @type str: str
00247 @param numpy: numpy python module
00248 @type numpy: module
00249 """
00250 try:
00251 if self.header is None:
00252 self.header = std_msgs.msg._Header.Header()
00253 end = 0
00254 _x = self
00255 start = end
00256 end += 12
00257 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00258 start = end
00259 end += 4
00260 (length,) = _struct_I.unpack(str[start:end])
00261 start = end
00262 end += length
00263 self.header.frame_id = str[start:end]
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 self.points = []
00268 for i in xrange(0, length):
00269 val1 = geometry_msgs.msg.Point32()
00270 _x = val1
00271 start = end
00272 end += 12
00273 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00274 self.points.append(val1)
00275 start = end
00276 end += 4
00277 (length,) = _struct_I.unpack(str[start:end])
00278 self.channels = []
00279 for i in xrange(0, length):
00280 val1 = sensor_msgs.msg.ChannelFloat32()
00281 start = end
00282 end += 4
00283 (length,) = _struct_I.unpack(str[start:end])
00284 start = end
00285 end += length
00286 val1.name = str[start:end]
00287 start = end
00288 end += 4
00289 (length,) = _struct_I.unpack(str[start:end])
00290 pattern = '<%sf'%length
00291 start = end
00292 end += struct.calcsize(pattern)
00293 val1.values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00294 self.channels.append(val1)
00295 return self
00296 except struct.error, e:
00297 raise roslib.message.DeserializationError(e) #most likely buffer underfill
00298
00299 _struct_I = roslib.message.struct_I
00300 _struct_3I = struct.Struct("<3I")
00301 _struct_3f = struct.Struct("<3f")