HomeAxis
Commands the axis to perform the "search home" sequence. The Position input is used to set the absolute position when an index signal is detected. This function completes at Standstill if it was started from Standstill.
Syntax
KsCommandStatus HomeAxis(
int Index,
double Position,
double Velocity,
double EndVelocity,
double Acceleration,
double Deceleration,
double Jerk,
McDirection Direction,
McHomingMode HomingMode
);
Parameters
Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Position [in]: sets an absolute position when the index signal is detected. [unit]
Velocity [in]: the start velocity of the homing move.
EndVelocity [in]: the end velocity of the homing move. The usage depends on the homing mode.
Acceleration [in]: a value for the acceleration.
Deceleration [in]: a value for the deceleration.
Jerk [in]: a value for the jerk.
Direction [in]: the direction the axis moves to home. Use the type 0, 2, or 3 in the McDirection type.
HomingMode [in]: selects a homing mode. See the McHomingMode type.
Return value
Returns the KsCommandStatus structure.
Remarks
- When using an incremental encoder, the motor's position is unknown when the motor is turned on. A known reference position must be searched to know the motor position. This is called homing.
- In the
homingSlave
mode, themcSlaveHomingMode
andmcSlaveHomeOffset
should be set first using the SetAxisParameter function.
Example
VOID HomeLatch(INT Index) {
//Configure the probe to use for position latching
/*The axis will move in the preset homing direction at the high velocity
until the probe is triggered*/
//The axis will then move back to the latched position using the low velocity
double PosRecord = 0;
McProbeTrigger ProbeTrigger = { 0 };
ProbeTrigger.TouchProbeId = 0;
ProbeTrigger.IndexPulse = TRUE;
ProbeTrigger.Edge = TRUE;
KsCommandStatus probe = SetAxisTouchProbe(Index, ProbeTrigger, FALSE, 0, 0, &PosRecord);
//Start Homing
KsCommandStatus home = WaitForCommand(30, TRUE, HomeAxis(Index, 0, 360, 36,
3600, 3600, 3600000, mcPositiveDirection, homingLatch));
double homePosition = 1;
GetAxisPosition(Index, mcActualValue, &homePosition);
RtPrintf("Home position: %d\n", (int)homePosition);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also