Read Trajectory Data

NI-Motion VI

Read Trajectory Data

Reads a sample of acquired data from the samples buffer.

Details

Device Compatibility

DeviceCompatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Accelnet
Y
NI SoftMotion Controller for CANopen—Xenus
Y
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
Ret Vect contains position and velocity. Position is returned in onboard variable n in counts (steps), and velocity is returned in onboard variable n+1 in counts/s (steps/s).

Available return vectors include return data to the host (0xFF), return data to a variable (0x01 through 0x78), return data to an indirect variable (0x81 through 0xF8), and do not return data (0). Refer to Input and Return Vectors for more detailed information.
error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Sample Data contains a single sample of data as an array of position and velocity data for the selected axes. The size of the Sample Data array depends upon the number of axes selected with the Acquire Trajectory Data VI.

For each axis selected, this VI returns one array element with two cluster elements: position in counts (steps), and velocity in counts/s (steps/s). The maximum array size is 8, when all 4 axes are selected.

Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.

Using This VI

The Read Trajectory Data VI is used to read back a single sample of acquired data from the onboard sample buffer. The number of samples, the time between samples and the size of each sample is set when you execute the Acquire Trajectory Data VI. The sample buffer operates first-in-first-out (FIFO), so multiple calls to this VI return samples in their correct time sequence.

While it is possible to read the sample buffer while samples are still being acquired, you must wait enough time between calls to the Read Trajectory Data VI to avoid emptying the buffer.

Note  Attempting to read an empty sample buffer generates an error. Refer to Errors and Error Handling for information about errors and error handling.

The Acquire and Read Trajectory Data VIs are used to acquire and read back time-sampled position and velocity data for analysis and display. These VIs implement a digital oscilloscope that is useful during system set up, PID tuning, and general motion with data acquisition synchronization.

Example

The Acquire Trajectory Data VI is executed with axes 1, 2, and 4 selected. Each call to the Read Trajectory Data VI returns one sample with an array size of six and the following data in the array:

Sample Data[ ] = { Axis 1 position, Axis 1 velocity,

Axis 2 position, Axis 2 velocity

Axis 4 position, Axis 4 velocity }