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