Esempio n. 1
0
def _get_io_number(io_path):
    """
    Get the number for an IO. 1-indexed!
    :param io_path: string, attribute path using robot and IO names
    :return: int, IO number
    """
    attribute_path = io_path + '_ioNumber'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 2
0
def _get_io_ignore(io_path):
    """
    Get the ignore (is-ignored) value for an IO
    :param io_path: string, attribute path using robot and IO names
    :return: bool, True if "Ignore IO" is checked, false if not
    """
    attribute_path = io_path + '_ignore'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 3
0
def _get_external_axis_velocity_limit(external_axis_path):
    """
    Get the velocity limit for an external axis.
    :param external_axis_path: string, attribute path using robot and external axis names
    :return:
    """
    attribute_path = external_axis_path + '_maxVelocity'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 4
0
def _get_external_axis_limits_max(external_axis_path):
    """
    Get the maximum position limit for an external axis.
    :param external_axis_path: string, attribute path using robot and external axis names
    :return:
    """
    attribute_path = external_axis_path + '_axisMax'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 5
0
def _get_external_axis_ignore(external_axis_path):
    """
    Get the ignore (is-ignored) value for an external axis
    :param external_axis_path: string, attribute path using robot and external axis names
    :return:
    """
    attribute_path = external_axis_path + '_ignore'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 6
0
def _get_external_axis_number(external_axis_path):
    """
    Get the number for an external axis. 1-indexed!
    :param external_axis_path: string, attribute path using robot and external axis names
    :return:
    """
    attribute_path = external_axis_path + '_axisNumber'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 7
0
def _get_external_axis_ignore(external_axis_path):
    """
    Get the ignore (is-ignored) value for an external axis
    :param external_axis_path: string, attribute path using robot and
                               external axis names
    :return: bool, True if "Ignore axis" is checked, false if not
    """
    attribute_path = external_axis_path + '_ignore'
    return mimic_utils.get_attribute_value(attribute_path)
Esempio n. 8
0
def _get_io_value(io_path, frame=None):
    """
    Get the value of an IO.
    :param io_path: string, attribute path using robot and IO names
    :param frame: optional frame parameter
    :return io_value: int, 0 or 1 if io type is 'digital'; float otherwise
    """
    attribute_path = io_path + '_value'
    io_value = mimic_utils.get_attribute_value(attribute_path, frame)

    return io_value
Esempio n. 9
0
def _get_external_axis_position(external_axis_path, frame=None):
    """
    Get the position of an external axis.
    :param external_axis_path: string, attribute path using robot and external axis names
    :param frame: optional frame parameter
    :return:
    """
    attribute_path = external_axis_path + '_position'
    external_axis_position = mimic_utils.get_attribute_value(attribute_path, frame)

    # If the axis' driving attribute is a translation, we need to convert from
    # Maya's units (cm) to millimeters
    driving_attribute = pm.listConnections(attribute_path,
                                           plugs=True,
                                           s=True)[0]
    driving_attr_ctrl, driving_attr_name = driving_attribute.split('.')

    if 'translate' in driving_attr_name:
        external_axis_position = external_axis_position * 10

    return external_axis_position