flex_read_trajectory_status

NI-Motion Functions

flex_read_trajectory_status

Device Compatibility

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

Read Trajectory Status

Usage

status = flex_read_trajectory_status(u8 boardID, u8 axisOrVectorSpace, u16 statusType, u8 returnVector);

Purpose

Reads the selected motion trajectory status of all axes or vector spaces.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrVectorSpace u8 selects axis control or vector space control for move complete, or axis control for all other types
statusType u16 status selector
returnVector u8 destination for the return data

Parameter Discussion

axisOrVectorSpace can select multiple axes (NIMC_AXIS_CTRL) or multiple vector spaces (NIMC_VECTOR_SPACE_CTRL). Refer to Axes and Vector Spaces for axis and vector space resource IDs.

statusType is the selector for the type of trajectory status to read.

statusType Constant statusType Value axisOrVectorSpace Value
NIMC_RUN_STOP_STATUS 0 NIMC_AXIS_CTRL only
NIMC_MOTOR_OFF_STATUS 1 NIMC_AXIS_CTRL only
NIMC_VELOCITY_THRESHOLD_STATUS 2 NIMC_AXIS_CTRL only
NIMC_MOVE_COMPLETE_STATUS 3 NIMC_AXIS_CTRL or NIMC_VECTOR_SPACE_CTRL

returnVector indicates the destination for the return data generated by this function. Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and return no data (0). Refer to Input and Return Vectors for more detailed information.

Note  The suffix _rtn on the function indicates that the data must be returned to the host. When this calling convention is used, no returnVector is required.

Using This Function

This function returns a multi-axis status bitmap of the status type selected. You can select one of the following three trajectory status types:

NIMC_RUN_STOP_STATUS Run/Stop status is updated based on the filtered velocity and run/stop criteria set by Load Run/Stop Threshold. The status is set when the axis is travelling fast enough to be considered running. The axis is considered to be running when the change in position per sample period exceeds the Run/Stop threshold set with the Load Run/Stop Threshold function.

NIMC_MOTOR_OFF_STATUS
A motor can be Off for two reasons. Either a kill stop was executed or the following error trip point was exceeded. A Motor Off condition also means that an enabled inhibit output is active. Refer to the Configure Inhibit Outputs function for more information.

NIMC_VELOCITY_THRESHOLD_STATUS
The Velocity Threshold status indicates if the axis velocity is above (True) or below (False) the programmed velocity threshold. Refer to the Load Velocity Threshold function for information about setting and using a velocity threshold.

NIMC_MOVE_COMPLETE_STATUS
The Move Complete status indicates if an axis or vector space is in the move complete state, which is the default when an axis or vector space is idle. While a move is in progress, the move complete status is false. For a move to be complete on a vector space, the move complete status must be true on all axes in the vector space.

During a vector space move, if one axis in a vector space trips out on a following error, that axis is killed, and the move complete status remains false. The other axes in the vector space decelerate to a stop, and the move complete status is true. For the vector space as a whole, the move complete status is false, because the move did not complete properly.

Use the Configure Move Complete Criteria function to change the conditions that cause a move to be evaluated as complete. For example, by changing the move complete criteria to be profile complete (default) OR motor off, the previous situation would result in a true move complete status when one of the axes in the vector space exceeded the programmed following error limit.

Note  You can get all four trajectory statuses for a single axis by calling the Read per Axis Status function.

Example
To get Motor Off status, call the Read Trajectory Status function with axisOrVectorSpace = NIMC_AXIS_CTRL and statusType = NIMC_MOTOR_OFF_STATUS. Assume the returned status = 0x0062. This corresponds to the following bitmap:

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ... XXX XXX Axis 8 Axis 7 Axis 6 Axis 5 Axis 4 Axis 3 Axis 2 Axis 1 XXX
0 ... 0 0 0 0 0 0 0 1 1 0 0

Axes 1 and 4 are Off.

For your programming convenience, two utility functions—Check Move Complete Status and Wait for Move Complete—are provided, which allow you to specify an axis, vector space, group of axes, or group of vector spaces, and find out if a move is complete, or wait until a move is complete. These functions return a simple true/false value indicating if a move is complete.