nimcWriteTrajectoryData

NI-Motion Functions

nimcWriteTrajectoryData

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

Write Trajectory Data

Usage

status = nimcWriteTrajectoryData(TnimcDeviceHandle deviceHandle, TnimcAxisHandle axisHandle, TnimcTrajectoryData attribute, TnimcData* data);

Purpose

Configures trajectory generator parameters.

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
deviceHandle TnimcDeviceHandle assigned by Measurement & Automation Explorer (MAX)
axisHandle TnimcAxisHandle axis to read
attribute TnimcTrajectoryData attribute to set
data TnimcData* the data for the attribute you are writing

Parameter Discussion

axisHandle is the axis on which to configure trajectory parameters. Valid values are 1 through 30. On motion controllers that support fewer than thirty axes, reading non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError).

attribute is the attribute to set. The following are valid attributes:

attribute Description
TnimcTrajectoryDataMoveCompleteWhenDeactivated Adds or removes motor off status as a criteria for move complete.
TnimcTrajectoryDataMoveCompleteWhenNotMoving Adds or removes motor logical stop status as a criteria for move complete.
TnimcTrajectoryDataMoveCompleteAfterDelay Adds or removes a user configured settling time delay as a criteria for move complete.
TnimcTrajectoryDataMoveCompleteTimeDelay Sets the settling time delay. Valid values are 0 to 0.255 seconds.
TnimcTrajectoryDataMoveCompleteWhenInRange Adds or removes a user configured position range as a criteria for move complete.
TnimcTrajectoryDataMoveCompleteRangeDistance Sets the position range. Valid values are 0 to 32,787 counts, steps, or user units on the NI SoftMotion Controller.
TnimcTrajectoryDataMoveCompleteMinimumActiveTime Sets the minimum time that move complete status must stay true. Valid values are 0 to 0.255 seconds.
TnimcTrajectoryDataMoveCompleteWhenInPositionActive Adds or removes the in-position input state as a criteria for move complete.

data is the value for the attribute you are writing in the following structure:

struct{
   i32 longData;
   u8 boolData;
   f64 doubleData;
} TnimcData;

Based on the attribute, the correct member of TnimcData must be set as follows:

  • For TnimcTrajectoryDataMoveCompleteWhenDeactivated, set boolData in the TnimcData structure to TnimcTrue to add motor off status, and set it to TnimcFalse to remove motor off status.
  • For TnimcTrajectoryDataMoveCompleteWhenNotMoving, set boolData in the TnimcData structure to TnimcTrue to add motor stop status, and set it to TnimcFalse to remove motor stop status.
  • For TnimcTrajectoryDataMoveCompleteAfterDelay, set boolData in the TnimcData structure to TnimcTrue to enable a user-defined delay, and set it to TnimcFalse to disable a user-defined delay.
  • For TnimcTrajectoryDataMoveCompleteTimeDelay, set doubleData in the TnimcData structure to the desired time delay, in seconds, to wait for move complete.
  • For TnimcTrajectoryDataMoveCompleteWhenInRange, set boolData in the TnimcData structure to TnimcTrue to enable a position range, and set it to TnimcFalse to disable a position range.
  • For TnimcTrajectoryDataMoveCompleteRangeDistance, set doubleData in the TnimcData structure to the desired position range distance, in counts, steps, or user units for the NI SoftMotion Controller, for move complete.
  • For TnimcTrajectoryDataMoveCompleteMinimumActiveTime, set doubleData in the TnimcData structure to the desired minimum wait time, in seconds, to wait for move complete.
  • For TnimcTrajectoryDataMoveCompleteWhenInPositionActive, set boolData in the TnimcData structure to TnimcTrue to enable using the in-position input as a criteria for move complete, and set it to TnimcFalse to disable using the in-position input.

The effect of the criteria parameters can be summarized with the following equation:

Move Complete = (Profile Complete [ OR When Deactivated ] )
   [ AND (Not Moving == True) ]
   [ AND (Delay == Done ) ] 
   [ AND ( | position – target position | < range distance ) ]
   [ AND (In-Position == Active) ]
where [...] indicates optional criteria.

Using This Function

Use this function to configure trajectory generator parameters for reporting a move complete. When a move is complete on an axis, the corresponding bit in the Move Complete Status (MCS) register is set. Refer to Read Move Complete Status for information about reading the MCS register.

If TnimcTrajectoryDataMoveCompleteWhenDeactivated is true, any condition that causes the axis to turn its motor off (a kill or following error trip) satisfies this requirement for Move Complete.

If TnimcTrajectoryDataMoveCompleteWhenNotMoving is true, the axis must be logically stopped for the move to be considered complete.

If TnimcTrajectoryDataMoveCompleteAfterDelay is true, the axis must wait a user-defined delay after the other criteria are met before the move is considered complete. The TnimcTrajectoryDataMoveCompleteTimeDelay attribute is typically used to wait the mechanical settling time so that a move is not considered complete until vibrations in the mechanical system have damped out. It also can be used to compensate for PID pull-in time due to the integral term. This pull-in is typically at velocities below the Run/Stop threshold.

Note  You can use the TnimcTrajectoryDataMoveCompleteAfterDelay attribute to guarantee a minimum time for the False state. The status transitions from Complete to Not Complete at the start of a move and stays in the Not Complete state for at least this delay time even in the case of a zero distance move.

If TnimcTrajectoryDataMoveCompleteWhenInRange is true, the axis checks its final stopping position versus its target position and only sets the Move Complete status if the absolute value of the difference is less than TnimcTrajectoryDataMoveCompleteRangeDistance.

Finally, if TnimcTrajectoryDataMoveCompleteWhenInPositionActive is true, the in-position input signal is used as a criteria for move complete, and the move is only complete if the in-position signal is active.

A non-zero value for TnimcTrajectoryDataMoveCompleteMinimumActiveTime guarantees the status stays in the True state for at least this minimum time, even if another move starts immediately. You can use this feature to make sure the host does not miss a Move Complete status when it polls the Move Complete Status register.

Tip  You can adjust move complete criteria settings in MAX on the Trajectory Settings tab.

This function is typically called for each axis prior to using the axis for position control. After the attribute is set, it remains in effect until it is disabled. You can execute this function at any time.

When an axis starts, its corresponding bit in the Move Complete Status register is reset to zero. When the move completes, the bit is set to one. You can check the status of an axis or axes at any time by polling the MCS register. Onboard programs can use this status to automatically sequence moves with the Wait on Event function.

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI 73xx Controller Considerations

The following list includes considerations you must make when you are using this function with a 73xx motion controller:

  • The NI 7344 does not support the TnimcTrajectoryDataMoveCompleteWhenInPositionActive attribute.
  • 7330, 7340, and 7350 controllers use Configure Motion I/O Map to map the in-position input to a general-purpose I/O line.

NI SoftMotion Controller Considerations

The following includes considerations you must make when you are using this function with the NI SoftMotion Controller:

The NI SoftMotion Controller does not support the TnimcTrajectoryDataMoveCompleteWhenInPositionActive attribute.