// 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;
let std_msgs = _finder('std_msgs');

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

class KMRStatus {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.header = null;
      this.robot_op_state = null;
      this.commandable = null;
      this.stationary = null;
      this.last_graph_node_id = null;
      this.safety_state = null;
      this.state_of_charge = null;
    }
    else {
      if (initObj.hasOwnProperty('header')) {
        this.header = initObj.header
      }
      else {
        this.header = new std_msgs.msg.Header();
      }
      if (initObj.hasOwnProperty('robot_op_state')) {
        this.robot_op_state = initObj.robot_op_state
      }
      else {
        this.robot_op_state = '';
      }
      if (initObj.hasOwnProperty('commandable')) {
        this.commandable = initObj.commandable
      }
      else {
        this.commandable = false;
      }
      if (initObj.hasOwnProperty('stationary')) {
        this.stationary = initObj.stationary
      }
      else {
        this.stationary = false;
      }
      if (initObj.hasOwnProperty('last_graph_node_id')) {
        this.last_graph_node_id = initObj.last_graph_node_id
      }
      else {
        this.last_graph_node_id = 0;
      }
      if (initObj.hasOwnProperty('safety_state')) {
        this.safety_state = initObj.safety_state
      }
      else {
        this.safety_state = 0;
      }
      if (initObj.hasOwnProperty('state_of_charge')) {
        this.state_of_charge = initObj.state_of_charge
      }
      else {
        this.state_of_charge = 0.0;
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type KMRStatus
    // Serialize message field [header]
    bufferOffset = std_msgs.msg.Header.serialize(obj.header, buffer, bufferOffset);
    // Serialize message field [robot_op_state]
    bufferOffset = _serializer.string(obj.robot_op_state, buffer, bufferOffset);
    // Serialize message field [commandable]
    bufferOffset = _serializer.bool(obj.commandable, buffer, bufferOffset);
    // Serialize message field [stationary]
    bufferOffset = _serializer.bool(obj.stationary, buffer, bufferOffset);
    // Serialize message field [last_graph_node_id]
    bufferOffset = _serializer.int32(obj.last_graph_node_id, buffer, bufferOffset);
    // Serialize message field [safety_state]
    bufferOffset = _serializer.int32(obj.safety_state, buffer, bufferOffset);
    // Serialize message field [state_of_charge]
    bufferOffset = _serializer.float32(obj.state_of_charge, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type KMRStatus
    let len;
    let data = new KMRStatus(null);
    // Deserialize message field [header]
    data.header = std_msgs.msg.Header.deserialize(buffer, bufferOffset);
    // Deserialize message field [robot_op_state]
    data.robot_op_state = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [commandable]
    data.commandable = _deserializer.bool(buffer, bufferOffset);
    // Deserialize message field [stationary]
    data.stationary = _deserializer.bool(buffer, bufferOffset);
    // Deserialize message field [last_graph_node_id]
    data.last_graph_node_id = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [safety_state]
    data.safety_state = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [state_of_charge]
    data.state_of_charge = _deserializer.float32(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += std_msgs.msg.Header.getMessageSize(object.header);
    length += _getByteLength(object.robot_op_state);
    return length + 18;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    Header header
    string robot_op_state
    bool commandable
    bool stationary
    int32 last_graph_node_id
    int32 ACKNOWLEDGE_REQUIRED = 1
    int32 EMERGENCY_STOP = 2
    int32 SAFE = 3
    int32 WARNING_FILED = 4
    int32 safety_state
    float32 state_of_charge
    
    
    ================================================================================
    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
    
    `;
  }

  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 KMRStatus(null);
    if (msg.header !== undefined) {
      resolved.header = std_msgs.msg.Header.Resolve(msg.header)
    }
    else {
      resolved.header = new std_msgs.msg.Header()
    }

    if (msg.robot_op_state !== undefined) {
      resolved.robot_op_state = msg.robot_op_state;
    }
    else {
      resolved.robot_op_state = ''
    }

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

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

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

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

    if (msg.state_of_charge !== undefined) {
      resolved.state_of_charge = msg.state_of_charge;
    }
    else {
      resolved.state_of_charge = 0.0
    }

    return resolved;
    }
};

// Constants for message
KMRStatus.Constants = {
  ACKNOWLEDGE_REQUIRED: 1,
  EMERGENCY_STOP: 2,
  SAFE: 3,
  WARNING_FILED: 4,
}

module.exports = KMRStatus;
