flex_read_trajectory_data

NI-Motion Functions

flex_read_trajectory_data

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 Data

Usage

status = flex_read_trajectory_data(u8 boardID, u8 returnVector);

Purpose

Reads a sample of acquired data from the samples buffer.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
returnVector u8 destination for the return data

Parameter Discussion

returnVector 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), 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

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}