MoveAxisVelocity
Commands a never-ending controlled motion at a specified velocity.
Syntax
KsCommandStatus MoveAxisVelocity(
int Index,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McDirection Direction,
McBufferMode BufferMode
);
Parameters
Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Velocity [in]: a value of the specified velocity. [unit/second]
Acceleration [in]: a value of the acceleration. The unit is determined by the McProfileType type. (increasing energy of the motor) [unit/second2] or [second]
Deceleration [in]: a value of the deceleration. The unit is determined by the McProfileType type. (decreasing energy of the motor) [unit/second2] or [second]
Jerk [in]: a value of the jerk. The unit is determined by the McProfileType type. [unit/second3] or [second]
Direction [in]: the moving direction of an axis. See the McDirection type. (mcShortestWay
is not applicable)
BufferMode [in]: defines how to blend the velocity of two functions. See the McBufferMode type.
Return value
Returns the KsCommandStatus structure.
Remarks
- When the axis has reached the specified velocity, this command is finished but the axis keeps moving.
- For more information about how the blending modes work, see Concepts > Blend movements.
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