# generated from rosidl_generator_py/resource/_idl.py.em
# with input from interface_protocol:msg/JointMotionPlanRequest.idl
# generated code does not contain a copyright notice


# Import statements for member types

# Member 'joint_indices'
# Member 'target_positions'
# Member 'target_velocities'
# Member 'stiffness'
# Member 'damping'
import array  # noqa: E402, I100

import builtins  # noqa: E402, I100

import math  # noqa: E402, I100

import rosidl_parser.definition  # noqa: E402, I100


class Metaclass_JointMotionPlanRequest(type):
    """Metaclass of message 'JointMotionPlanRequest'."""

    _CREATE_ROS_MESSAGE = None
    _CONVERT_FROM_PY = None
    _CONVERT_TO_PY = None
    _DESTROY_ROS_MESSAGE = None
    _TYPE_SUPPORT = None

    __constants = {
        'REQUEST_PLAN_EXECUTE': 0,
        'REQUEST_CANCEL': 1,
        'REQUEST_RESET': 2,
    }

    @classmethod
    def __import_type_support__(cls):
        try:
            from rosidl_generator_py import import_type_support
            module = import_type_support('interface_protocol')
        except ImportError:
            import logging
            import traceback
            logger = logging.getLogger(
                'interface_protocol.msg.JointMotionPlanRequest')
            logger.debug(
                'Failed to import needed modules for type support:\n' +
                traceback.format_exc())
        else:
            cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__msg__joint_motion_plan_request
            cls._CONVERT_FROM_PY = module.convert_from_py_msg__msg__joint_motion_plan_request
            cls._CONVERT_TO_PY = module.convert_to_py_msg__msg__joint_motion_plan_request
            cls._TYPE_SUPPORT = module.type_support_msg__msg__joint_motion_plan_request
            cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__msg__joint_motion_plan_request

    @classmethod
    def __prepare__(cls, name, bases, **kwargs):
        # list constant names here so that they appear in the help text of
        # the message class under "Data and other attributes defined here:"
        # as well as populate each message instance
        return {
            'REQUEST_PLAN_EXECUTE': cls.__constants['REQUEST_PLAN_EXECUTE'],
            'REQUEST_CANCEL': cls.__constants['REQUEST_CANCEL'],
            'REQUEST_RESET': cls.__constants['REQUEST_RESET'],
        }

    @property
    def REQUEST_PLAN_EXECUTE(self):
        """Message constant 'REQUEST_PLAN_EXECUTE'."""
        return Metaclass_JointMotionPlanRequest.__constants['REQUEST_PLAN_EXECUTE']

    @property
    def REQUEST_CANCEL(self):
        """Message constant 'REQUEST_CANCEL'."""
        return Metaclass_JointMotionPlanRequest.__constants['REQUEST_CANCEL']

    @property
    def REQUEST_RESET(self):
        """Message constant 'REQUEST_RESET'."""
        return Metaclass_JointMotionPlanRequest.__constants['REQUEST_RESET']


class JointMotionPlanRequest(metaclass=Metaclass_JointMotionPlanRequest):
    """
    Message class 'JointMotionPlanRequest'.

    Constants:
      REQUEST_PLAN_EXECUTE
      REQUEST_CANCEL
      REQUEST_RESET
    """

    __slots__ = [
        '_request_id',
        '_request_type',
        '_use_gravity_compensation',
        '_joint_indices',
        '_target_positions',
        '_target_velocities',
        '_execution_time',
        '_stiffness',
        '_damping',
    ]

    _fields_and_field_types = {
        'request_id': 'int32',
        'request_type': 'uint8',
        'use_gravity_compensation': 'boolean',
        'joint_indices': 'sequence<int32>',
        'target_positions': 'sequence<double>',
        'target_velocities': 'sequence<double>',
        'execution_time': 'double',
        'stiffness': 'sequence<double>',
        'damping': 'sequence<double>',
    }

    SLOT_TYPES = (
        rosidl_parser.definition.BasicType('int32'),  # noqa: E501
        rosidl_parser.definition.BasicType('uint8'),  # noqa: E501
        rosidl_parser.definition.BasicType('boolean'),  # noqa: E501
        rosidl_parser.definition.UnboundedSequence(rosidl_parser.definition.BasicType('int32')),  # noqa: E501
        rosidl_parser.definition.UnboundedSequence(rosidl_parser.definition.BasicType('double')),  # noqa: E501
        rosidl_parser.definition.UnboundedSequence(rosidl_parser.definition.BasicType('double')),  # noqa: E501
        rosidl_parser.definition.BasicType('double'),  # noqa: E501
        rosidl_parser.definition.UnboundedSequence(rosidl_parser.definition.BasicType('double')),  # noqa: E501
        rosidl_parser.definition.UnboundedSequence(rosidl_parser.definition.BasicType('double')),  # noqa: E501
    )

    def __init__(self, **kwargs):
        assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
            'Invalid arguments passed to constructor: %s' % \
            ', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
        self.request_id = kwargs.get('request_id', int())
        self.request_type = kwargs.get('request_type', int())
        self.use_gravity_compensation = kwargs.get('use_gravity_compensation', bool())
        self.joint_indices = array.array('i', kwargs.get('joint_indices', []))
        self.target_positions = array.array('d', kwargs.get('target_positions', []))
        self.target_velocities = array.array('d', kwargs.get('target_velocities', []))
        self.execution_time = kwargs.get('execution_time', float())
        self.stiffness = array.array('d', kwargs.get('stiffness', []))
        self.damping = array.array('d', kwargs.get('damping', []))

    def __repr__(self):
        typename = self.__class__.__module__.split('.')
        typename.pop()
        typename.append(self.__class__.__name__)
        args = []
        for s, t in zip(self.__slots__, self.SLOT_TYPES):
            field = getattr(self, s)
            fieldstr = repr(field)
            # We use Python array type for fields that can be directly stored
            # in them, and "normal" sequences for everything else.  If it is
            # a type that we store in an array, strip off the 'array' portion.
            if (
                isinstance(t, rosidl_parser.definition.AbstractSequence) and
                isinstance(t.value_type, rosidl_parser.definition.BasicType) and
                t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
            ):
                if len(field) == 0:
                    fieldstr = '[]'
                else:
                    assert fieldstr.startswith('array(')
                    prefix = "array('X', "
                    suffix = ')'
                    fieldstr = fieldstr[len(prefix):-len(suffix)]
            args.append(s[1:] + '=' + fieldstr)
        return '%s(%s)' % ('.'.join(typename), ', '.join(args))

    def __eq__(self, other):
        if not isinstance(other, self.__class__):
            return False
        if self.request_id != other.request_id:
            return False
        if self.request_type != other.request_type:
            return False
        if self.use_gravity_compensation != other.use_gravity_compensation:
            return False
        if self.joint_indices != other.joint_indices:
            return False
        if self.target_positions != other.target_positions:
            return False
        if self.target_velocities != other.target_velocities:
            return False
        if self.execution_time != other.execution_time:
            return False
        if self.stiffness != other.stiffness:
            return False
        if self.damping != other.damping:
            return False
        return True

    @classmethod
    def get_fields_and_field_types(cls):
        from copy import copy
        return copy(cls._fields_and_field_types)

    @builtins.property
    def request_id(self):
        """Message field 'request_id'."""
        return self._request_id

    @request_id.setter
    def request_id(self, value):
        if __debug__:
            assert \
                isinstance(value, int), \
                "The 'request_id' field must be of type 'int'"
            assert value >= -2147483648 and value < 2147483648, \
                "The 'request_id' field must be an integer in [-2147483648, 2147483647]"
        self._request_id = value

    @builtins.property
    def request_type(self):
        """Message field 'request_type'."""
        return self._request_type

    @request_type.setter
    def request_type(self, value):
        if __debug__:
            assert \
                isinstance(value, int), \
                "The 'request_type' field must be of type 'int'"
            assert value >= 0 and value < 256, \
                "The 'request_type' field must be an unsigned integer in [0, 255]"
        self._request_type = value

    @builtins.property
    def use_gravity_compensation(self):
        """Message field 'use_gravity_compensation'."""
        return self._use_gravity_compensation

    @use_gravity_compensation.setter
    def use_gravity_compensation(self, value):
        if __debug__:
            assert \
                isinstance(value, bool), \
                "The 'use_gravity_compensation' field must be of type 'bool'"
        self._use_gravity_compensation = value

    @builtins.property
    def joint_indices(self):
        """Message field 'joint_indices'."""
        return self._joint_indices

    @joint_indices.setter
    def joint_indices(self, value):
        if isinstance(value, array.array):
            assert value.typecode == 'i', \
                "The 'joint_indices' array.array() must have the type code of 'i'"
            self._joint_indices = value
            return
        if __debug__:
            from collections.abc import Sequence
            from collections.abc import Set
            from collections import UserList
            from collections import UserString
            assert \
                ((isinstance(value, Sequence) or
                  isinstance(value, Set) or
                  isinstance(value, UserList)) and
                 not isinstance(value, str) and
                 not isinstance(value, UserString) and
                 all(isinstance(v, int) for v in value) and
                 all(val >= -2147483648 and val < 2147483648 for val in value)), \
                "The 'joint_indices' field must be a set or sequence and each value of type 'int' and each integer in [-2147483648, 2147483647]"
        self._joint_indices = array.array('i', value)

    @builtins.property
    def target_positions(self):
        """Message field 'target_positions'."""
        return self._target_positions

    @target_positions.setter
    def target_positions(self, value):
        if isinstance(value, array.array):
            assert value.typecode == 'd', \
                "The 'target_positions' array.array() must have the type code of 'd'"
            self._target_positions = value
            return
        if __debug__:
            from collections.abc import Sequence
            from collections.abc import Set
            from collections import UserList
            from collections import UserString
            assert \
                ((isinstance(value, Sequence) or
                  isinstance(value, Set) or
                  isinstance(value, UserList)) and
                 not isinstance(value, str) and
                 not isinstance(value, UserString) and
                 all(isinstance(v, float) for v in value) and
                 all(not (val < -1.7976931348623157e+308 or val > 1.7976931348623157e+308) or math.isinf(val) for val in value)), \
                "The 'target_positions' field must be a set or sequence and each value of type 'float' and each double in [-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]"
        self._target_positions = array.array('d', value)

    @builtins.property
    def target_velocities(self):
        """Message field 'target_velocities'."""
        return self._target_velocities

    @target_velocities.setter
    def target_velocities(self, value):
        if isinstance(value, array.array):
            assert value.typecode == 'd', \
                "The 'target_velocities' array.array() must have the type code of 'd'"
            self._target_velocities = value
            return
        if __debug__:
            from collections.abc import Sequence
            from collections.abc import Set
            from collections import UserList
            from collections import UserString
            assert \
                ((isinstance(value, Sequence) or
                  isinstance(value, Set) or
                  isinstance(value, UserList)) and
                 not isinstance(value, str) and
                 not isinstance(value, UserString) and
                 all(isinstance(v, float) for v in value) and
                 all(not (val < -1.7976931348623157e+308 or val > 1.7976931348623157e+308) or math.isinf(val) for val in value)), \
                "The 'target_velocities' field must be a set or sequence and each value of type 'float' and each double in [-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]"
        self._target_velocities = array.array('d', value)

    @builtins.property
    def execution_time(self):
        """Message field 'execution_time'."""
        return self._execution_time

    @execution_time.setter
    def execution_time(self, value):
        if __debug__:
            assert \
                isinstance(value, float), \
                "The 'execution_time' field must be of type 'float'"
            assert not (value < -1.7976931348623157e+308 or value > 1.7976931348623157e+308) or math.isinf(value), \
                "The 'execution_time' field must be a double in [-1.7976931348623157e+308, 1.7976931348623157e+308]"
        self._execution_time = value

    @builtins.property
    def stiffness(self):
        """Message field 'stiffness'."""
        return self._stiffness

    @stiffness.setter
    def stiffness(self, value):
        if isinstance(value, array.array):
            assert value.typecode == 'd', \
                "The 'stiffness' array.array() must have the type code of 'd'"
            self._stiffness = value
            return
        if __debug__:
            from collections.abc import Sequence
            from collections.abc import Set
            from collections import UserList
            from collections import UserString
            assert \
                ((isinstance(value, Sequence) or
                  isinstance(value, Set) or
                  isinstance(value, UserList)) and
                 not isinstance(value, str) and
                 not isinstance(value, UserString) and
                 all(isinstance(v, float) for v in value) and
                 all(not (val < -1.7976931348623157e+308 or val > 1.7976931348623157e+308) or math.isinf(val) for val in value)), \
                "The 'stiffness' field must be a set or sequence and each value of type 'float' and each double in [-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]"
        self._stiffness = array.array('d', value)

    @builtins.property
    def damping(self):
        """Message field 'damping'."""
        return self._damping

    @damping.setter
    def damping(self, value):
        if isinstance(value, array.array):
            assert value.typecode == 'd', \
                "The 'damping' array.array() must have the type code of 'd'"
            self._damping = value
            return
        if __debug__:
            from collections.abc import Sequence
            from collections.abc import Set
            from collections import UserList
            from collections import UserString
            assert \
                ((isinstance(value, Sequence) or
                  isinstance(value, Set) or
                  isinstance(value, UserList)) and
                 not isinstance(value, str) and
                 not isinstance(value, UserString) and
                 all(isinstance(v, float) for v in value) and
                 all(not (val < -1.7976931348623157e+308 or val > 1.7976931348623157e+308) or math.isinf(val) for val in value)), \
                "The 'damping' field must be a set or sequence and each value of type 'float' and each double in [-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]"
        self._damping = array.array('d', value)
