00001 """autogenerated by genpy from point_cloud_ros/OccupancyGrid.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 geometry_msgs.msg
00008 import std_msgs.msg
00009
00010 class OccupancyGrid(genpy.Message):
00011 _md5sum = "17bc6c01ff5d25fb1e6e7c4af5f82b59"
00012 _type = "point_cloud_ros/OccupancyGrid"
00013 _has_header = True
00014 _full_text = """Header header
00015 uint32[] data
00016 geometry_msgs/Point32 center
00017 geometry_msgs/Point32 grid_size
00018 geometry_msgs/Point32 resolution
00019 int32 occupancy_threshold
00020
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: geometry_msgs/Point32
00042 # This contains the position of a point in free space(with 32 bits of precision).
00043 # It is recommeded to use Point wherever possible instead of Point32.
00044 #
00045 # This recommendation is to promote interoperability.
00046 #
00047 # This message is designed to take up less space when sending
00048 # lots of points at once, as in the case of a PointCloud.
00049
00050 float32 x
00051 float32 y
00052 float32 z
00053 """
00054 __slots__ = ['header','data','center','grid_size','resolution','occupancy_threshold']
00055 _slot_types = ['std_msgs/Header','uint32[]','geometry_msgs/Point32','geometry_msgs/Point32','geometry_msgs/Point32','int32']
00056
00057 def __init__(self, *args, **kwds):
00058 """
00059 Constructor. Any message fields that are implicitly/explicitly
00060 set to None will be assigned a default value. The recommend
00061 use is keyword arguments as this is more robust to future message
00062 changes. You cannot mix in-order arguments and keyword arguments.
00063
00064 The available fields are:
00065 header,data,center,grid_size,resolution,occupancy_threshold
00066
00067 :param args: complete set of field values, in .msg order
00068 :param kwds: use keyword arguments corresponding to message field names
00069 to set specific fields.
00070 """
00071 if args or kwds:
00072 super(OccupancyGrid, self).__init__(*args, **kwds)
00073
00074 if self.header is None:
00075 self.header = std_msgs.msg.Header()
00076 if self.data is None:
00077 self.data = []
00078 if self.center is None:
00079 self.center = geometry_msgs.msg.Point32()
00080 if self.grid_size is None:
00081 self.grid_size = geometry_msgs.msg.Point32()
00082 if self.resolution is None:
00083 self.resolution = geometry_msgs.msg.Point32()
00084 if self.occupancy_threshold is None:
00085 self.occupancy_threshold = 0
00086 else:
00087 self.header = std_msgs.msg.Header()
00088 self.data = []
00089 self.center = geometry_msgs.msg.Point32()
00090 self.grid_size = geometry_msgs.msg.Point32()
00091 self.resolution = geometry_msgs.msg.Point32()
00092 self.occupancy_threshold = 0
00093
00094 def _get_types(self):
00095 """
00096 internal API method
00097 """
00098 return self._slot_types
00099
00100 def serialize(self, buff):
00101 """
00102 serialize message into buffer
00103 :param buff: buffer, ``StringIO``
00104 """
00105 try:
00106 _x = self
00107 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00108 _x = self.header.frame_id
00109 length = len(_x)
00110 if python3 or type(_x) == unicode:
00111 _x = _x.encode('utf-8')
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 length = len(self.data)
00115 buff.write(_struct_I.pack(length))
00116 pattern = '<%sI'%length
00117 buff.write(struct.pack(pattern, *self.data))
00118 _x = self
00119 buff.write(_struct_9fi.pack(_x.center.x, _x.center.y, _x.center.z, _x.grid_size.x, _x.grid_size.y, _x.grid_size.z, _x.resolution.x, _x.resolution.y, _x.resolution.z, _x.occupancy_threshold))
00120 except struct.error as se: self._check_types(se)
00121 except TypeError as te: self._check_types(te)
00122
00123 def deserialize(self, str):
00124 """
00125 unpack serialized message in str into this message instance
00126 :param str: byte array of serialized message, ``str``
00127 """
00128 try:
00129 if self.header is None:
00130 self.header = std_msgs.msg.Header()
00131 if self.center is None:
00132 self.center = geometry_msgs.msg.Point32()
00133 if self.grid_size is None:
00134 self.grid_size = geometry_msgs.msg.Point32()
00135 if self.resolution is None:
00136 self.resolution = geometry_msgs.msg.Point32()
00137 end = 0
00138 _x = self
00139 start = end
00140 end += 12
00141 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 start = end
00146 end += length
00147 if python3:
00148 self.header.frame_id = str[start:end].decode('utf-8')
00149 else:
00150 self.header.frame_id = str[start:end]
00151 start = end
00152 end += 4
00153 (length,) = _struct_I.unpack(str[start:end])
00154 pattern = '<%sI'%length
00155 start = end
00156 end += struct.calcsize(pattern)
00157 self.data = struct.unpack(pattern, str[start:end])
00158 _x = self
00159 start = end
00160 end += 40
00161 (_x.center.x, _x.center.y, _x.center.z, _x.grid_size.x, _x.grid_size.y, _x.grid_size.z, _x.resolution.x, _x.resolution.y, _x.resolution.z, _x.occupancy_threshold,) = _struct_9fi.unpack(str[start:end])
00162 return self
00163 except struct.error as e:
00164 raise genpy.DeserializationError(e)
00165
00166
00167 def serialize_numpy(self, buff, numpy):
00168 """
00169 serialize message with numpy array types into buffer
00170 :param buff: buffer, ``StringIO``
00171 :param numpy: numpy python module
00172 """
00173 try:
00174 _x = self
00175 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00176 _x = self.header.frame_id
00177 length = len(_x)
00178 if python3 or type(_x) == unicode:
00179 _x = _x.encode('utf-8')
00180 length = len(_x)
00181 buff.write(struct.pack('<I%ss'%length, length, _x))
00182 length = len(self.data)
00183 buff.write(_struct_I.pack(length))
00184 pattern = '<%sI'%length
00185 buff.write(self.data.tostring())
00186 _x = self
00187 buff.write(_struct_9fi.pack(_x.center.x, _x.center.y, _x.center.z, _x.grid_size.x, _x.grid_size.y, _x.grid_size.z, _x.resolution.x, _x.resolution.y, _x.resolution.z, _x.occupancy_threshold))
00188 except struct.error as se: self._check_types(se)
00189 except TypeError as te: self._check_types(te)
00190
00191 def deserialize_numpy(self, str, numpy):
00192 """
00193 unpack serialized message in str into this message instance using numpy for array types
00194 :param str: byte array of serialized message, ``str``
00195 :param numpy: numpy python module
00196 """
00197 try:
00198 if self.header is None:
00199 self.header = std_msgs.msg.Header()
00200 if self.center is None:
00201 self.center = geometry_msgs.msg.Point32()
00202 if self.grid_size is None:
00203 self.grid_size = geometry_msgs.msg.Point32()
00204 if self.resolution is None:
00205 self.resolution = geometry_msgs.msg.Point32()
00206 end = 0
00207 _x = self
00208 start = end
00209 end += 12
00210 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00211 start = end
00212 end += 4
00213 (length,) = _struct_I.unpack(str[start:end])
00214 start = end
00215 end += length
00216 if python3:
00217 self.header.frame_id = str[start:end].decode('utf-8')
00218 else:
00219 self.header.frame_id = str[start:end]
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 pattern = '<%sI'%length
00224 start = end
00225 end += struct.calcsize(pattern)
00226 self.data = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=length)
00227 _x = self
00228 start = end
00229 end += 40
00230 (_x.center.x, _x.center.y, _x.center.z, _x.grid_size.x, _x.grid_size.y, _x.grid_size.z, _x.resolution.x, _x.resolution.y, _x.resolution.z, _x.occupancy_threshold,) = _struct_9fi.unpack(str[start:end])
00231 return self
00232 except struct.error as e:
00233 raise genpy.DeserializationError(e)
00234
00235 _struct_I = genpy.struct_I
00236 _struct_3I = struct.Struct("<3I")
00237 _struct_9fi = struct.Struct("<9fi")