SetAxisTouchProbe

Records the position of an axis at a trigger event.

Syntax

KsCommandStatus SetAxisTouchProbe(
     int Index,
     McProbeTrigger TriggerInput,
     BOOL WindowOnly,
     double firstPosition,
     double lastPosition,
     double* recordedPosition
);

Parameters

Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.

TriggerInput [in]: the trigger signal source. Trigger input may be specified by the Index. The signal source can be selected from the McProbeTrigger structure.

WindowOnly [in]: if set, only the value in the window will be used to trigger events. The window is the range between firstPosition and lastPosition.

firstPosition [in]: the start position from where (positive direction) trigger events are accepted (in user units). The value included in window. Currently, firstPosition must be less than lastPosition.

lastPosition [in]: the end position of the window (in user units). The value included in window.

recordedPosition [out]: the position where the trigger event occurred (in user units).

Return value

Returns the KsCommandStatus structure.

Remarks

Example

VOID RecordPosition(INT Index, DOUBLE Velocity, McDirection Direction) {
   double PosRecord = 0;

   //Configure the probe
   McProbeTrigger ProbeTrigger = { 0 };
   ProbeTrigger.TouchProbeId = 0;
   ProbeTrigger.Software = FALSE;
   ProbeTrigger.IndexPulse = TRUE;
   ProbeTrigger.Edge = TRUE;
   ProbeTrigger.AxisSwitch = FALSE;
   ProbeTrigger.Index = 0;
   ProbeTrigger.Offset = 0;
   KsCommandStatus probe = SetAxisTouchProbe(Index, ProbeTrigger, FALSE, 0, 0, &PosRecord);

   //Start moving
   MoveAxisVelocity(Index, Velocity, 36000, 36000, 3600000, Direction, mcAborting);

   //Wait for the position to be recorded
   probe = WaitForCommand(30, TRUE, probe);

   RtPrintf("Recorded position: %d\n", (int)PosRecord);
   WaitForCommand(30, TRUE, HaltAxis(Index, 36000, 3600000, mcAborting));
}

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksmotion.h ksmotion.h
Library KsApi_Rtss.lib KsApi.lib

See also

AbortCommand

EnableTouchProbe

PowerAxis

ResetAxis