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


class NavCommand(genpy.Message):
  _md5sum = "c83d4a6fe2238d17c0573f9bd0668daf"
  _type = "kmriiwa_chemist_msgs/NavCommand"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """int32 cmd_seq
bool priority_task
int32 robot_id
int32 graph_id
int32 node_id
bool fine_localization
"""
  __slots__ = ['cmd_seq','priority_task','robot_id','graph_id','node_id','fine_localization']
  _slot_types = ['int32','bool','int32','int32','int32','bool']

  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:
       cmd_seq,priority_task,robot_id,graph_id,node_id,fine_localization

    :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(NavCommand, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.cmd_seq is None:
        self.cmd_seq = 0
      if self.priority_task is None:
        self.priority_task = False
      if self.robot_id is None:
        self.robot_id = 0
      if self.graph_id is None:
        self.graph_id = 0
      if self.node_id is None:
        self.node_id = 0
      if self.fine_localization is None:
        self.fine_localization = False
    else:
      self.cmd_seq = 0
      self.priority_task = False
      self.robot_id = 0
      self.graph_id = 0
      self.node_id = 0
      self.fine_localization = False

  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_iB3iB().pack(_x.cmd_seq, _x.priority_task, _x.robot_id, _x.graph_id, _x.node_id, _x.fine_localization))
    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:
      end = 0
      _x = self
      start = end
      end += 18
      (_x.cmd_seq, _x.priority_task, _x.robot_id, _x.graph_id, _x.node_id, _x.fine_localization,) = _get_struct_iB3iB().unpack(str[start:end])
      self.priority_task = bool(self.priority_task)
      self.fine_localization = bool(self.fine_localization)
      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_iB3iB().pack(_x.cmd_seq, _x.priority_task, _x.robot_id, _x.graph_id, _x.node_id, _x.fine_localization))
    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:
      end = 0
      _x = self
      start = end
      end += 18
      (_x.cmd_seq, _x.priority_task, _x.robot_id, _x.graph_id, _x.node_id, _x.fine_localization,) = _get_struct_iB3iB().unpack(str[start:end])
      self.priority_task = bool(self.priority_task)
      self.fine_localization = bool(self.fine_localization)
      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_iB3iB = None
def _get_struct_iB3iB():
    global _struct_iB3iB
    if _struct_iB3iB is None:
        _struct_iB3iB = struct.Struct("<iB3iB")
    return _struct_iB3iB
