flex_load_gear_ratio

NI-Motion Functions

flex_load_gear_ratio

Device Compatibility

Device Compatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
Y
NI SoftMotion Controller for CANopen—Accelnet
Y

Load Gear Ratio

Usage

status = flex_load_gear_ratio(u8 boardID, u8 axis, u16 absoluteOrRelative, i16 ratioNumerator, u16 ratioDenominator, u8 inputVector);

Purpose

Loads the gear ratio for master-slave gearing.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axis u8 slave axis to control
absoluteOrRelative u16 selects absolute or relative gearing between master and slave
ratioNumerator i16 gear ratio numerator of the slave relative to the master
ratioDenominator u16 gear ratio denominator of the slave relative to the master
inputVector u8 source of the data for this function

Parameter Discussion

axis is the slave axis to control. Valid values are NIMC_AXIS1 through NIMC_AXIS30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes for axis resource IDs.

absoluteOrRelative selects absolute (NIMC_ABSOLUTE_GEARING) or relative (NIMC_RELATIVE_GEARING) gearing between the master and slave.

ratioNumerator is gear ratio numerator of the slave relative to the master. The numerator is a signed value between –32,768 to +32,767 to allow for both positive and negative gearing.

ratioDenominator is the gear ratio denominator of the slave relative to the master. The denominator must be between 1 to 32,767.

inputVector contains the type, numerator, denominator parameters that are the source of data for this function.

Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function loads the gear ratio of the slave axis relative to its master and selects if this ratio is absolute or relative. The ratio is loaded as a numerator and denominator because it is a natural format for a ratio (numerator: denominator) and it allows a broad range of ratios, from 1:32,767 to 32,767:1. The ratio is always specified as slave relative to master (slave:master).

When you execute the Enable Gearing function, the positions of the slave and its master are recorded as their absolute gearing reference. From then on, as long as the gear ratio remains absolute, every incremental change of the master position is multiplied by the absolute gear ratio and applied to the slave axis.

If a relative gear ratio is selected and loaded after gearing is enabled, the position of the master is recorded as its relative reference point and every incremental change from this reference point is multiplied by the relative gear ratio and applied to the slave axis or axis.

Note  While changing an absolute gear ratio on the fly is allowed, you must be careful because the slave axis jumps with full torque to the position defined by the new ratio even when the master position has not changed. Similarly, resetting the position on a master axis causes its slave axes to jump to a new position relative to the new position of the master axis.

The Load Gear Ratio function must be called prior to enabling master-slave gearing with the Enable Gearing function. Often the positions of the master and slave are reset to zero or some known position prior to enabling gearing, though this is not always required. The execution of the Enable Gearing function stores both positions as offsets and gears them from that point onward.

Relative gearing changes the position of the slave axis only when the master moves. It uses the length of the current move of the master axis to calculate how far to move the slave axis. At the end of the move, if the slave axis is not at the exact position, the position error is discarded. This may happen when the true target for the slave axis is a fractional position, which is impossible to actually reach. The position error can add up over time to become significant. If it become a problem, call this function with absolute gearing selected to correct for the accumulated error. The controller calculates where the slave is supposed to be relative to the offset of the master axis beginning from the position where gearing was enabled. With gearing ratios less than 1, this problem does not appear.

Master-slave functionality of slave axes is in addition to their normal mode of operation. This allows a point-to-point move to be superimposed upon the slave while the slave axis is in motion due to being geared to its master. This functionality is useful for registration and reference offset moves. Refer to the Gearing section of the NI-Motion Help for information about using superimposed moves/registration applications. Also, refer to the Rotating Knife section of the NI-Motion Help example code that includes superimposed moves.

Refer to the Configure Gear Master and Enable Gearing functions for more information about master-slave gearing.

Example

To load a slave to master gear absolute gear ratio of 3:2, call the Load Gear Ratio function with absoluteOrRelative = NIMC_ABSOLUTE_GEARING (absolute), ratioNumerator = 3 and ratioDenominator = 2. For two axes with identical resolution, setting a gear ratio of 3:2 results in the slave axis rotating three revolutions for every two revolutions of the master.