// Auto-generated. Do not edit!

// (in-package kmriiwa_chemist_msgs.msg)


"use strict";

const _serializer = _ros_msg_utils.Serialize;
const _arraySerializer = _serializer.Array;
const _deserializer = _ros_msg_utils.Deserialize;
const _arrayDeserializer = _deserializer.Array;
const _finder = _ros_msg_utils.Find;
const _getByteLength = _ros_msg_utils.getByteLength;

//-----------------------------------------------------------

class NavCommand {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.cmd_seq = null;
      this.priority_task = null;
      this.robot_id = null;
      this.graph_id = null;
      this.node_id = null;
      this.fine_localization = null;
    }
    else {
      if (initObj.hasOwnProperty('cmd_seq')) {
        this.cmd_seq = initObj.cmd_seq
      }
      else {
        this.cmd_seq = 0;
      }
      if (initObj.hasOwnProperty('priority_task')) {
        this.priority_task = initObj.priority_task
      }
      else {
        this.priority_task = false;
      }
      if (initObj.hasOwnProperty('robot_id')) {
        this.robot_id = initObj.robot_id
      }
      else {
        this.robot_id = 0;
      }
      if (initObj.hasOwnProperty('graph_id')) {
        this.graph_id = initObj.graph_id
      }
      else {
        this.graph_id = 0;
      }
      if (initObj.hasOwnProperty('node_id')) {
        this.node_id = initObj.node_id
      }
      else {
        this.node_id = 0;
      }
      if (initObj.hasOwnProperty('fine_localization')) {
        this.fine_localization = initObj.fine_localization
      }
      else {
        this.fine_localization = false;
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type NavCommand
    // Serialize message field [cmd_seq]
    bufferOffset = _serializer.int32(obj.cmd_seq, buffer, bufferOffset);
    // Serialize message field [priority_task]
    bufferOffset = _serializer.bool(obj.priority_task, buffer, bufferOffset);
    // Serialize message field [robot_id]
    bufferOffset = _serializer.int32(obj.robot_id, buffer, bufferOffset);
    // Serialize message field [graph_id]
    bufferOffset = _serializer.int32(obj.graph_id, buffer, bufferOffset);
    // Serialize message field [node_id]
    bufferOffset = _serializer.int32(obj.node_id, buffer, bufferOffset);
    // Serialize message field [fine_localization]
    bufferOffset = _serializer.bool(obj.fine_localization, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type NavCommand
    let len;
    let data = new NavCommand(null);
    // Deserialize message field [cmd_seq]
    data.cmd_seq = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [priority_task]
    data.priority_task = _deserializer.bool(buffer, bufferOffset);
    // Deserialize message field [robot_id]
    data.robot_id = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [graph_id]
    data.graph_id = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [node_id]
    data.node_id = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [fine_localization]
    data.fine_localization = _deserializer.bool(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    return 18;
  }

  static datatype() {
    // Returns string type for a message object
    return 'kmriiwa_chemist_msgs/NavCommand';
  }

  static md5sum() {
    //Returns md5sum for a message object
    return 'c83d4a6fe2238d17c0573f9bd0668daf';
  }

  static messageDefinition() {
    // Returns full string definition for message
    return `
    int32 cmd_seq
    bool priority_task
    int32 robot_id
    int32 graph_id
    int32 node_id
    bool fine_localization
    
    `;
  }

  static Resolve(msg) {
    // deep-construct a valid message object instance of whatever was passed in
    if (typeof msg !== 'object' || msg === null) {
      msg = {};
    }
    const resolved = new NavCommand(null);
    if (msg.cmd_seq !== undefined) {
      resolved.cmd_seq = msg.cmd_seq;
    }
    else {
      resolved.cmd_seq = 0
    }

    if (msg.priority_task !== undefined) {
      resolved.priority_task = msg.priority_task;
    }
    else {
      resolved.priority_task = false
    }

    if (msg.robot_id !== undefined) {
      resolved.robot_id = msg.robot_id;
    }
    else {
      resolved.robot_id = 0
    }

    if (msg.graph_id !== undefined) {
      resolved.graph_id = msg.graph_id;
    }
    else {
      resolved.graph_id = 0
    }

    if (msg.node_id !== undefined) {
      resolved.node_id = msg.node_id;
    }
    else {
      resolved.node_id = 0
    }

    if (msg.fine_localization !== undefined) {
      resolved.fine_localization = msg.fine_localization;
    }
    else {
      resolved.fine_localization = false
    }

    return resolved;
    }
};

module.exports = NavCommand;
