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

import uavatt_ros.msg

class uavatt_ids_servo_s(genpy.Message):
  _md5sum = "90217e6f9ed44a725b68c3aa58929b7a"
  _type = "uavatt_ros/uavatt_ids_servo_s"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """# IDL struct ::uavatt::ids::servo_s
uavatt_ids_servo_s_satweight_s satweight
uavatt_ids_servo_s_gain_s gain
uavatt_attitude_control_mode att_mode
float64 ramp
float64 scale
uavatt_ids_servo_s_emerg_s emerg

================================================================================
MSG: uavatt_ros/uavatt_ids_servo_s_satweight_s
# IDL struct ::uavatt::ids::servo_s::satweight_s
bool enable
float64 thrust
float64 lateral
float64 tilt
float64 head

================================================================================
MSG: uavatt_ros/uavatt_ids_servo_s_gain_s
# IDL struct ::uavatt::ids::servo_s::gain_s
float64 Kqxy
float64 Kqz
float64 Kwxy
float64 Kwz

================================================================================
MSG: uavatt_ros/uavatt_attitude_control_mode
# IDL enum ::uavatt::attitude_control_mode
uint32 uavatt_full_attitude = 0
uint32 uavatt_tilt_prioritized = 1

uint32 value

================================================================================
MSG: uavatt_ros/uavatt_ids_servo_s_emerg_s
# IDL struct ::uavatt::ids::servo_s::emerg_s
float64 dq
float64 dw
"""
  __slots__ = ['satweight','gain','att_mode','ramp','scale','emerg']
  _slot_types = ['uavatt_ros/uavatt_ids_servo_s_satweight_s','uavatt_ros/uavatt_ids_servo_s_gain_s','uavatt_ros/uavatt_attitude_control_mode','float64','float64','uavatt_ros/uavatt_ids_servo_s_emerg_s']

  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:
       satweight,gain,att_mode,ramp,scale,emerg

    :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(uavatt_ids_servo_s, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.satweight is None:
        self.satweight = uavatt_ros.msg.uavatt_ids_servo_s_satweight_s()
      if self.gain is None:
        self.gain = uavatt_ros.msg.uavatt_ids_servo_s_gain_s()
      if self.att_mode is None:
        self.att_mode = uavatt_ros.msg.uavatt_attitude_control_mode()
      if self.ramp is None:
        self.ramp = 0.
      if self.scale is None:
        self.scale = 0.
      if self.emerg is None:
        self.emerg = uavatt_ros.msg.uavatt_ids_servo_s_emerg_s()
    else:
      self.satweight = uavatt_ros.msg.uavatt_ids_servo_s_satweight_s()
      self.gain = uavatt_ros.msg.uavatt_ids_servo_s_gain_s()
      self.att_mode = uavatt_ros.msg.uavatt_attitude_control_mode()
      self.ramp = 0.
      self.scale = 0.
      self.emerg = uavatt_ros.msg.uavatt_ids_servo_s_emerg_s()

  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
      buff.write(_get_struct_B8dI4d().pack(_x.satweight.enable, _x.satweight.thrust, _x.satweight.lateral, _x.satweight.tilt, _x.satweight.head, _x.gain.Kqxy, _x.gain.Kqz, _x.gain.Kwxy, _x.gain.Kwz, _x.att_mode.value, _x.ramp, _x.scale, _x.emerg.dq, _x.emerg.dw))
    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``
    """
    if python3:
      codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      if self.satweight is None:
        self.satweight = uavatt_ros.msg.uavatt_ids_servo_s_satweight_s()
      if self.gain is None:
        self.gain = uavatt_ros.msg.uavatt_ids_servo_s_gain_s()
      if self.att_mode is None:
        self.att_mode = uavatt_ros.msg.uavatt_attitude_control_mode()
      if self.emerg is None:
        self.emerg = uavatt_ros.msg.uavatt_ids_servo_s_emerg_s()
      end = 0
      _x = self
      start = end
      end += 101
      (_x.satweight.enable, _x.satweight.thrust, _x.satweight.lateral, _x.satweight.tilt, _x.satweight.head, _x.gain.Kqxy, _x.gain.Kqz, _x.gain.Kwxy, _x.gain.Kwz, _x.att_mode.value, _x.ramp, _x.scale, _x.emerg.dq, _x.emerg.dw,) = _get_struct_B8dI4d().unpack(str[start:end])
      self.satweight.enable = bool(self.satweight.enable)
      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
      buff.write(_get_struct_B8dI4d().pack(_x.satweight.enable, _x.satweight.thrust, _x.satweight.lateral, _x.satweight.tilt, _x.satweight.head, _x.gain.Kqxy, _x.gain.Kqz, _x.gain.Kwxy, _x.gain.Kwz, _x.att_mode.value, _x.ramp, _x.scale, _x.emerg.dq, _x.emerg.dw))
    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
    """
    if python3:
      codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      if self.satweight is None:
        self.satweight = uavatt_ros.msg.uavatt_ids_servo_s_satweight_s()
      if self.gain is None:
        self.gain = uavatt_ros.msg.uavatt_ids_servo_s_gain_s()
      if self.att_mode is None:
        self.att_mode = uavatt_ros.msg.uavatt_attitude_control_mode()
      if self.emerg is None:
        self.emerg = uavatt_ros.msg.uavatt_ids_servo_s_emerg_s()
      end = 0
      _x = self
      start = end
      end += 101
      (_x.satweight.enable, _x.satweight.thrust, _x.satweight.lateral, _x.satweight.tilt, _x.satweight.head, _x.gain.Kqxy, _x.gain.Kqz, _x.gain.Kwxy, _x.gain.Kwz, _x.att_mode.value, _x.ramp, _x.scale, _x.emerg.dq, _x.emerg.dw,) = _get_struct_B8dI4d().unpack(str[start:end])
      self.satweight.enable = bool(self.satweight.enable)
      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_B8dI4d = None
def _get_struct_B8dI4d():
    global _struct_B8dI4d
    if _struct_B8dI4d is None:
        _struct_B8dI4d = struct.Struct("<B8dI4d")
    return _struct_B8dI4d
