# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from moveit_msgs/PlanningSceneWorld.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct

import geometry_msgs.msg
import moveit_msgs.msg
import object_recognition_msgs.msg
import octomap_msgs.msg
import shape_msgs.msg
import std_msgs.msg

class PlanningSceneWorld(genpy.Message):
  _md5sum = "373d88390d1db385335639f687723ee6"
  _type = "moveit_msgs/PlanningSceneWorld"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """# collision objects
CollisionObject[] collision_objects

# The octomap that represents additional collision data
octomap_msgs/OctomapWithPose octomap

================================================================================
MSG: moveit_msgs/CollisionObject
# A header, used for interpreting the poses
Header header

# The id of the object (name used in MoveIt)
string id

# The object type in a database of known objects
object_recognition_msgs/ObjectType type

# The collision geometries associated with the object.
# Their poses are with respect to the specified header

# Solid geometric primitives
shape_msgs/SolidPrimitive[] primitives
geometry_msgs/Pose[] primitive_poses

# Meshes
shape_msgs/Mesh[] meshes
geometry_msgs/Pose[] mesh_poses

# Bounding planes (equation is specified, but the plane can be oriented using an additional pose)
shape_msgs/Plane[] planes
geometry_msgs/Pose[] plane_poses

# Adds the object to the planning scene. If the object previously existed, it is replaced.
byte ADD=0

# Removes the object from the environment entirely (everything that matches the specified id)
byte REMOVE=1

# Append to an object that already exists in the planning scene. If the object does not exist, it is added.
byte APPEND=2

# If an object already exists in the scene, new poses can be sent (the geometry arrays must be left empty)
# if solely moving the object is desired
byte MOVE=3

# Operation to be performed
byte operation

================================================================================
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
string frame_id

================================================================================
MSG: object_recognition_msgs/ObjectType
################################################## OBJECT ID #########################################################

# Contains information about the type of a found object. Those two sets of parameters together uniquely define an
# object

# The key of the found object: the unique identifier in the given db
string key

# The db parameters stored as a JSON/compressed YAML string. An object id does not make sense without the corresponding
# database. E.g., in object_recognition, it can look like: "{'type':'CouchDB', 'root':'http://localhost'}"
# There is no conventional format for those parameters and it's nice to keep that flexibility.
# The object_recognition_core as a generic DB type that can read those fields
# Current examples:
# For CouchDB:
#   type: 'CouchDB'
#   root: 'http://localhost:5984'
#   collection: 'object_recognition'
# For SQL household database:
#   type: 'SqlHousehold'
#   host: 'wgs36'
#   port: 5432
#   user: 'willow'
#   password: 'willow'
#   name: 'household_objects'
#   module: 'tabletop'
string db

================================================================================
MSG: shape_msgs/SolidPrimitive
# Define box, sphere, cylinder, cone 
# All shapes are defined to have their bounding boxes centered around 0,0,0.

uint8 BOX=1
uint8 SPHERE=2
uint8 CYLINDER=3
uint8 CONE=4

# The type of the shape
uint8 type


# The dimensions of the shape
float64[] dimensions

# The meaning of the shape dimensions: each constant defines the index in the 'dimensions' array

# For the BOX type, the X, Y, and Z dimensions are the length of the corresponding
# sides of the box.
uint8 BOX_X=0
uint8 BOX_Y=1
uint8 BOX_Z=2


# For the SPHERE type, only one component is used, and it gives the radius of
# the sphere.
uint8 SPHERE_RADIUS=0


# For the CYLINDER and CONE types, the center line is oriented along
# the Z axis.  Therefore the CYLINDER_HEIGHT (CONE_HEIGHT) component
# of dimensions gives the height of the cylinder (cone).  The
# CYLINDER_RADIUS (CONE_RADIUS) component of dimensions gives the
# radius of the base of the cylinder (cone).  Cone and cylinder
# primitives are defined to be circular. The tip of the cone is
# pointing up, along +Z axis.

uint8 CYLINDER_HEIGHT=0
uint8 CYLINDER_RADIUS=1

uint8 CONE_HEIGHT=0
uint8 CONE_RADIUS=1

================================================================================
MSG: geometry_msgs/Pose
# A representation of pose in free space, composed of position 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: shape_msgs/Mesh
# Definition of a mesh

# list of triangles; the index values refer to positions in vertices[]
MeshTriangle[] triangles

# the actual vertices that make up the mesh
geometry_msgs/Point[] vertices

================================================================================
MSG: shape_msgs/MeshTriangle
# Definition of a triangle's vertices
uint32[3] vertex_indices

================================================================================
MSG: shape_msgs/Plane
# Representation of a plane, using the plane equation ax + by + cz + d = 0

# a := coef[0]
# b := coef[1]
# c := coef[2]
# d := coef[3]

float64[4] coef

================================================================================
MSG: octomap_msgs/OctomapWithPose
# A 3D map in binary format, as Octree
Header header

# The pose of the octree with respect to the header frame 
geometry_msgs/Pose origin

# The actual octree msg
octomap_msgs/Octomap octomap

================================================================================
MSG: octomap_msgs/Octomap
# A 3D map in binary format, as Octree
Header header

# Flag to denote a binary (only free/occupied) or full occupancy octree (.bt/.ot file)
bool binary

# Class id of the contained octree 
string id

# Resolution (in m) of the smallest octree nodes
float64 resolution

# binary serialization of octree, use conversions.h to read and write octrees
int8[] data
"""
  __slots__ = ['collision_objects','octomap']
  _slot_types = ['moveit_msgs/CollisionObject[]','octomap_msgs/OctomapWithPose']

  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:
       collision_objects,octomap

    :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(PlanningSceneWorld, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.collision_objects is None:
        self.collision_objects = []
      if self.octomap is None:
        self.octomap = octomap_msgs.msg.OctomapWithPose()
    else:
      self.collision_objects = []
      self.octomap = octomap_msgs.msg.OctomapWithPose()

  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.collision_objects)
      buff.write(_struct_I.pack(length))
      for val1 in self.collision_objects:
        _v1 = val1.header
        _x = _v1.seq
        buff.write(_get_struct_I().pack(_x))
        _v2 = _v1.stamp
        _x = _v2
        buff.write(_get_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)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _x = val1.id
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _v3 = val1.type
        _x = _v3.key
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _x = _v3.db
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        length = len(val1.primitives)
        buff.write(_struct_I.pack(length))
        for val2 in val1.primitives:
          _x = val2.type
          buff.write(_get_struct_B().pack(_x))
          length = len(val2.dimensions)
          buff.write(_struct_I.pack(length))
          pattern = '<%sd'%length
          buff.write(struct.Struct(pattern).pack(*val2.dimensions))
        length = len(val1.primitive_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.primitive_poses:
          _v4 = val2.position
          _x = _v4
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v5 = val2.orientation
          _x = _v5
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.meshes)
        buff.write(_struct_I.pack(length))
        for val2 in val1.meshes:
          length = len(val2.triangles)
          buff.write(_struct_I.pack(length))
          for val3 in val2.triangles:
            buff.write(_get_struct_3I().pack(*val3.vertex_indices))
          length = len(val2.vertices)
          buff.write(_struct_I.pack(length))
          for val3 in val2.vertices:
            _x = val3
            buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        length = len(val1.mesh_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.mesh_poses:
          _v6 = val2.position
          _x = _v6
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v7 = val2.orientation
          _x = _v7
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.planes)
        buff.write(_struct_I.pack(length))
        for val2 in val1.planes:
          buff.write(_get_struct_4d().pack(*val2.coef))
        length = len(val1.plane_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.plane_poses:
          _v8 = val2.position
          _x = _v8
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v9 = val2.orientation
          _x = _v9
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.operation
        buff.write(_get_struct_b().pack(_x))
      _x = self
      buff.write(_get_struct_3I().pack(_x.octomap.header.seq, _x.octomap.header.stamp.secs, _x.octomap.header.stamp.nsecs))
      _x = self.octomap.header.frame_id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self
      buff.write(_get_struct_7d3I().pack(_x.octomap.origin.position.x, _x.octomap.origin.position.y, _x.octomap.origin.position.z, _x.octomap.origin.orientation.x, _x.octomap.origin.orientation.y, _x.octomap.origin.orientation.z, _x.octomap.origin.orientation.w, _x.octomap.octomap.header.seq, _x.octomap.octomap.header.stamp.secs, _x.octomap.octomap.header.stamp.nsecs))
      _x = self.octomap.octomap.header.frame_id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self.octomap.octomap.binary
      buff.write(_get_struct_B().pack(_x))
      _x = self.octomap.octomap.id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self.octomap.octomap.resolution
      buff.write(_get_struct_d().pack(_x))
      length = len(self.octomap.octomap.data)
      buff.write(_struct_I.pack(length))
      pattern = '<%sb'%length
      buff.write(struct.Struct(pattern).pack(*self.octomap.octomap.data))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      if self.collision_objects is None:
        self.collision_objects = None
      if self.octomap is None:
        self.octomap = octomap_msgs.msg.OctomapWithPose()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.collision_objects = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.CollisionObject()
        _v10 = val1.header
        start = end
        end += 4
        (_v10.seq,) = _get_struct_I().unpack(str[start:end])
        _v11 = _v10.stamp
        _x = _v11
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _get_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', 'rosmsg')
        else:
          _v10.frame_id = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.id = str[start:end]
        _v12 = val1.type
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v12.key = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v12.key = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v12.db = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v12.db = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.primitives = []
        for i in range(0, length):
          val2 = shape_msgs.msg.SolidPrimitive()
          start = end
          end += 1
          (val2.type,) = _get_struct_B().unpack(str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%sd'%length
          start = end
          s = struct.Struct(pattern)
          end += s.size
          val2.dimensions = s.unpack(str[start:end])
          val1.primitives.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.primitive_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v13 = val2.position
          _x = _v13
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v14 = val2.orientation
          _x = _v14
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.primitive_poses.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.meshes = []
        for i in range(0, length):
          val2 = shape_msgs.msg.Mesh()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val2.triangles = []
          for i in range(0, length):
            val3 = shape_msgs.msg.MeshTriangle()
            start = end
            end += 12
            val3.vertex_indices = _get_struct_3I().unpack(str[start:end])
            val2.triangles.append(val3)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val2.vertices = []
          for i in range(0, length):
            val3 = geometry_msgs.msg.Point()
            _x = val3
            start = end
            end += 24
            (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
            val2.vertices.append(val3)
          val1.meshes.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.mesh_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v15 = val2.position
          _x = _v15
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v16 = val2.orientation
          _x = _v16
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.mesh_poses.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.planes = []
        for i in range(0, length):
          val2 = shape_msgs.msg.Plane()
          start = end
          end += 32
          val2.coef = _get_struct_4d().unpack(str[start:end])
          val1.planes.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.plane_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v17 = val2.position
          _x = _v17
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v18 = val2.orientation
          _x = _v18
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.plane_poses.append(val2)
        start = end
        end += 1
        (val1.operation,) = _get_struct_b().unpack(str[start:end])
        self.collision_objects.append(val1)
      _x = self
      start = end
      end += 12
      (_x.octomap.header.seq, _x.octomap.header.stamp.secs, _x.octomap.header.stamp.nsecs,) = _get_struct_3I().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.header.frame_id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.header.frame_id = str[start:end]
      _x = self
      start = end
      end += 68
      (_x.octomap.origin.position.x, _x.octomap.origin.position.y, _x.octomap.origin.position.z, _x.octomap.origin.orientation.x, _x.octomap.origin.orientation.y, _x.octomap.origin.orientation.z, _x.octomap.origin.orientation.w, _x.octomap.octomap.header.seq, _x.octomap.octomap.header.stamp.secs, _x.octomap.octomap.header.stamp.nsecs,) = _get_struct_7d3I().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.octomap.header.frame_id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.octomap.header.frame_id = str[start:end]
      start = end
      end += 1
      (self.octomap.octomap.binary,) = _get_struct_B().unpack(str[start:end])
      self.octomap.octomap.binary = bool(self.octomap.octomap.binary)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.octomap.id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.octomap.id = str[start:end]
      start = end
      end += 8
      (self.octomap.octomap.resolution,) = _get_struct_d().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sb'%length
      start = end
      s = struct.Struct(pattern)
      end += s.size
      self.octomap.octomap.data = s.unpack(str[start:end])
      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.collision_objects)
      buff.write(_struct_I.pack(length))
      for val1 in self.collision_objects:
        _v19 = val1.header
        _x = _v19.seq
        buff.write(_get_struct_I().pack(_x))
        _v20 = _v19.stamp
        _x = _v20
        buff.write(_get_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)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _x = val1.id
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _v21 = val1.type
        _x = _v21.key
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        _x = _v21.db
        length = len(_x)
        if python3 or type(_x) == unicode:
          _x = _x.encode('utf-8')
          length = len(_x)
        buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
        length = len(val1.primitives)
        buff.write(_struct_I.pack(length))
        for val2 in val1.primitives:
          _x = val2.type
          buff.write(_get_struct_B().pack(_x))
          length = len(val2.dimensions)
          buff.write(_struct_I.pack(length))
          pattern = '<%sd'%length
          buff.write(val2.dimensions.tostring())
        length = len(val1.primitive_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.primitive_poses:
          _v22 = val2.position
          _x = _v22
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v23 = val2.orientation
          _x = _v23
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.meshes)
        buff.write(_struct_I.pack(length))
        for val2 in val1.meshes:
          length = len(val2.triangles)
          buff.write(_struct_I.pack(length))
          for val3 in val2.triangles:
            buff.write(val3.vertex_indices.tostring())
          length = len(val2.vertices)
          buff.write(_struct_I.pack(length))
          for val3 in val2.vertices:
            _x = val3
            buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        length = len(val1.mesh_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.mesh_poses:
          _v24 = val2.position
          _x = _v24
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v25 = val2.orientation
          _x = _v25
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(val1.planes)
        buff.write(_struct_I.pack(length))
        for val2 in val1.planes:
          buff.write(val2.coef.tostring())
        length = len(val1.plane_poses)
        buff.write(_struct_I.pack(length))
        for val2 in val1.plane_poses:
          _v26 = val2.position
          _x = _v26
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v27 = val2.orientation
          _x = _v27
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.operation
        buff.write(_get_struct_b().pack(_x))
      _x = self
      buff.write(_get_struct_3I().pack(_x.octomap.header.seq, _x.octomap.header.stamp.secs, _x.octomap.header.stamp.nsecs))
      _x = self.octomap.header.frame_id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self
      buff.write(_get_struct_7d3I().pack(_x.octomap.origin.position.x, _x.octomap.origin.position.y, _x.octomap.origin.position.z, _x.octomap.origin.orientation.x, _x.octomap.origin.orientation.y, _x.octomap.origin.orientation.z, _x.octomap.origin.orientation.w, _x.octomap.octomap.header.seq, _x.octomap.octomap.header.stamp.secs, _x.octomap.octomap.header.stamp.nsecs))
      _x = self.octomap.octomap.header.frame_id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self.octomap.octomap.binary
      buff.write(_get_struct_B().pack(_x))
      _x = self.octomap.octomap.id
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self.octomap.octomap.resolution
      buff.write(_get_struct_d().pack(_x))
      length = len(self.octomap.octomap.data)
      buff.write(_struct_I.pack(length))
      pattern = '<%sb'%length
      buff.write(self.octomap.octomap.data.tostring())
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  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
    """
    codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      if self.collision_objects is None:
        self.collision_objects = None
      if self.octomap is None:
        self.octomap = octomap_msgs.msg.OctomapWithPose()
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.collision_objects = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.CollisionObject()
        _v28 = val1.header
        start = end
        end += 4
        (_v28.seq,) = _get_struct_I().unpack(str[start:end])
        _v29 = _v28.stamp
        _x = _v29
        start = end
        end += 8
        (_x.secs, _x.nsecs,) = _get_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', 'rosmsg')
        else:
          _v28.frame_id = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.id = str[start:end]
        _v30 = val1.type
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v30.key = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v30.key = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          _v30.db = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v30.db = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.primitives = []
        for i in range(0, length):
          val2 = shape_msgs.msg.SolidPrimitive()
          start = end
          end += 1
          (val2.type,) = _get_struct_B().unpack(str[start:end])
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          pattern = '<%sd'%length
          start = end
          s = struct.Struct(pattern)
          end += s.size
          val2.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
          val1.primitives.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.primitive_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v31 = val2.position
          _x = _v31
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v32 = val2.orientation
          _x = _v32
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.primitive_poses.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.meshes = []
        for i in range(0, length):
          val2 = shape_msgs.msg.Mesh()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val2.triangles = []
          for i in range(0, length):
            val3 = shape_msgs.msg.MeshTriangle()
            start = end
            end += 12
            val3.vertex_indices = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=3)
            val2.triangles.append(val3)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val2.vertices = []
          for i in range(0, length):
            val3 = geometry_msgs.msg.Point()
            _x = val3
            start = end
            end += 24
            (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
            val2.vertices.append(val3)
          val1.meshes.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.mesh_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v33 = val2.position
          _x = _v33
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v34 = val2.orientation
          _x = _v34
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.mesh_poses.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.planes = []
        for i in range(0, length):
          val2 = shape_msgs.msg.Plane()
          start = end
          end += 32
          val2.coef = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=4)
          val1.planes.append(val2)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        val1.plane_poses = []
        for i in range(0, length):
          val2 = geometry_msgs.msg.Pose()
          _v35 = val2.position
          _x = _v35
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v36 = val2.orientation
          _x = _v36
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          val1.plane_poses.append(val2)
        start = end
        end += 1
        (val1.operation,) = _get_struct_b().unpack(str[start:end])
        self.collision_objects.append(val1)
      _x = self
      start = end
      end += 12
      (_x.octomap.header.seq, _x.octomap.header.stamp.secs, _x.octomap.header.stamp.nsecs,) = _get_struct_3I().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.header.frame_id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.header.frame_id = str[start:end]
      _x = self
      start = end
      end += 68
      (_x.octomap.origin.position.x, _x.octomap.origin.position.y, _x.octomap.origin.position.z, _x.octomap.origin.orientation.x, _x.octomap.origin.orientation.y, _x.octomap.origin.orientation.z, _x.octomap.origin.orientation.w, _x.octomap.octomap.header.seq, _x.octomap.octomap.header.stamp.secs, _x.octomap.octomap.header.stamp.nsecs,) = _get_struct_7d3I().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.octomap.header.frame_id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.octomap.header.frame_id = str[start:end]
      start = end
      end += 1
      (self.octomap.octomap.binary,) = _get_struct_B().unpack(str[start:end])
      self.octomap.octomap.binary = bool(self.octomap.octomap.binary)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.octomap.octomap.id = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.octomap.octomap.id = str[start:end]
      start = end
      end += 8
      (self.octomap.octomap.resolution,) = _get_struct_d().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sb'%length
      start = end
      s = struct.Struct(pattern)
      end += s.size
      self.octomap.octomap.data = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e)  # most likely buffer underfill

_struct_I = genpy.struct_I
def _get_struct_I():
    global _struct_I
    return _struct_I
_struct_2I = None
def _get_struct_2I():
    global _struct_2I
    if _struct_2I is None:
        _struct_2I = struct.Struct("<2I")
    return _struct_2I
_struct_3I = None
def _get_struct_3I():
    global _struct_3I
    if _struct_3I is None:
        _struct_3I = struct.Struct("<3I")
    return _struct_3I
_struct_3d = None
def _get_struct_3d():
    global _struct_3d
    if _struct_3d is None:
        _struct_3d = struct.Struct("<3d")
    return _struct_3d
_struct_4d = None
def _get_struct_4d():
    global _struct_4d
    if _struct_4d is None:
        _struct_4d = struct.Struct("<4d")
    return _struct_4d
_struct_7d3I = None
def _get_struct_7d3I():
    global _struct_7d3I
    if _struct_7d3I is None:
        _struct_7d3I = struct.Struct("<7d3I")
    return _struct_7d3I
_struct_B = None
def _get_struct_B():
    global _struct_B
    if _struct_B is None:
        _struct_B = struct.Struct("<B")
    return _struct_B
_struct_b = None
def _get_struct_b():
    global _struct_b
    if _struct_b is None:
        _struct_b = struct.Struct("<b")
    return _struct_b
_struct_d = None
def _get_struct_d():
    global _struct_d
    if _struct_d is None:
        _struct_d = struct.Struct("<d")
    return _struct_d
