# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from moveit_msgs/Constraints.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 shape_msgs.msg
import std_msgs.msg

class Constraints(genpy.Message):
  _md5sum = "8d5ce8d34ef26c65fb5d43c9e99bf6e0"
  _type = "moveit_msgs/Constraints"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """# This message contains a list of motion planning constraints.
# All constraints must be satisfied for a goal to be considered valid

string name

JointConstraint[] joint_constraints

PositionConstraint[] position_constraints

OrientationConstraint[] orientation_constraints

VisibilityConstraint[] visibility_constraints

================================================================================
MSG: moveit_msgs/JointConstraint
# Constrain the position of a joint to be within a certain bound
string joint_name

# the bound to be achieved is [position - tolerance_below, position + tolerance_above]
float64 position
float64 tolerance_above
float64 tolerance_below

# A weighting factor for this constraint (denotes relative importance to other constraints. Closer to zero means less important)
float64 weight
================================================================================
MSG: moveit_msgs/PositionConstraint
# This message contains the definition of a position constraint.

Header header

# The robot link this constraint refers to
string link_name

# The offset (in the link frame) for the target point on the link we are planning for
geometry_msgs/Vector3 target_point_offset

# The volume this constraint refers to 
BoundingVolume constraint_region

# A weighting factor for this constraint (denotes relative importance to other constraints. Closer to zero means less important)
float64 weight

================================================================================
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: geometry_msgs/Vector3
# This represents a vector in free space. 
# It is only meant to represent a direction. Therefore, it does not
# make sense to apply a translation to it (e.g., when applying a 
# generic rigid transformation to a Vector3, tf2 will only apply the
# rotation). If you want your data to be translatable too, use the
# geometry_msgs/Point message instead.

float64 x
float64 y
float64 z
================================================================================
MSG: moveit_msgs/BoundingVolume
# Define a volume in 3D

# A set of solid geometric primitives that make up the volume to define (as a union)
shape_msgs/SolidPrimitive[] primitives

# The poses at which the primitives are located
geometry_msgs/Pose[] primitive_poses

# In addition to primitives, meshes can be specified to add to the bounding volume (again, as union)
shape_msgs/Mesh[] meshes

# The poses at which the meshes are located
geometry_msgs/Pose[] mesh_poses

================================================================================
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: moveit_msgs/OrientationConstraint
# This message contains the definition of an orientation constraint.

Header header

# The desired orientation of the robot link specified as a quaternion
geometry_msgs/Quaternion orientation

# The robot link this constraint refers to
string link_name

# optional axis-angle error tolerances specified
float64 absolute_x_axis_tolerance
float64 absolute_y_axis_tolerance
float64 absolute_z_axis_tolerance

# A weighting factor for this constraint (denotes relative importance to other constraints. Closer to zero means less important)
float64 weight

================================================================================
MSG: moveit_msgs/VisibilityConstraint
# The constraint is useful to maintain visibility to a disc (the target) in a particular frame.
# This disc forms the base of a visibiliy cone whose tip is at the origin of the sensor.
# Maintaining visibility is done by ensuring the robot does not obstruct the visibility cone.
# Note:
# This constraint does NOT enforce minimum or maximum distances between the sensor
# and the target, nor does it enforce the target to be in the field of view of
# the sensor. A PositionConstraint can (and probably should) be used for such purposes.

# The radius of the disc that should be maintained visible 
float64 target_radius

# The pose of the disc; as the robot moves, the pose of the disc may change as well
# This can be in the frame of a particular robot link, for example
geometry_msgs/PoseStamped target_pose

# From the sensor origin towards the target, the disc forms a visibility cone
# This cone is approximated using many sides. For example, when using 4 sides, 
# that in fact makes the visibility region be a pyramid.
# This value should always be 3 or more.
int32 cone_sides

# The pose in which visibility is to be maintained.
# The frame id should represent the robot link to which the sensor is attached.
# It is assumed the sensor can look directly at the target, in any direction.
# This assumption is usually not true, but additional PositionConstraints
# can resolve this issue.
geometry_msgs/PoseStamped sensor_pose

# Even though the disc is maintained visible, the visibility cone can be very small
# because of the orientation of the disc with respect to the sensor. It is possible
# for example to view the disk almost from a side, in which case the visibility cone 
# can end up having close to 0 volume. The view angle is defined to be the angle between
# the normal to the visibility disc and the direction vector from the sensor origin.
# The value below represents the minimum desired view angle. For a perfect view,
# this value will be 0 (the two vectors are exact opposites). For a completely obstructed view
# this value will be Pi/2 (the vectors are perpendicular). This value defined below 
# is the maximum view angle to be maintained. This should be a value in the open interval
# (0, Pi/2). If 0 is set, the view angle is NOT enforced.
float64 max_view_angle

# This angle is used similarly to max_view_angle but limits the maximum angle
# between the sensor origin direction vector and the axis that connects the
# sensor origin to the target frame origin. The value is again in the range (0, Pi/2)
# and is NOT enforced if set to 0.
float64 max_range_angle

# The axis that is assumed to indicate the direction of view for the sensor
# X = 2, Y = 1, Z = 0
uint8 SENSOR_Z=0
uint8 SENSOR_Y=1
uint8 SENSOR_X=2
uint8 sensor_view_direction

# A weighting factor for this constraint (denotes relative importance to other constraints. Closer to zero means less important)
float64 weight

================================================================================
MSG: geometry_msgs/PoseStamped
# A Pose with reference coordinate frame and timestamp
Header header
Pose pose
"""
  __slots__ = ['name','joint_constraints','position_constraints','orientation_constraints','visibility_constraints']
  _slot_types = ['string','moveit_msgs/JointConstraint[]','moveit_msgs/PositionConstraint[]','moveit_msgs/OrientationConstraint[]','moveit_msgs/VisibilityConstraint[]']

  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:
       name,joint_constraints,position_constraints,orientation_constraints,visibility_constraints

    :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(Constraints, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.name is None:
        self.name = ''
      if self.joint_constraints is None:
        self.joint_constraints = []
      if self.position_constraints is None:
        self.position_constraints = []
      if self.orientation_constraints is None:
        self.orientation_constraints = []
      if self.visibility_constraints is None:
        self.visibility_constraints = []
    else:
      self.name = ''
      self.joint_constraints = []
      self.position_constraints = []
      self.orientation_constraints = []
      self.visibility_constraints = []

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

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      _x = self.name
      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(self.joint_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.joint_constraints:
        _x = val1.joint_name
        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
        buff.write(_get_struct_4d().pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
      length = len(self.position_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.position_constraints:
        _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.link_name
        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.target_point_offset
        _x = _v3
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v4 = val1.constraint_region
        length = len(_v4.primitives)
        buff.write(_struct_I.pack(length))
        for val3 in _v4.primitives:
          _x = val3.type
          buff.write(_get_struct_B().pack(_x))
          length = len(val3.dimensions)
          buff.write(_struct_I.pack(length))
          pattern = '<%sd'%length
          buff.write(struct.Struct(pattern).pack(*val3.dimensions))
        length = len(_v4.primitive_poses)
        buff.write(_struct_I.pack(length))
        for val3 in _v4.primitive_poses:
          _v5 = val3.position
          _x = _v5
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v6 = val3.orientation
          _x = _v6
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(_v4.meshes)
        buff.write(_struct_I.pack(length))
        for val3 in _v4.meshes:
          length = len(val3.triangles)
          buff.write(_struct_I.pack(length))
          for val4 in val3.triangles:
            buff.write(_get_struct_3I().pack(*val4.vertex_indices))
          length = len(val3.vertices)
          buff.write(_struct_I.pack(length))
          for val4 in val3.vertices:
            _x = val4
            buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        length = len(_v4.mesh_poses)
        buff.write(_struct_I.pack(length))
        for val3 in _v4.mesh_poses:
          _v7 = val3.position
          _x = _v7
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v8 = val3.orientation
          _x = _v8
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.weight
        buff.write(_get_struct_d().pack(_x))
      length = len(self.orientation_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.orientation_constraints:
        _v9 = val1.header
        _x = _v9.seq
        buff.write(_get_struct_I().pack(_x))
        _v10 = _v9.stamp
        _x = _v10
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v9.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))
        _v11 = val1.orientation
        _x = _v11
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.link_name
        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
        buff.write(_get_struct_4d().pack(_x.absolute_x_axis_tolerance, _x.absolute_y_axis_tolerance, _x.absolute_z_axis_tolerance, _x.weight))
      length = len(self.visibility_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.visibility_constraints:
        _x = val1.target_radius
        buff.write(_get_struct_d().pack(_x))
        _v12 = val1.target_pose
        _v13 = _v12.header
        _x = _v13.seq
        buff.write(_get_struct_I().pack(_x))
        _v14 = _v13.stamp
        _x = _v14
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v13.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))
        _v15 = _v12.pose
        _v16 = _v15.position
        _x = _v16
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v17 = _v15.orientation
        _x = _v17
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.cone_sides
        buff.write(_get_struct_i().pack(_x))
        _v18 = val1.sensor_pose
        _v19 = _v18.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))
        _v21 = _v18.pose
        _v22 = _v21.position
        _x = _v22
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v23 = _v21.orientation
        _x = _v23
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1
        buff.write(_get_struct_2dBd().pack(_x.max_view_angle, _x.max_range_angle, _x.sensor_view_direction, _x.weight))
    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.joint_constraints is None:
        self.joint_constraints = None
      if self.position_constraints is None:
        self.position_constraints = None
      if self.orientation_constraints is None:
        self.orientation_constraints = None
      if self.visibility_constraints is None:
        self.visibility_constraints = None
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.name = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.name = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.joint_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.JointConstraint()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.joint_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.joint_name = str[start:end]
        _x = val1
        start = end
        end += 32
        (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _get_struct_4d().unpack(str[start:end])
        self.joint_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.position_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.PositionConstraint()
        _v24 = val1.header
        start = end
        end += 4
        (_v24.seq,) = _get_struct_I().unpack(str[start:end])
        _v25 = _v24.stamp
        _x = _v25
        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:
          _v24.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v24.frame_id = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.link_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.link_name = str[start:end]
        _v26 = val1.target_point_offset
        _x = _v26
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v27 = val1.constraint_region
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v27.primitives = []
        for i in range(0, length):
          val3 = shape_msgs.msg.SolidPrimitive()
          start = end
          end += 1
          (val3.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
          val3.dimensions = s.unpack(str[start:end])
          _v27.primitives.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v27.primitive_poses = []
        for i in range(0, length):
          val3 = geometry_msgs.msg.Pose()
          _v28 = val3.position
          _x = _v28
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v29 = val3.orientation
          _x = _v29
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          _v27.primitive_poses.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v27.meshes = []
        for i in range(0, length):
          val3 = shape_msgs.msg.Mesh()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val3.triangles = []
          for i in range(0, length):
            val4 = shape_msgs.msg.MeshTriangle()
            start = end
            end += 12
            val4.vertex_indices = _get_struct_3I().unpack(str[start:end])
            val3.triangles.append(val4)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val3.vertices = []
          for i in range(0, length):
            val4 = geometry_msgs.msg.Point()
            _x = val4
            start = end
            end += 24
            (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
            val3.vertices.append(val4)
          _v27.meshes.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v27.mesh_poses = []
        for i in range(0, length):
          val3 = geometry_msgs.msg.Pose()
          _v30 = val3.position
          _x = _v30
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v31 = val3.orientation
          _x = _v31
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          _v27.mesh_poses.append(val3)
        start = end
        end += 8
        (val1.weight,) = _get_struct_d().unpack(str[start:end])
        self.position_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.orientation_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.OrientationConstraint()
        _v32 = val1.header
        start = end
        end += 4
        (_v32.seq,) = _get_struct_I().unpack(str[start:end])
        _v33 = _v32.stamp
        _x = _v33
        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:
          _v32.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v32.frame_id = str[start:end]
        _v34 = val1.orientation
        _x = _v34
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.link_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.link_name = str[start:end]
        _x = val1
        start = end
        end += 32
        (_x.absolute_x_axis_tolerance, _x.absolute_y_axis_tolerance, _x.absolute_z_axis_tolerance, _x.weight,) = _get_struct_4d().unpack(str[start:end])
        self.orientation_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.visibility_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.VisibilityConstraint()
        start = end
        end += 8
        (val1.target_radius,) = _get_struct_d().unpack(str[start:end])
        _v35 = val1.target_pose
        _v36 = _v35.header
        start = end
        end += 4
        (_v36.seq,) = _get_struct_I().unpack(str[start:end])
        _v37 = _v36.stamp
        _x = _v37
        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:
          _v36.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v36.frame_id = str[start:end]
        _v38 = _v35.pose
        _v39 = _v38.position
        _x = _v39
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v40 = _v38.orientation
        _x = _v40
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        start = end
        end += 4
        (val1.cone_sides,) = _get_struct_i().unpack(str[start:end])
        _v41 = val1.sensor_pose
        _v42 = _v41.header
        start = end
        end += 4
        (_v42.seq,) = _get_struct_I().unpack(str[start:end])
        _v43 = _v42.stamp
        _x = _v43
        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:
          _v42.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v42.frame_id = str[start:end]
        _v44 = _v41.pose
        _v45 = _v44.position
        _x = _v45
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v46 = _v44.orientation
        _x = _v46
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        _x = val1
        start = end
        end += 25
        (_x.max_view_angle, _x.max_range_angle, _x.sensor_view_direction, _x.weight,) = _get_struct_2dBd().unpack(str[start:end])
        self.visibility_constraints.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:
      _x = self.name
      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(self.joint_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.joint_constraints:
        _x = val1.joint_name
        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
        buff.write(_get_struct_4d().pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
      length = len(self.position_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.position_constraints:
        _v47 = val1.header
        _x = _v47.seq
        buff.write(_get_struct_I().pack(_x))
        _v48 = _v47.stamp
        _x = _v48
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v47.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.link_name
        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))
        _v49 = val1.target_point_offset
        _x = _v49
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v50 = val1.constraint_region
        length = len(_v50.primitives)
        buff.write(_struct_I.pack(length))
        for val3 in _v50.primitives:
          _x = val3.type
          buff.write(_get_struct_B().pack(_x))
          length = len(val3.dimensions)
          buff.write(_struct_I.pack(length))
          pattern = '<%sd'%length
          buff.write(val3.dimensions.tostring())
        length = len(_v50.primitive_poses)
        buff.write(_struct_I.pack(length))
        for val3 in _v50.primitive_poses:
          _v51 = val3.position
          _x = _v51
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v52 = val3.orientation
          _x = _v52
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        length = len(_v50.meshes)
        buff.write(_struct_I.pack(length))
        for val3 in _v50.meshes:
          length = len(val3.triangles)
          buff.write(_struct_I.pack(length))
          for val4 in val3.triangles:
            buff.write(val4.vertex_indices.tostring())
          length = len(val3.vertices)
          buff.write(_struct_I.pack(length))
          for val4 in val3.vertices:
            _x = val4
            buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        length = len(_v50.mesh_poses)
        buff.write(_struct_I.pack(length))
        for val3 in _v50.mesh_poses:
          _v53 = val3.position
          _x = _v53
          buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
          _v54 = val3.orientation
          _x = _v54
          buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.weight
        buff.write(_get_struct_d().pack(_x))
      length = len(self.orientation_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.orientation_constraints:
        _v55 = val1.header
        _x = _v55.seq
        buff.write(_get_struct_I().pack(_x))
        _v56 = _v55.stamp
        _x = _v56
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v55.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))
        _v57 = val1.orientation
        _x = _v57
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.link_name
        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
        buff.write(_get_struct_4d().pack(_x.absolute_x_axis_tolerance, _x.absolute_y_axis_tolerance, _x.absolute_z_axis_tolerance, _x.weight))
      length = len(self.visibility_constraints)
      buff.write(_struct_I.pack(length))
      for val1 in self.visibility_constraints:
        _x = val1.target_radius
        buff.write(_get_struct_d().pack(_x))
        _v58 = val1.target_pose
        _v59 = _v58.header
        _x = _v59.seq
        buff.write(_get_struct_I().pack(_x))
        _v60 = _v59.stamp
        _x = _v60
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v59.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))
        _v61 = _v58.pose
        _v62 = _v61.position
        _x = _v62
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v63 = _v61.orientation
        _x = _v63
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1.cone_sides
        buff.write(_get_struct_i().pack(_x))
        _v64 = val1.sensor_pose
        _v65 = _v64.header
        _x = _v65.seq
        buff.write(_get_struct_I().pack(_x))
        _v66 = _v65.stamp
        _x = _v66
        buff.write(_get_struct_2I().pack(_x.secs, _x.nsecs))
        _x = _v65.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))
        _v67 = _v64.pose
        _v68 = _v67.position
        _x = _v68
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
        _v69 = _v67.orientation
        _x = _v69
        buff.write(_get_struct_4d().pack(_x.x, _x.y, _x.z, _x.w))
        _x = val1
        buff.write(_get_struct_2dBd().pack(_x.max_view_angle, _x.max_range_angle, _x.sensor_view_direction, _x.weight))
    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.joint_constraints is None:
        self.joint_constraints = None
      if self.position_constraints is None:
        self.position_constraints = None
      if self.orientation_constraints is None:
        self.orientation_constraints = None
      if self.visibility_constraints is None:
        self.visibility_constraints = None
      end = 0
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.name = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.name = str[start:end]
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.joint_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.JointConstraint()
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.joint_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.joint_name = str[start:end]
        _x = val1
        start = end
        end += 32
        (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _get_struct_4d().unpack(str[start:end])
        self.joint_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.position_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.PositionConstraint()
        _v70 = val1.header
        start = end
        end += 4
        (_v70.seq,) = _get_struct_I().unpack(str[start:end])
        _v71 = _v70.stamp
        _x = _v71
        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:
          _v70.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v70.frame_id = str[start:end]
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.link_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.link_name = str[start:end]
        _v72 = val1.target_point_offset
        _x = _v72
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v73 = val1.constraint_region
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v73.primitives = []
        for i in range(0, length):
          val3 = shape_msgs.msg.SolidPrimitive()
          start = end
          end += 1
          (val3.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
          val3.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
          _v73.primitives.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v73.primitive_poses = []
        for i in range(0, length):
          val3 = geometry_msgs.msg.Pose()
          _v74 = val3.position
          _x = _v74
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v75 = val3.orientation
          _x = _v75
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          _v73.primitive_poses.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v73.meshes = []
        for i in range(0, length):
          val3 = shape_msgs.msg.Mesh()
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val3.triangles = []
          for i in range(0, length):
            val4 = shape_msgs.msg.MeshTriangle()
            start = end
            end += 12
            val4.vertex_indices = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=3)
            val3.triangles.append(val4)
          start = end
          end += 4
          (length,) = _struct_I.unpack(str[start:end])
          val3.vertices = []
          for i in range(0, length):
            val4 = geometry_msgs.msg.Point()
            _x = val4
            start = end
            end += 24
            (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
            val3.vertices.append(val4)
          _v73.meshes.append(val3)
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        _v73.mesh_poses = []
        for i in range(0, length):
          val3 = geometry_msgs.msg.Pose()
          _v76 = val3.position
          _x = _v76
          start = end
          end += 24
          (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
          _v77 = val3.orientation
          _x = _v77
          start = end
          end += 32
          (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
          _v73.mesh_poses.append(val3)
        start = end
        end += 8
        (val1.weight,) = _get_struct_d().unpack(str[start:end])
        self.position_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.orientation_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.OrientationConstraint()
        _v78 = val1.header
        start = end
        end += 4
        (_v78.seq,) = _get_struct_I().unpack(str[start:end])
        _v79 = _v78.stamp
        _x = _v79
        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:
          _v78.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v78.frame_id = str[start:end]
        _v80 = val1.orientation
        _x = _v80
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        start = end
        end += 4
        (length,) = _struct_I.unpack(str[start:end])
        start = end
        end += length
        if python3:
          val1.link_name = str[start:end].decode('utf-8', 'rosmsg')
        else:
          val1.link_name = str[start:end]
        _x = val1
        start = end
        end += 32
        (_x.absolute_x_axis_tolerance, _x.absolute_y_axis_tolerance, _x.absolute_z_axis_tolerance, _x.weight,) = _get_struct_4d().unpack(str[start:end])
        self.orientation_constraints.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.visibility_constraints = []
      for i in range(0, length):
        val1 = moveit_msgs.msg.VisibilityConstraint()
        start = end
        end += 8
        (val1.target_radius,) = _get_struct_d().unpack(str[start:end])
        _v81 = val1.target_pose
        _v82 = _v81.header
        start = end
        end += 4
        (_v82.seq,) = _get_struct_I().unpack(str[start:end])
        _v83 = _v82.stamp
        _x = _v83
        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:
          _v82.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v82.frame_id = str[start:end]
        _v84 = _v81.pose
        _v85 = _v84.position
        _x = _v85
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v86 = _v84.orientation
        _x = _v86
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        start = end
        end += 4
        (val1.cone_sides,) = _get_struct_i().unpack(str[start:end])
        _v87 = val1.sensor_pose
        _v88 = _v87.header
        start = end
        end += 4
        (_v88.seq,) = _get_struct_I().unpack(str[start:end])
        _v89 = _v88.stamp
        _x = _v89
        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:
          _v88.frame_id = str[start:end].decode('utf-8', 'rosmsg')
        else:
          _v88.frame_id = str[start:end]
        _v90 = _v87.pose
        _v91 = _v90.position
        _x = _v91
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        _v92 = _v90.orientation
        _x = _v92
        start = end
        end += 32
        (_x.x, _x.y, _x.z, _x.w,) = _get_struct_4d().unpack(str[start:end])
        _x = val1
        start = end
        end += 25
        (_x.max_view_angle, _x.max_range_angle, _x.sensor_view_direction, _x.weight,) = _get_struct_2dBd().unpack(str[start:end])
        self.visibility_constraints.append(val1)
      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_2dBd = None
def _get_struct_2dBd():
    global _struct_2dBd
    if _struct_2dBd is None:
        _struct_2dBd = struct.Struct("<2dBd")
    return _struct_2dBd
_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_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
_struct_i = None
def _get_struct_i():
    global _struct_i
    if _struct_i is None:
        _struct_i = struct.Struct("<i")
    return _struct_i
