JogAxis

Commands a never-ending controlled motion at a specified velocity. Unlike MoveAxisVelocity, JogAxis doesn't have BufferMode. It keeps moving until the jog input is reset.

Syntax

KsCommandStatus JogAxis(
     int Index,
     double Velocity,
     double Acceleration,
     double Deceleration,
     double Jerk,
     McDirection Direction
);

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 direction of the jog move. It can be mcPositiveDirection or mcNegativeDirection. See the McDirection type.

Return value

Returns the KsCommandStatus structure.

Remarks

Because JogAxis keeps controlling the axis, it triggers an error if a limit is reached.

Example

VOID MoveVelocity(INT Index, DOUBLE Velocity, INT Duration) {
   McDirection direction = mcPositiveDirection;
   if (Velocity < 0)
      direction = mcNegativeDirection;
   
   //Start the velocity motion
   KsCommandStatus status = WaitForCommand(5, FALSE, JogAxis(Index, Velocity, 
	36000, 36000, 3600000, direction));

   double velocity = 0;
   KsError nRet = GetAxisVelocity(Index, mcActualValue, &velocity);

   RtPrintf("Current Velocity: %d degree/s\n", (int)velocity);
   //Let it spin a bit
   Sleep(3000);
   //Stop the axis
   status = WaitForCommand(5, FALSE, 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

HaltAxis

InchAxis

MoveAxisVelocity

StopAxis