"""autogenerated by genpy from multi_map_server/MultiSparseMap3D.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct

import geometry_msgs.msg
import multi_map_server.msg
import nav_msgs.msg
import genpy
import std_msgs.msg

class MultiSparseMap3D(genpy.Message):
  _md5sum = "2e3d76c98ee3e2b23a422f64965f6418"
  _type = "multi_map_server/MultiSparseMap3D"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """SparseMap3D[] maps
geometry_msgs/Pose[] origins

================================================================================
MSG: multi_map_server/SparseMap3D
Header header
nav_msgs/MapMetaData info
VerticalOccupancyGridList[] lists


================================================================================
MSG: std_msgs/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data 
# in a particular coordinate frame.
# 
# sequence ID: consecutively increasing ID 
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')
# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id

================================================================================
MSG: nav_msgs/MapMetaData
# This hold basic information about the characterists of the OccupancyGrid

# The time at which the map was loaded
time map_load_time
# The map resolution [m/cell]
float32 resolution
# Map width [cells]
uint32 width
# Map height [cells]
uint32 height
# The origin of the map [m, m, rad].  This is the real-world pose of the
# cell (0,0) in the map.
geometry_msgs/Pose origin
================================================================================
MSG: geometry_msgs/Pose
# A representation of pose in free space, composed of postion and orientation. 
Point position
Quaternion orientation

================================================================================
MSG: geometry_msgs/Point
# This contains the position of a point in free space
float64 x
float64 y
float64 z

================================================================================
MSG: geometry_msgs/Quaternion
# This represents an orientation in free space in quaternion form.

float64 x
float64 y
float64 z
float64 w

================================================================================
MSG: multi_map_server/VerticalOccupancyGridList
float32 x
float32 y
int32[] upper
int32[] lower
int32[] mass


"""
  __slots__ = ['maps','origins']
  _slot_types = ['multi_map_server/SparseMap3D[]','geometry_msgs/Pose[]']

  def __init__(self, *args, **kwds):
    """
    Constructor. Any message fields that are implicitly/explicitly
    set to None will be assigned a default value. The recommend
    use is keyword arguments as this is more robust to future message
    changes.  You cannot mix in-order arguments and keyword arguments.

    The available fields are:
       maps,origins

    :param args: complete set of field values, in .msg order
    :param kwds: use keyword arguments corresponding to message field names
    to set specific fields.
    """
    if args or kwds:
      super(MultiSparseMap3D, self).__init__(*args, **kwds)
      #message fields cannot be None, assign default values for those that are
      if self.maps is None:
        self.maps = []
      if self.origins is None:
        self.origins = []
    else:
      self.maps = []
      self.origins = []

  def _get_types(self):
    """
    internal API method
    """
    return self._slot_types

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      length = len(self.maps)
      buff.write(_struct_I.pack(length))
      for val1 in self.maps:
        _v1 = val1.header
        buff.write(_struct_I.pack(_v1.seq))
        _v2 = _v1.stamp
        _x = _v2
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v1.frame_id
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        if python3:
          buff.write(struct.pack('<I%sB'%length, length, *_x))
        else:
          buff.write(struct.pack('<I%ss'%length, length, _x))
        _v3 = val1.info
        _v4 = _v3.map_load_time
        _x = _v4
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v3
        buff.write(_struct_f2I.pack(_x.resolution, _x.width, _x.height))
        _v5 = _v3.origin
        _v6 = _v5.position
        _x = _v6
        buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
        _v7 = _v5.orientation
        _x = _v7
        buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.lists)
        buff.write(_struct_I.pack(length))
        for val2 in val1.lists:
          _x = val2
          buff.write(_struct_2f.pack(_x.x, _x.y))
          length = len(val2.upper)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(struct.pack(pattern, *val2.upper))
          length = len(val2.lower)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(struct.pack(pattern, *val2.lower))
          length = len(val2.mass)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(struct.pack(pattern, *val2.mass))
      length = len(self.origins)
      buff.write(_struct_I.pack(length))
      for val1 in self.origins:
        _v8 = val1.position
        _x = _v8
        buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
        _v9 = val1.orientation
        _x = _v9
        buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    try:
      if self.maps is None:
        self.maps = None
      if self.origins is None:
        self.origins = None
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.maps = []
      for i in range(0, length):
        val1 = multi_map_server.msg.SparseMap3D()
        _v10 = val1.header
        start = end
        end += 4
        (_v10.seq,) = _struct_I.unpack(str[start:end])
        _v11 = _v10.stamp
        _x = _v11
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v10.frame_id = str[start:end].decode('utf-8')
        else:
          _v10.frame_id = str[start:end]
        _v12 = val1.info
        _v13 = _v12.map_load_time
        _x = _v13
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        _x = _v12
        start = end
        end += 12
        (_x.resolution, _x.width, _x.height,) = _struct_f2I.unpack(str[start:end])
        _v14 = _v12.origin
        _v15 = _v14.position
        _x = _v15
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
        _v16 = _v14.orientation
        _x = _v16
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.lists = []
        for i in range(0, length):
          val2 = multi_map_server.msg.VerticalOccupancyGridList()
          _x = val2
          start = end
          end += 8
          (_x.x, _x.y,) = _struct_2f.unpack(str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.upper = struct.unpack(pattern, str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.lower = struct.unpack(pattern, str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.mass = struct.unpack(pattern, str[start:end])
          val1.lists.append(val2)
        self.maps.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.origins = []
      for i in range(0, length):
        val1 = geometry_msgs.msg.Pose()
        _v17 = val1.position
        _x = _v17
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
        _v18 = val1.orientation
        _x = _v18
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
        self.origins.append(val1)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill


  def serialize_numpy(self, buff, numpy):
    """
    serialize message with numpy array types into buffer
    :param buff: buffer, ``StringIO``
    :param numpy: numpy python module
    """
    try:
      length = len(self.maps)
      buff.write(_struct_I.pack(length))
      for val1 in self.maps:
        _v19 = val1.header
        buff.write(_struct_I.pack(_v19.seq))
        _v20 = _v19.stamp
        _x = _v20
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v19.frame_id
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        if python3:
          buff.write(struct.pack('<I%sB'%length, length, *_x))
        else:
          buff.write(struct.pack('<I%ss'%length, length, _x))
        _v21 = val1.info
        _v22 = _v21.map_load_time
        _x = _v22
        buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
        _x = _v21
        buff.write(_struct_f2I.pack(_x.resolution, _x.width, _x.height))
        _v23 = _v21.origin
        _v24 = _v23.position
        _x = _v24
        buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
        _v25 = _v23.orientation
        _x = _v25
        buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.lists)
        buff.write(_struct_I.pack(length))
        for val2 in val1.lists:
          _x = val2
          buff.write(_struct_2f.pack(_x.x, _x.y))
          length = len(val2.upper)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(val2.upper.tostring())
          length = len(val2.lower)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(val2.lower.tostring())
          length = len(val2.mass)
          buff.write(_struct_I.pack(length))
          pattern = '<%si'%length
          buff.write(val2.mass.tostring())
      length = len(self.origins)
      buff.write(_struct_I.pack(length))
      for val1 in self.origins:
        _v26 = val1.position
        _x = _v26
        buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
        _v27 = val1.orientation
        _x = _v27
        buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  def deserialize_numpy(self, str, numpy):
    """
    unpack serialized message in str into this message instance using numpy for array types
    :param str: byte array of serialized message, ``str``
    :param numpy: numpy python module
    """
    try:
      if self.maps is None:
        self.maps = None
      if self.origins is None:
        self.origins = None
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.maps = []
      for i in range(0, length):
        val1 = multi_map_server.msg.SparseMap3D()
        _v28 = val1.header
        start = end
        end += 4
        (_v28.seq,) = _struct_I.unpack(str[start:end])
        _v29 = _v28.stamp
        _x = _v29
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v28.frame_id = str[start:end].decode('utf-8')
        else:
          _v28.frame_id = str[start:end]
        _v30 = val1.info
        _v31 = _v30.map_load_time
        _x = _v31
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
        _x = _v30
        start = end
        end += 12
        (_x.resolution, _x.width, _x.height,) = _struct_f2I.unpack(str[start:end])
        _v32 = _v30.origin
        _v33 = _v32.position
        _x = _v33
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
        _v34 = _v32.orientation
        _x = _v34
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.lists = []
        for i in range(0, length):
          val2 = multi_map_server.msg.VerticalOccupancyGridList()
          _x = val2
          start = end
          end += 8
          (_x.x, _x.y,) = _struct_2f.unpack(str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.upper = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.lower = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%si'%length
          start = end
          end += struct.calcsize(pattern)
          val2.mass = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
          val1.lists.append(val2)
        self.maps.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.origins = []
      for i in range(0, length):
        val1 = geometry_msgs.msg.Pose()
        _v35 = val1.position
        _x = _v35
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
        _v36 = val1.orientation
        _x = _v36
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
        self.origins.append(val1)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill

_struct_I = genpy.struct_I
_struct_f2I = struct.Struct("<f2I")
_struct_2f = struct.Struct("<2f")
_struct_4d = struct.Struct("<4d")
_struct_2I = struct.Struct("<2I")
_struct_3d = struct.Struct("<3d")
