00001 """autogenerated by genpy from occupancy_grid_utils/LocalizedCloud.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 sensor_msgs.msg
00008 import geometry_msgs.msg
00009 import std_msgs.msg
00010
00011 class LocalizedCloud(genpy.Message):
00012 _md5sum = "e7632592cfca00d60d28bb2634b6a2bf"
00013 _type = "occupancy_grid_utils/LocalizedCloud"
00014 _has_header = False
00015 _full_text = """# Represents a point cloud (in a sensor frame) together with the pose of the sensor in
00016 # reference frame sensor_pose.header.frame_id
00017 # The header of the cloud is ignored
00018 geometry_msgs/PoseStamped sensor_pose
00019 sensor_msgs/PointCloud cloud
00020 ================================================================================
00021 MSG: geometry_msgs/PoseStamped
00022 # A Pose with reference coordinate frame and timestamp
00023 Header header
00024 Pose pose
00025
00026 ================================================================================
00027 MSG: std_msgs/Header
00028 # Standard metadata for higher-level stamped data types.
00029 # This is generally used to communicate timestamped data
00030 # in a particular coordinate frame.
00031 #
00032 # sequence ID: consecutively increasing ID
00033 uint32 seq
00034 #Two-integer timestamp that is expressed as:
00035 # * stamp.secs: seconds (stamp_secs) since epoch
00036 # * stamp.nsecs: nanoseconds since stamp_secs
00037 # time-handling sugar is provided by the client library
00038 time stamp
00039 #Frame this data is associated with
00040 # 0: no frame
00041 # 1: global frame
00042 string frame_id
00043
00044 ================================================================================
00045 MSG: geometry_msgs/Pose
00046 # A representation of pose in free space, composed of postion and orientation.
00047 Point position
00048 Quaternion orientation
00049
00050 ================================================================================
00051 MSG: geometry_msgs/Point
00052 # This contains the position of a point in free space
00053 float64 x
00054 float64 y
00055 float64 z
00056
00057 ================================================================================
00058 MSG: geometry_msgs/Quaternion
00059 # This represents an orientation in free space in quaternion form.
00060
00061 float64 x
00062 float64 y
00063 float64 z
00064 float64 w
00065
00066 ================================================================================
00067 MSG: sensor_msgs/PointCloud
00068 # This message holds a collection of 3d points, plus optional additional
00069 # information about each point.
00070
00071 # Time of sensor data acquisition, coordinate frame ID.
00072 Header header
00073
00074 # Array of 3d points. Each Point32 should be interpreted as a 3d point
00075 # in the frame given in the header.
00076 geometry_msgs/Point32[] points
00077
00078 # Each channel should have the same number of elements as points array,
00079 # and the data in each channel should correspond 1:1 with each point.
00080 # Channel names in common practice are listed in ChannelFloat32.msg.
00081 ChannelFloat32[] channels
00082
00083 ================================================================================
00084 MSG: geometry_msgs/Point32
00085 # This contains the position of a point in free space(with 32 bits of precision).
00086 # It is recommeded to use Point wherever possible instead of Point32.
00087 #
00088 # This recommendation is to promote interoperability.
00089 #
00090 # This message is designed to take up less space when sending
00091 # lots of points at once, as in the case of a PointCloud.
00092
00093 float32 x
00094 float32 y
00095 float32 z
00096 ================================================================================
00097 MSG: sensor_msgs/ChannelFloat32
00098 # This message is used by the PointCloud message to hold optional data
00099 # associated with each point in the cloud. The length of the values
00100 # array should be the same as the length of the points array in the
00101 # PointCloud, and each value should be associated with the corresponding
00102 # point.
00103
00104 # Channel names in existing practice include:
00105 # "u", "v" - row and column (respectively) in the left stereo image.
00106 # This is opposite to usual conventions but remains for
00107 # historical reasons. The newer PointCloud2 message has no
00108 # such problem.
00109 # "rgb" - For point clouds produced by color stereo cameras. uint8
00110 # (R,G,B) values packed into the least significant 24 bits,
00111 # in order.
00112 # "intensity" - laser or pixel intensity.
00113 # "distance"
00114
00115 # The channel name should give semantics of the channel (e.g.
00116 # "intensity" instead of "value").
00117 string name
00118
00119 # The values array should be 1-1 with the elements of the associated
00120 # PointCloud.
00121 float32[] values
00122
00123 """
00124 __slots__ = ['sensor_pose','cloud']
00125 _slot_types = ['geometry_msgs/PoseStamped','sensor_msgs/PointCloud']
00126
00127 def __init__(self, *args, **kwds):
00128 """
00129 Constructor. Any message fields that are implicitly/explicitly
00130 set to None will be assigned a default value. The recommend
00131 use is keyword arguments as this is more robust to future message
00132 changes. You cannot mix in-order arguments and keyword arguments.
00133
00134 The available fields are:
00135 sensor_pose,cloud
00136
00137 :param args: complete set of field values, in .msg order
00138 :param kwds: use keyword arguments corresponding to message field names
00139 to set specific fields.
00140 """
00141 if args or kwds:
00142 super(LocalizedCloud, self).__init__(*args, **kwds)
00143 #message fields cannot be None, assign default values for those that are
00144 if self.sensor_pose is None:
00145 self.sensor_pose = geometry_msgs.msg.PoseStamped()
00146 if self.cloud is None:
00147 self.cloud = sensor_msgs.msg.PointCloud()
00148 else:
00149 self.sensor_pose = geometry_msgs.msg.PoseStamped()
00150 self.cloud = sensor_msgs.msg.PointCloud()
00151
00152 def _get_types(self):
00153 """
00154 internal API method
00155 """
00156 return self._slot_types
00157
00158 def serialize(self, buff):
00159 """
00160 serialize message into buffer
00161 :param buff: buffer, ``StringIO``
00162 """
00163 try:
00164 _x = self
00165 buff.write(_struct_3I.pack(_x.sensor_pose.header.seq, _x.sensor_pose.header.stamp.secs, _x.sensor_pose.header.stamp.nsecs))
00166 _x = self.sensor_pose.header.frame_id
00167 length = len(_x)
00168 if python3 or type(_x) == unicode:
00169 _x = _x.encode('utf-8')
00170 length = len(_x)
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 _x = self
00173 buff.write(_struct_7d3I.pack(_x.sensor_pose.pose.position.x, _x.sensor_pose.pose.position.y, _x.sensor_pose.pose.position.z, _x.sensor_pose.pose.orientation.x, _x.sensor_pose.pose.orientation.y, _x.sensor_pose.pose.orientation.z, _x.sensor_pose.pose.orientation.w, _x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs))
00174 _x = self.cloud.header.frame_id
00175 length = len(_x)
00176 if python3 or type(_x) == unicode:
00177 _x = _x.encode('utf-8')
00178 length = len(_x)
00179 buff.write(struct.pack('<I%ss'%length, length, _x))
00180 length = len(self.cloud.points)
00181 buff.write(_struct_I.pack(length))
00182 for val1 in self.cloud.points:
00183 _x = val1
00184 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00185 length = len(self.cloud.channels)
00186 buff.write(_struct_I.pack(length))
00187 for val1 in self.cloud.channels:
00188 _x = val1.name
00189 length = len(_x)
00190 if python3 or type(_x) == unicode:
00191 _x = _x.encode('utf-8')
00192 length = len(_x)
00193 buff.write(struct.pack('<I%ss'%length, length, _x))
00194 length = len(val1.values)
00195 buff.write(_struct_I.pack(length))
00196 pattern = '<%sf'%length
00197 buff.write(struct.pack(pattern, *val1.values))
00198 except struct.error as se: self._check_types(se)
00199 except TypeError as te: self._check_types(te)
00200
00201 def deserialize(self, str):
00202 """
00203 unpack serialized message in str into this message instance
00204 :param str: byte array of serialized message, ``str``
00205 """
00206 try:
00207 if self.sensor_pose is None:
00208 self.sensor_pose = geometry_msgs.msg.PoseStamped()
00209 if self.cloud is None:
00210 self.cloud = sensor_msgs.msg.PointCloud()
00211 end = 0
00212 _x = self
00213 start = end
00214 end += 12
00215 (_x.sensor_pose.header.seq, _x.sensor_pose.header.stamp.secs, _x.sensor_pose.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.sensor_pose.header.frame_id = str[start:end].decode('utf-8')
00223 else:
00224 self.sensor_pose.header.frame_id = str[start:end]
00225 _x = self
00226 start = end
00227 end += 68
00228 (_x.sensor_pose.pose.position.x, _x.sensor_pose.pose.position.y, _x.sensor_pose.pose.position.z, _x.sensor_pose.pose.orientation.x, _x.sensor_pose.pose.orientation.y, _x.sensor_pose.pose.orientation.z, _x.sensor_pose.pose.orientation.w, _x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 if python3:
00235 self.cloud.header.frame_id = str[start:end].decode('utf-8')
00236 else:
00237 self.cloud.header.frame_id = str[start:end]
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 self.cloud.points = []
00242 for i in range(0, length):
00243 val1 = geometry_msgs.msg.Point32()
00244 _x = val1
00245 start = end
00246 end += 12
00247 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00248 self.cloud.points.append(val1)
00249 start = end
00250 end += 4
00251 (length,) = _struct_I.unpack(str[start:end])
00252 self.cloud.channels = []
00253 for i in range(0, length):
00254 val1 = sensor_msgs.msg.ChannelFloat32()
00255 start = end
00256 end += 4
00257 (length,) = _struct_I.unpack(str[start:end])
00258 start = end
00259 end += length
00260 if python3:
00261 val1.name = str[start:end].decode('utf-8')
00262 else:
00263 val1.name = str[start:end]
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 pattern = '<%sf'%length
00268 start = end
00269 end += struct.calcsize(pattern)
00270 val1.values = struct.unpack(pattern, str[start:end])
00271 self.cloud.channels.append(val1)
00272 return self
00273 except struct.error as e:
00274 raise genpy.DeserializationError(e) #most likely buffer underfill
00275
00276
00277 def serialize_numpy(self, buff, numpy):
00278 """
00279 serialize message with numpy array types into buffer
00280 :param buff: buffer, ``StringIO``
00281 :param numpy: numpy python module
00282 """
00283 try:
00284 _x = self
00285 buff.write(_struct_3I.pack(_x.sensor_pose.header.seq, _x.sensor_pose.header.stamp.secs, _x.sensor_pose.header.stamp.nsecs))
00286 _x = self.sensor_pose.header.frame_id
00287 length = len(_x)
00288 if python3 or type(_x) == unicode:
00289 _x = _x.encode('utf-8')
00290 length = len(_x)
00291 buff.write(struct.pack('<I%ss'%length, length, _x))
00292 _x = self
00293 buff.write(_struct_7d3I.pack(_x.sensor_pose.pose.position.x, _x.sensor_pose.pose.position.y, _x.sensor_pose.pose.position.z, _x.sensor_pose.pose.orientation.x, _x.sensor_pose.pose.orientation.y, _x.sensor_pose.pose.orientation.z, _x.sensor_pose.pose.orientation.w, _x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs))
00294 _x = self.cloud.header.frame_id
00295 length = len(_x)
00296 if python3 or type(_x) == unicode:
00297 _x = _x.encode('utf-8')
00298 length = len(_x)
00299 buff.write(struct.pack('<I%ss'%length, length, _x))
00300 length = len(self.cloud.points)
00301 buff.write(_struct_I.pack(length))
00302 for val1 in self.cloud.points:
00303 _x = val1
00304 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00305 length = len(self.cloud.channels)
00306 buff.write(_struct_I.pack(length))
00307 for val1 in self.cloud.channels:
00308 _x = val1.name
00309 length = len(_x)
00310 if python3 or type(_x) == unicode:
00311 _x = _x.encode('utf-8')
00312 length = len(_x)
00313 buff.write(struct.pack('<I%ss'%length, length, _x))
00314 length = len(val1.values)
00315 buff.write(_struct_I.pack(length))
00316 pattern = '<%sf'%length
00317 buff.write(val1.values.tostring())
00318 except struct.error as se: self._check_types(se)
00319 except TypeError as te: self._check_types(te)
00320
00321 def deserialize_numpy(self, str, numpy):
00322 """
00323 unpack serialized message in str into this message instance using numpy for array types
00324 :param str: byte array of serialized message, ``str``
00325 :param numpy: numpy python module
00326 """
00327 try:
00328 if self.sensor_pose is None:
00329 self.sensor_pose = geometry_msgs.msg.PoseStamped()
00330 if self.cloud is None:
00331 self.cloud = sensor_msgs.msg.PointCloud()
00332 end = 0
00333 _x = self
00334 start = end
00335 end += 12
00336 (_x.sensor_pose.header.seq, _x.sensor_pose.header.stamp.secs, _x.sensor_pose.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00337 start = end
00338 end += 4
00339 (length,) = _struct_I.unpack(str[start:end])
00340 start = end
00341 end += length
00342 if python3:
00343 self.sensor_pose.header.frame_id = str[start:end].decode('utf-8')
00344 else:
00345 self.sensor_pose.header.frame_id = str[start:end]
00346 _x = self
00347 start = end
00348 end += 68
00349 (_x.sensor_pose.pose.position.x, _x.sensor_pose.pose.position.y, _x.sensor_pose.pose.position.z, _x.sensor_pose.pose.orientation.x, _x.sensor_pose.pose.orientation.y, _x.sensor_pose.pose.orientation.z, _x.sensor_pose.pose.orientation.w, _x.cloud.header.seq, _x.cloud.header.stamp.secs, _x.cloud.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00350 start = end
00351 end += 4
00352 (length,) = _struct_I.unpack(str[start:end])
00353 start = end
00354 end += length
00355 if python3:
00356 self.cloud.header.frame_id = str[start:end].decode('utf-8')
00357 else:
00358 self.cloud.header.frame_id = str[start:end]
00359 start = end
00360 end += 4
00361 (length,) = _struct_I.unpack(str[start:end])
00362 self.cloud.points = []
00363 for i in range(0, length):
00364 val1 = geometry_msgs.msg.Point32()
00365 _x = val1
00366 start = end
00367 end += 12
00368 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00369 self.cloud.points.append(val1)
00370 start = end
00371 end += 4
00372 (length,) = _struct_I.unpack(str[start:end])
00373 self.cloud.channels = []
00374 for i in range(0, length):
00375 val1 = sensor_msgs.msg.ChannelFloat32()
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 start = end
00380 end += length
00381 if python3:
00382 val1.name = str[start:end].decode('utf-8')
00383 else:
00384 val1.name = str[start:end]
00385 start = end
00386 end += 4
00387 (length,) = _struct_I.unpack(str[start:end])
00388 pattern = '<%sf'%length
00389 start = end
00390 end += struct.calcsize(pattern)
00391 val1.values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00392 self.cloud.channels.append(val1)
00393 return self
00394 except struct.error as e:
00395 raise genpy.DeserializationError(e) #most likely buffer underfill
00396
00397 _struct_I = genpy.struct_I
00398 _struct_3I = struct.Struct("<3I")
00399 _struct_7d3I = struct.Struct("<7d3I")
00400 _struct_3f = struct.Struct("<3f")