flex_read_trajectory_data_rtn

NI-Motion Functions

flex_read_trajectory_data_rtn

Device Compatibility

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

Read Trajectory Data Return

Usage

status = flex_read_trajectory_data_rtn(u8 boardID, i32* returnData);

Purpose

Reads a sample of acquired data from the samples buffer.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
returnData [i32]* Array of position and velocity data for selected axes

Parameter Discussion

returnData contains a single sample of data as an array of position and velocity data for the selected axes. The size of the returnData array depends upon the number of axes selected with the Acquire Trajectory Data function.

For each axis selected, this function returns two array elements: position is returned in onboard variable n in counts (steps), and velocity is returned in onboard variable n+1 in counts/s (steps/s). The maximum array size is 8 when all 4 axes are selected.

Using This Function

The Read Trajectory Data function 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 function. The sample buffer operates first-in-first-out (FIFO), so multiple calls to this function 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 this function to avoid emptying the buffer.

Note  Attempting to read an empty sample buffer generates an error.

The Acquire Trajectory Data and Read Trajectory Data functions are used to acquire and read back time-sampled position and velocity data for analysis and display. These functions 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 function is executed with axes 1, 2, and 4 selected. Each call to the Read Trajectory Data function returns one sample with an array size of six and the following data in the array:

   returnData[] = {Axis 1 position, Axis 1 velocity,
      Axis 2 position, Axis 2 velocity
      Axis 4 position, Axis 4 velocity}