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

import uavpos_ros.msg

class or_uav_input(genpy.Message):
  _md5sum = "b5b1a4508a3f01c7750e9e03fbe49436"
  _type = "uavpos_ros/or_uav_input"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """# IDL struct ::or_uav::input
or_time_ts ts
bool intrinsic
or_rb3d_force[] thrust
or_t3d_att[] att
or_t3d_avel[] avel
or_t3d_aacc[] aacc

================================================================================
MSG: uavpos_ros/or_time_ts
# IDL struct ::or::time::ts
int32 sec
int32 nsec

================================================================================
MSG: uavpos_ros/or_rb3d_force
# IDL struct ::or::rb3d::force
float64 x
float64 y
float64 z

================================================================================
MSG: uavpos_ros/or_t3d_att
# IDL struct ::or::t3d::att
float64 qw
float64 qx
float64 qy
float64 qz

================================================================================
MSG: uavpos_ros/or_t3d_avel
# IDL struct ::or::t3d::avel
float64 wx
float64 wy
float64 wz

================================================================================
MSG: uavpos_ros/or_t3d_aacc
# IDL struct ::or::t3d::aacc
float64 awx
float64 awy
float64 awz
"""
  __slots__ = ['ts','intrinsic','thrust','att','avel','aacc']
  _slot_types = ['uavpos_ros/or_time_ts','bool','uavpos_ros/or_rb3d_force[]','uavpos_ros/or_t3d_att[]','uavpos_ros/or_t3d_avel[]','uavpos_ros/or_t3d_aacc[]']

  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:
       ts,intrinsic,thrust,att,avel,aacc

    :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(or_uav_input, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.ts is None:
        self.ts = uavpos_ros.msg.or_time_ts()
      if self.intrinsic is None:
        self.intrinsic = False
      if self.thrust is None:
        self.thrust = []
      if self.att is None:
        self.att = []
      if self.avel is None:
        self.avel = []
      if self.aacc is None:
        self.aacc = []
    else:
      self.ts = uavpos_ros.msg.or_time_ts()
      self.intrinsic = False
      self.thrust = []
      self.att = []
      self.avel = []
      self.aacc = []

  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_2iB().pack(_x.ts.sec, _x.ts.nsec, _x.intrinsic))
      length = len(self.thrust)
      buff.write(_struct_I.pack(length))
      for val1 in self.thrust:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
      length = len(self.att)
      buff.write(_struct_I.pack(length))
      for val1 in self.att:
        _x = val1
        buff.write(_get_struct_4d().pack(_x.qw, _x.qx, _x.qy, _x.qz))
      length = len(self.avel)
      buff.write(_struct_I.pack(length))
      for val1 in self.avel:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.wx, _x.wy, _x.wz))
      length = len(self.aacc)
      buff.write(_struct_I.pack(length))
      for val1 in self.aacc:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.awx, _x.awy, _x.awz))
    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.ts is None:
        self.ts = uavpos_ros.msg.or_time_ts()
      if self.thrust is None:
        self.thrust = None
      if self.att is None:
        self.att = None
      if self.avel is None:
        self.avel = None
      if self.aacc is None:
        self.aacc = None
      end = 0
      _x = self
      start = end
      end += 9
      (_x.ts.sec, _x.ts.nsec, _x.intrinsic,) = _get_struct_2iB().unpack(str[start:end])
      self.intrinsic = bool(self.intrinsic)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.thrust = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_rb3d_force()
        _x = val1
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        self.thrust.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.att = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_att()
        _x = val1
        start = end
        end += 32
        (_x.qw, _x.qx, _x.qy, _x.qz,) = _get_struct_4d().unpack(str[start:end])
        self.att.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.avel = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_avel()
        _x = val1
        start = end
        end += 24
        (_x.wx, _x.wy, _x.wz,) = _get_struct_3d().unpack(str[start:end])
        self.avel.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.aacc = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_aacc()
        _x = val1
        start = end
        end += 24
        (_x.awx, _x.awy, _x.awz,) = _get_struct_3d().unpack(str[start:end])
        self.aacc.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
      buff.write(_get_struct_2iB().pack(_x.ts.sec, _x.ts.nsec, _x.intrinsic))
      length = len(self.thrust)
      buff.write(_struct_I.pack(length))
      for val1 in self.thrust:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.x, _x.y, _x.z))
      length = len(self.att)
      buff.write(_struct_I.pack(length))
      for val1 in self.att:
        _x = val1
        buff.write(_get_struct_4d().pack(_x.qw, _x.qx, _x.qy, _x.qz))
      length = len(self.avel)
      buff.write(_struct_I.pack(length))
      for val1 in self.avel:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.wx, _x.wy, _x.wz))
      length = len(self.aacc)
      buff.write(_struct_I.pack(length))
      for val1 in self.aacc:
        _x = val1
        buff.write(_get_struct_3d().pack(_x.awx, _x.awy, _x.awz))
    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.ts is None:
        self.ts = uavpos_ros.msg.or_time_ts()
      if self.thrust is None:
        self.thrust = None
      if self.att is None:
        self.att = None
      if self.avel is None:
        self.avel = None
      if self.aacc is None:
        self.aacc = None
      end = 0
      _x = self
      start = end
      end += 9
      (_x.ts.sec, _x.ts.nsec, _x.intrinsic,) = _get_struct_2iB().unpack(str[start:end])
      self.intrinsic = bool(self.intrinsic)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.thrust = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_rb3d_force()
        _x = val1
        start = end
        end += 24
        (_x.x, _x.y, _x.z,) = _get_struct_3d().unpack(str[start:end])
        self.thrust.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.att = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_att()
        _x = val1
        start = end
        end += 32
        (_x.qw, _x.qx, _x.qy, _x.qz,) = _get_struct_4d().unpack(str[start:end])
        self.att.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.avel = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_avel()
        _x = val1
        start = end
        end += 24
        (_x.wx, _x.wy, _x.wz,) = _get_struct_3d().unpack(str[start:end])
        self.avel.append(val1)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      self.aacc = []
      for i in range(0, length):
        val1 = uavpos_ros.msg.or_t3d_aacc()
        _x = val1
        start = end
        end += 24
        (_x.awx, _x.awy, _x.awz,) = _get_struct_3d().unpack(str[start:end])
        self.aacc.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_2iB = None
def _get_struct_2iB():
    global _struct_2iB
    if _struct_2iB is None:
        _struct_2iB = struct.Struct("<2iB")
    return _struct_2iB
_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
